Rose-Models für Mandantentabellen
[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::AuthGroupRight;
10
11 # Creates get_all, get_all_count, get_all_iterator, delete_all and update_all.
12 __PACKAGE__->meta->make_manager_class;
13
14 __PACKAGE__->meta->schema('auth');
15
16 __PACKAGE__->meta->add_relationship(
17   users => {
18     type      => 'many to many',
19     map_class => 'SL::DB::AuthUserGroup',
20     map_from  => 'group',
21     map_to    => 'user',
22   },
23   rights => {
24     type       => 'one to many',
25     class      => 'SL::DB::AuthGroupRight',
26     column_map => { id => 'group_id' },
27   },
28   clients => {
29     type      => 'many to many',
30     map_class => 'SL::DB::AuthClient',
31     map_from  => 'group',
32     map_to    => 'client',
33   },
34 );
35
36 __PACKAGE__->meta->initialize;
37
38 sub get_employees {
39   my @logins = map { $_->login } $_[0]->users;
40   return @logins ? @{ SL::DB::Manager::Employee->get_all(query => [ login => \@logins ]) } : ();
41 }
42
43 1;