X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/6cf3f7762efd40bee49a2b8f11bb4ab6915d9071..711e6c99a7057aa79b306e9cbd789d88d4b022a2:/SL/DB/Employee.pm diff --git a/SL/DB/Employee.pm b/SL/DB/Employee.pm index 841696b6e..0c321b62f 100644 --- a/SL/DB/Employee.pm +++ b/SL/DB/Employee.pm @@ -1,13 +1,40 @@ -# 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::Employee; use strict; use SL::DB::MetaSetup::Employee; +use SL::DB::Manager::Employee; + +__PACKAGE__->meta->add_relationship( + project_invoice_permissions => { + type => 'many to many', + map_class => 'SL::DB::EmployeeProjectInvoices', + }, +); + +__PACKAGE__->meta->initialize; + +sub has_right { + my $self = shift; + my $right = shift; + + return $::auth->check_right($self->login, $right); +} + +sub safe_name { + my ($self) = @_; + + return $self->name || $self->login; +} + +sub auth_user { + my ($self) = @_; + + die 'not an accessor' if scalar(@_) > 1; + + require SL::DB::AuthUser; -# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all. -__PACKAGE__->meta->make_manager_class; + return SL::DB::Manager::AuthUser->find_by(login => $self->login); +} 1;