Admin: Teile von admin.pl in neuen Controller Admin verschoben; Mandanten anzeigen
[kivitendo-erp.git] / SL / DB / AuthGroup.pm
1 # This file has been auto-generated only because it didn't exist.
2 # Feel free to modify it at will; it will not be overwritten automatically.
3
4 package SL::DB::AuthGroup;
5
6 use strict;
7
8 use SL::DB::MetaSetup::AuthGroup;
9 use SL::DB::Manager::AuthGroup;
10 use SL::DB::AuthGroupRight;
11
12 __PACKAGE__->meta->schema('auth');
13
14 __PACKAGE__->meta->add_relationship(
15   users => {
16     type      => 'many to many',
17     map_class => 'SL::DB::AuthUserGroup',
18     map_from  => 'group',
19     map_to    => 'user',
20   },
21   rights => {
22     type       => 'one to many',
23     class      => 'SL::DB::AuthGroupRight',
24     column_map => { id => 'group_id' },
25   },
26   clients => {
27     type      => 'many to many',
28     map_class => 'SL::DB::AuthClient',
29     map_from  => 'group',
30     map_to    => 'client',
31   },
32 );
33
34 __PACKAGE__->meta->initialize;
35
36 sub get_employees {
37   my @logins = map { $_->login } $_[0]->users;
38   return @logins ? @{ SL::DB::Manager::Employee->get_all(query => [ login => \@logins ]) } : ();
39 }
40
41 1;