]> wagnertech.de Git - mfinanz.git/blobdiff - SL/DB/AuthUser.pm
Tabellen-/Klassennamen-Mappings für auth.* gefixt
[mfinanz.git] / SL / DB / AuthUser.pm
index c1b46b4ef79839844e5ff2793795fe4b858464c6..a11248ec6acda07ffb238bfdec12220f77734c5b 100644 (file)
@@ -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;
@@ -8,12 +5,10 @@ use strict;
 use List::Util qw(first);
 
 use SL::DB::MetaSetup::AuthUser;
+use SL::DB::Manager::AuthUser;
+use SL::DB::AuthClient;
 use SL::DB::AuthUserGroup;
-
-# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all.
-__PACKAGE__->meta->make_manager_class;
-
-__PACKAGE__->meta->schema('auth');
+use SL::DB::Helper::Util;
 
 __PACKAGE__->meta->add_relationship(
   groups => {
@@ -29,7 +24,7 @@ __PACKAGE__->meta->add_relationship(
   },
   clients => {
     type      => 'many to many',
-    map_class => 'SL::DB::AuthClient',
+    map_class => 'SL::DB::AuthUserClient',
     map_from  => 'user',
     map_to    => 'client',
   },
@@ -37,6 +32,17 @@ __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');
+  push @errors, "chunky bacon";
+
+  return @errors;
+}
+
 sub get_config_value {
   my ($self, $key) = @_;
 
@@ -44,4 +50,15 @@ sub get_config_value {
   return $cfg ? $cfg->cfg_value : undef;
 }
 
+sub config_values {
+  my $self = shift;
+
+  if (0 != scalar(@_)) {
+    my %settings = (ref($_[0]) || '') eq 'HASH' ? %{ $_[0] } : @_;
+    $self->configs([ map { SL::DB::AuthUserConfig->new(cfg_key => $_, cfg_value => $settings{$_}) } keys %settings ]);
+  }
+
+  return { map { ($_->cfg_key => $_->cfg_value) } @{ $self->configs } };
+}
+
 1;