diff options
Diffstat (limited to 'Kernel')
-rw-r--r-- | Kernel/System/Auth/Sync/LDAP.pm | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/Kernel/System/Auth/Sync/LDAP.pm b/Kernel/System/Auth/Sync/LDAP.pm index 5f83068..6451fbe 100644 --- a/Kernel/System/Auth/Sync/LDAP.pm +++ b/Kernel/System/Auth/Sync/LDAP.pm @@ -329,6 +329,35 @@ sub Sync { ); } } + + # sync initial roles + my $UserSyncInitialRoles = $ConfigObject->Get( + 'AuthSyncModule::LDAP::UserSyncInitialRoles' . $Self->{Count} + ); + if ($UserSyncInitialRoles) { + ROLE: + for my $Role ( @{$UserSyncInitialRoles} ) { + + # only for valid roles + if ( !$SystemRolesByName{$Role} ) { + $Kernel::OM->Get('Kernel::System::Log')->Log( + Priority => 'notice', + Message => + "Invalid role '$Role' in " + . "'AuthSyncModule::LDAP::UserSyncInitialRoles" + . "$Self->{Count}'!", + ); + next ROLE; + } + + $GroupObject->RoleMemberAdd( + RID => $SystemRolesByName{$Role}, + UID => $UserID, + Active => 1, + UserID => 1, + ); + } + } } } |