Merge branch 'b-3.6.1' of ../kivitendo-erp_20220811
[kivitendo-erp.git] / SL / DB / Employee.pm
index 4cc109a..0c321b6 100644 (file)
@@ -5,6 +5,13 @@ 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 {
@@ -20,4 +27,14 @@ sub safe_name {
   return $self->name || $self->login;
 }
 
+sub auth_user {
+  my ($self) = @_;
+
+  die 'not an accessor' if scalar(@_) > 1;
+
+  require SL::DB::AuthUser;
+
+  return SL::DB::Manager::AuthUser->find_by(login => $self->login);
+}
+
 1;