-# This file has been auto-generated only because it didn't exist.
-# Feel free to modify it at will; it will not be overwritten automatically.
-
package SL::DB::AuthClient;
use strict;
use SL::DB::MetaSetup::AuthClient;
use SL::DB::Manager::AuthClient;
-# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all.
-__PACKAGE__->meta->schema('auth');
-
__PACKAGE__->meta->add_relationship(
users => {
type => 'many to many',
- map_class => 'SL::DB::AuthUserGroup',
+ map_class => 'SL::DB::AuthClientUser',
map_from => 'client',
map_to => 'user',
},
groups => {
type => 'many to many',
- map_class => 'SL::DB::AuthUserGroup',
+ map_class => 'SL::DB::AuthClientGroup',
map_from => 'client',
map_to => 'group',
},
-# This file has been auto-generated only because it didn't exist.
-# Feel free to modify it at will; it will not be overwritten automatically.
-
package SL::DB::AuthClientGroup;
use strict;
use SL::DB::MetaSetup::AuthClientGroup;
-# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all.
-__PACKAGE__->meta->schema('auth');
-
__PACKAGE__->meta->make_manager_class;
1;
-# This file has been auto-generated only because it didn't exist.
-# Feel free to modify it at will; it will not be overwritten automatically.
-
package SL::DB::AuthClientUser;
use strict;
use SL::DB::MetaSetup::AuthClientUser;
-# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all.
-__PACKAGE__->meta->schema('auth');
-
__PACKAGE__->meta->make_manager_class;
1;
-# This file has been auto-generated only because it didn't exist.
-# Feel free to modify it at will; it will not be overwritten automatically.
-
package SL::DB::AuthGroup;
use strict;
use SL::DB::Manager::AuthGroup;
use SL::DB::AuthGroupRight;
-__PACKAGE__->meta->schema('auth');
-
__PACKAGE__->meta->add_relationship(
users => {
type => 'many to many',
},
clients => {
type => 'many to many',
- map_class => 'SL::DB::AuthClient',
+ map_class => 'SL::DB::AuthClientGroup',
map_from => 'group',
map_to => 'client',
},
-# This file has been auto-generated only because it didn't exist.
-# Feel free to modify it at will; it will not be overwritten automatically.
-
package SL::DB::AuthGroupRight;
use strict;
use SL::DB::MetaSetup::AuthGroupRight;
-# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all.
__PACKAGE__->meta->make_manager_class;
-__PACKAGE__->meta->schema('auth');
-__PACKAGE__->meta->initialize;
-
1;
-# This file has been auto-generated only because it didn't exist.
-# Feel free to modify it at will; it will not be overwritten automatically.
-
package SL::DB::AuthUser;
use strict;
use SL::DB::MetaSetup::AuthUser;
use SL::DB::Manager::AuthUser;
+use SL::DB::AuthClient;
use SL::DB::AuthUserGroup;
-
-__PACKAGE__->meta->schema('auth');
+use SL::DB::Helper::Util;
__PACKAGE__->meta->add_relationship(
groups => {
},
clients => {
type => 'many to many',
- map_class => 'SL::DB::AuthClient',
+ map_class => 'SL::DB::AuthUserClient',
map_from => 'user',
map_to => 'client',
},
__PACKAGE__->meta->initialize;
+sub validate {
+ my ($self) = @_;
+
+ my @errors;
+ push @errors, $::locale->text('The login is missing.') if !$self->login;
+ push @errors, $::locale->text('The login is not unique.') if !SL::DB::Helper::Util::is_unique($self, 'login');
+ push @errors, "chunky bacon";
+
+ return @errors;
+}
+
sub get_config_value {
my ($self, $key) = @_;
-# This file has been auto-generated only because it didn't exist.
-# Feel free to modify it at will; it will not be overwritten automatically.
-
package SL::DB::AuthUserConfig;
use strict;
use SL::DB::MetaSetup::AuthUserConfig;
-# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all.
__PACKAGE__->meta->make_manager_class;
-__PACKAGE__->meta->schema('auth');
-__PACKAGE__->meta->initialize;
-
1;
-# This file has been auto-generated only because it didn't exist.
-# Feel free to modify it at will; it will not be overwritten automatically.
-
package SL::DB::AuthUserGroup;
use strict;
use SL::DB::MetaSetup::AuthUserGroup;
-# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all.
__PACKAGE__->meta->make_manager_class;
-__PACKAGE__->meta->schema('auth');
-
-__PACKAGE__->meta->add_foreign_keys(
- user => {
- class => 'SL::DB::AuthUser',
- key_columns => { user_id => 'id' },
- },
-
- group => {
- class => 'SL::DB::AuthGroup',
- key_columns => { group_id => 'id' },
- },
-);
-
-__PACKAGE__->meta->initialize;
-
1;
__PACKAGE__->meta->setup(
table => 'clients',
+ schema => 'auth',
columns => [
id => { type => 'serial', not_null => 1 },
__PACKAGE__->meta->setup(
table => 'clients_groups',
+ schema => 'auth',
columns => [
client_id => { type => 'integer', not_null => 1 },
__PACKAGE__->meta->setup(
table => 'clients_users',
+ schema => 'auth',
columns => [
client_id => { type => 'integer', not_null => 1 },
__PACKAGE__->meta->setup(
table => 'group',
+ schema => 'auth',
columns => [
id => { type => 'serial', not_null => 1 },
__PACKAGE__->meta->setup(
table => 'group_rights',
+ schema => 'auth',
columns => [
group_id => { type => 'integer', not_null => 1 },
__PACKAGE__->meta->setup(
table => 'user',
+ schema => 'auth',
columns => [
id => { type => 'serial', not_null => 1 },
__PACKAGE__->meta->setup(
table => 'user_config',
+ schema => 'auth',
columns => [
user_id => { type => 'integer', not_null => 1 },
__PACKAGE__->meta->setup(
table => 'user_group',
+ schema => 'auth',
columns => [
user_id => { type => 'integer', not_null => 1 },
],
primary_key_columns => [ 'user_id', 'group_id' ],
+
+ foreign_keys => [
+ user => {
+ class => 'SL::DB::AuthUser',
+ key_columns => { user_id => 'id' },
+ },
+
+ group => {
+ class => 'SL::DB::AuthGroup',
+ key_columns => { group_id => 'id' },
+ },
+ ],
);
1;