fe755c7b501ed3aa4a2afefc3d4b5c2e61b9cb39
[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 );
29
30 __PACKAGE__->meta->initialize;
31
32 sub get_employees {
33   my @logins = map { $_->login } $_[0]->users;
34   return @logins ? @{ SL::DB::Manager::Employee->get_all(query => [ login => \@logins ]) } : ();
35 }
36
37 1;