49 include_once
'./Services/LDAP/classes/class.ilLDAPAttributeMapping.php';
50 include_once
'./Services/LDAP/classes/class.ilLDAPServer.php';
52 return self::$default_role =
65 $query =
"SELECT DISTINCT(role_id) FROM ldap_role_assignments ".
66 'WHERE server_id = '.$ilDB->quote($a_server_id,
'integer');
70 $roles[
$row->role_id] =
$row->role_id;
72 $gr = self::getDefaultRole($a_server_id);
74 return $roles ? $roles :
array();
87 $query =
"SELECT DISTINCT(att_name) ".
88 "FROM ldap_role_assignments ".
89 'WHERE server_id = '.$ilDB->quote($a_server_id,
'integer');
93 $name = strtolower(trim(
$row->att_name));
100 $names = array_merge((
array)
$names, self::getAdditionalPluginAttributes($a_server_id));
122 $query =
"SELECT rule_id,add_on_update,remove_on_update FROM ldap_role_assignments ".
123 "WHERE (add_on_update = 1 OR remove_on_update = 1) ".
124 'AND server_id = '.$ilDB->quote($a_server_id,
'integer');
130 include_once
'./Services/LDAP/classes/class.ilLDAPRoleAssignmentRule.php';
133 $matches = $rule->matches($a_usr_data);
134 if($matches
and $row->add_on_update)
137 $roles[] = self::parseRole($rule->getRoleId(), self::ROLE_ACTION_ASSIGN);
140 if(!$matches and
$row->remove_on_update)
143 $roles[] = self::parseRole($rule->getRoleId(), self::ROLE_ACTION_DEASSIGN);
148 $deassigned_global = 0;
149 foreach($roles as $role_data)
151 if($role_data[
'type'] ==
'Global' and 152 $role_data[
'action'] == self::ROLE_ACTION_DEASSIGN)
154 $deassigned_global++;
157 if(count($rbacreview->assignedGlobalRoles($a_usr_id)) == $deassigned_global)
159 $ilLog->info(
': No global role left. Assigning to default role.');
160 $roles[] = self::parseRole(
161 self::getDefaultRole($a_server_id),
162 self::ROLE_ACTION_ASSIGN
166 return $roles ? $roles :
array();
185 $query =
"SELECT rule_id FROM ldap_role_assignments ".
186 'WHERE server_id = '.$ilDB->quote($a_server_id,
'integer');
193 include_once
'./Services/LDAP/classes/class.ilLDAPRoleAssignmentRule.php';
196 if($rule->matches($a_usr_data))
200 $roles[] = self::parseRole($rule->getRoleId(),self::ROLE_ACTION_ASSIGN);
205 $found_global =
false;
206 foreach($roles as $role_data)
208 if($role_data[
'type'] ==
'Global')
210 $found_global =
true;
216 $ilLog->info(
': No matching rule found. Assigning to default role.');
217 $roles[] = self::parseRole(
218 self::getDefaultRole($a_server_id),
219 self::ROLE_ACTION_ASSIGN
223 return $roles ? $roles :
array();
235 global $ilPluginAdmin;
237 if(self::$active_plugins == null)
239 self::$active_plugins = $ilPluginAdmin->getActivePluginsForSlot(
IL_COMP_SERVICE,
245 foreach(self::$active_plugins as $plugin_name)
255 $ok = $plugin_obj->checkRoleAssignment($a_plugin_id,$a_user_data);
275 global $ilPluginAdmin;
277 if(self::$active_plugins == null)
279 self::$active_plugins = $ilPluginAdmin->getActivePluginsForSlot(
IL_COMP_SERVICE,
284 $attributes =
array();
285 foreach(self::$active_plugins as $plugin_name)
295 $attributes = array_merge($attributes,$plugin_obj->getAdditionalAttributeNames());
298 return $attributes ? $attributes :
array();
308 protected static function parseRole($a_role_id,$a_action)
314 'type' => $rbacreview->isGlobalRole($a_role_id) ?
'Global' :
'Local',
315 '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.
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)