48 include_once
'./Services/LDAP/classes/class.ilLDAPAttributeMapping.php';
49 include_once
'./Services/LDAP/classes/class.ilLDAPServer.php';
51 return self::$default_role =
64 $query =
"SELECT DISTINCT(role_id) FROM ldap_role_assignments " .
65 'WHERE server_id = ' . $ilDB->quote($a_server_id,
'integer');
68 $roles[
$row->role_id] =
$row->role_id;
70 $gr = self::getDefaultRole($a_server_id);
72 return $roles ? $roles :
array();
85 $query =
"SELECT DISTINCT(att_name) " .
86 "FROM ldap_role_assignments " .
87 'WHERE server_id = ' . $ilDB->quote($a_server_id,
'integer');
96 $names = array_merge((
array)
$names, self::getAdditionalPluginAttributes($a_server_id));
118 $query =
"SELECT rule_id,add_on_update,remove_on_update FROM ldap_role_assignments " .
119 "WHERE (add_on_update = 1 OR remove_on_update = 1) " .
120 'AND server_id = ' . $ilDB->quote($a_server_id,
'integer');
125 include_once
'./Services/LDAP/classes/class.ilLDAPRoleAssignmentRule.php';
128 $matches =
$rule->matches($a_usr_data);
129 if ($matches and
$row->add_on_update) {
131 $roles[] = self::parseRole(
$rule->getRoleId(), self::ROLE_ACTION_ASSIGN);
133 if (!$matches and
$row->remove_on_update) {
135 $roles[] = self::parseRole(
$rule->getRoleId(), self::ROLE_ACTION_DEASSIGN);
140 $deassigned_global = 0;
141 foreach ($roles as $role_data) {
142 if ($role_data[
'type'] ==
'Global' and
143 $role_data[
'action'] == self::ROLE_ACTION_DEASSIGN) {
144 $deassigned_global++;
147 if (count($rbacreview->assignedGlobalRoles($a_usr_id)) == $deassigned_global) {
148 $ilLog->info(
': No global role left. Assigning to default role.');
149 $roles[] = self::parseRole(
150 self::getDefaultRole($a_server_id),
151 self::ROLE_ACTION_ASSIGN
155 return $roles ? $roles :
array();
173 $query =
"SELECT rule_id FROM ldap_role_assignments " .
174 'WHERE server_id = ' . $ilDB->quote($a_server_id,
'integer');
180 include_once
'./Services/LDAP/classes/class.ilLDAPRoleAssignmentRule.php';
183 if (
$rule->matches($a_usr_data)) {
186 $roles[] = self::parseRole(
$rule->getRoleId(), self::ROLE_ACTION_ASSIGN);
191 $found_global =
false;
192 foreach ($roles as $role_data) {
193 if ($role_data[
'type'] ==
'Global') {
194 $found_global =
true;
198 if (!$found_global) {
199 $ilLog->info(
': No matching rule found. Assigning to default role.');
200 $roles[] = self::parseRole(
201 self::getDefaultRole($a_server_id),
202 self::ROLE_ACTION_ASSIGN
206 return $roles ? $roles :
array();
216 public static function callPlugin($a_plugin_id, $a_user_data)
218 global $ilPluginAdmin;
220 if (self::$active_plugins == null) {
221 self::$active_plugins = $ilPluginAdmin->getActivePluginsForSlot(
229 foreach (self::$active_plugins as $plugin_name) {
231 $plugin_obj = $ilPluginAdmin->getPluginObject(
239 $ok = $plugin_obj->checkRoleAssignment($a_plugin_id, $a_user_data);
258 global $ilPluginAdmin;
260 if (self::$active_plugins == null) {
261 self::$active_plugins = $ilPluginAdmin->getActivePluginsForSlot(
269 foreach (self::$active_plugins as $plugin_name) {
271 $plugin_obj = $ilPluginAdmin->getPluginObject(
292 protected static function parseRole($a_role_id, $a_action)
298 'type' => $rbacreview->isGlobalRole($a_role_id) ?
'Global' :
'Local',
299 'action' => $a_action
static getAdditionalPluginAttributes($a_server_id)
Fetch additional attributes from plugin.
Interface for ldap role assignment plugins.
static getAssignmentsForCreation($a_server_id, $a_usr_name, $a_usr_data)
static _lookupGlobalRole($a_server_id)
Lookup global role assignment.
static _lookupTitle($a_id)
lookup object title
const ROLE_ACTION_DEASSIGN
static getAssignmentsForUpdate($a_server_id, $a_usr_id, $a_usr_name, $a_usr_data)
type $ilDB type $rbacadmin type $rbacreview type $ilSetting type $ilLog
static getDefaultRole($a_server_id)
Get default global role.
static getAttributeNames($a_server_id)
get all possible attribute names
static parseRole($a_role_id, $a_action)
Parse role.
static callPlugin($a_plugin_id, $a_user_data)
Call plugin check if the condition matches.
foreach($_POST as $key=> $value) $res
static _getInstanceByRuleId($a_rule_id)
get instance by rule id
Create styles array
The data for the language used.
static getAllPossibleRoles($a_server_id)
Get all assignable roles (used for import parser)