diff options
author | Alexander Sulfrian <alex@spline.inf.fu-berlin.de> | 2014-12-06 17:25:59 +0100 |
---|---|---|
committer | Alexander Sulfrian <alex@spline.inf.fu-berlin.de> | 2014-12-06 17:25:59 +0100 |
commit | 845799860b8697ad85b276ab53c07bec4c56cd87 (patch) | |
tree | a208e2d5fdd4d08175d473e016a8fb52f7f9d161 /Kernel/System | |
parent | d7d7d7af5b11ffe493c27666efc79d92ddc56f6d (diff) | |
download | custom-845799860b8697ad85b276ab53c07bec4c56cd87.tar.gz custom-845799860b8697ad85b276ab53c07bec4c56cd87.tar.bz2 custom-845799860b8697ad85b276ab53c07bec4c56cd87.zip |
Kernel::System::Auth::Sync::LDAP: add initial role support
Diffstat (limited to 'Kernel/System')
-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, + ); + } + } } } |