]> wagnertech.de Git - mfinanz.git/blobdiff - SL/DB/AuthUser.pm
RDBO: Setups der Auth*-Instanzen vereinheitlicht
[mfinanz.git] / SL / DB / AuthUser.pm
index 41644eb1f73a85483fe2d3eec100dd80d0cff892..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;
@@ -9,9 +6,9 @@ use List::Util qw(first);
 
 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 => {
@@ -27,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',
   },
@@ -35,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) = @_;