X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FDB%2FAuthUser.pm;h=2565d067f661842bf4a76b2d68e12d5af7287728;hb=ac51747a97935ac323adf9c9009404d3d9fe357e;hp=41644eb1f73a85483fe2d3eec100dd80d0cff892;hpb=d8ac08282dad52789b8bea785e8cddae44085483;p=kivitendo-erp.git diff --git a/SL/DB/AuthUser.pm b/SL/DB/AuthUser.pm index 41644eb1f..2565d067f 100644 --- a/SL/DB/AuthUser.pm +++ b/SL/DB/AuthUser.pm @@ -1,6 +1,3 @@ -# 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; @@ -9,9 +6,12 @@ use List::Util qw(first); use SL::DB::MetaSetup::AuthUser; use SL::DB::Manager::AuthUser; -use SL::DB::AuthUserGroup; +use SL::DB::Helper::Util; -__PACKAGE__->meta->schema('auth'); +use constant CONFIG_VARS => qw(copies countrycode dateformat timeformat default_media default_printer_id + email favorites fax hide_cvar_search_options mandatory_departments menustyle name + numberformat show_form_details signature stylesheet taxincluded_checked tel + template_format focus_position form_cvars_nr_cols item_multiselect); __PACKAGE__->meta->add_relationship( groups => { @@ -27,7 +27,7 @@ __PACKAGE__->meta->add_relationship( }, clients => { type => 'many to many', - map_class => 'SL::DB::AuthClient', + map_class => 'SL::DB::AuthClientUser', map_from => 'user', map_to => 'client', }, @@ -35,10 +35,20 @@ __PACKAGE__->meta->add_relationship( __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'); + + return @errors; +} + sub get_config_value { my ($self, $key) = @_; - my $cfg = first { $_->cfg_key eq $key } @{ $self->configs }; + my $cfg = first { $_->cfg_key eq $key } @{ $self->configs || [] }; return $cfg ? $cfg->cfg_value : undef; } @@ -50,7 +60,7 @@ sub config_values { $self->configs([ map { SL::DB::AuthUserConfig->new(cfg_key => $_, cfg_value => $settings{$_}) } keys %settings ]); } - return { map { ($_->cfg_key => $_->cfg_value) } @{ $self->configs } }; + return { map { ($_->cfg_key => $_->cfg_value) } @{ $self->configs || [] } }; } 1;