summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Sulfrian <alex@spline.inf.fu-berlin.de>2014-12-06 17:25:59 +0100
committerAlexander Sulfrian <alex@spline.inf.fu-berlin.de>2014-12-06 17:25:59 +0100
commit845799860b8697ad85b276ab53c07bec4c56cd87 (patch)
treea208e2d5fdd4d08175d473e016a8fb52f7f9d161
parentd7d7d7af5b11ffe493c27666efc79d92ddc56f6d (diff)
downloadcustom-845799860b8697ad85b276ab53c07bec4c56cd87.tar.gz
custom-845799860b8697ad85b276ab53c07bec4c56cd87.tar.bz2
custom-845799860b8697ad85b276ab53c07bec4c56cd87.zip
Kernel::System::Auth::Sync::LDAP: add initial role support
-rw-r--r--Kernel/System/Auth/Sync/LDAP.pm29
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,
+ );
+ }
+ }
}
}