1 # This file has been auto-generated only because it didn't exist.
2 # Feel free to modify it at will; it will not be overwritten automatically.
4 package SL::DB::AuthUser;
8 use List::Util qw(first);
10 use SL::DB::MetaSetup::AuthUser;
11 use SL::DB::Manager::AuthUser;
12 use SL::DB::AuthUserGroup;
14 __PACKAGE__->meta->schema('auth');
16 __PACKAGE__->meta->add_relationship(
18 type => 'many to many',
19 map_class => 'SL::DB::AuthUserGroup',
24 type => 'one to many',
25 class => 'SL::DB::AuthUserConfig',
26 column_map => { id => 'user_id' },
29 type => 'many to many',
30 map_class => 'SL::DB::AuthClient',
36 __PACKAGE__->meta->initialize;
38 sub get_config_value {
39 my ($self, $key) = @_;
41 my $cfg = first { $_->cfg_key eq $key } @{ $self->configs };
42 return $cfg ? $cfg->cfg_value : undef;
48 if (0 != scalar(@_)) {
49 my %settings = (ref($_[0]) || '') eq 'HASH' ? %{ $_[0] } : @_;
50 $self->configs([ map { SL::DB::AuthUserConfig->new(cfg_key => $_, cfg_value => $settings{$_}) } keys %settings ]);
53 return { map { ($_->cfg_key => $_->cfg_value) } @{ $self->configs } };