4 include_once
'./Services/DidacticTemplate/classes/class.ilDidacticTemplateAction.php';
51 $this->pattern = $patterns;
87 $this->role_template_type = $a_tpl_type;
104 $this->role_template_id = $a_id;
125 $query =
'INSERT INTO didactic_tpl_alp (action_id,filter_type,template_type,template_id) '.
132 $ilDB->manipulate(
$query);
138 $pattern->setParentType(self::PATTERN_PARENT_TYPE);
148 public function delete()
154 $query =
'DELETE FROM didactic_tpl_alp '.
155 'WHERE action_id = '.$ilDB->quote($this->
getActionId(),
'integer');
156 $ilDB->manipulate(
$query);
173 $rbacreview =
$GLOBALS[
'DIC']->rbac()->review();
181 foreach($roles as $role_id => $role)
183 $this->
getLogger()->debug(
'Apply to role: ' . $role[
'title']);
187 $rbacreview->isProtected($role[
'parent'], $role_id) &&
188 $role[
'parent'] != $source->getRefId()
191 $this->
getLogger()->debug(
'Ignoring protected role.');
206 global $rbacadmin,$tree;
207 $rbacreview =
$GLOBALS[
'DIC']->rbac()->review();
213 foreach($roles as $role_id => $role)
216 if(!$rbacreview->isGlobalRole($role[
'obj_id'])
and 217 $rbacreview->isAssignable($role[
'obj_id'],$source->getRefId())
and 218 $rbacreview->isSystemGeneratedRole($role[
'obj_id']))
220 $this->
getLogger()->debug(
'Reverting local policy of auto generated role: ' . $role[
'title']);
225 $this->
getLogger()->debug(
'Reverting local policy and deleting local role: ' . $role[
'title']);
228 $rbacadmin->deleteLocalRole($role_id,$source->getRefId());
230 include_once
'./Services/AccessControl/classes/class.ilObjRole.php';
233 $protected = $rbacreview->isProtected($role[
'parent'], $role[
'rol_id']);
235 $role_obj->changeExistingObjects(
254 return self::TYPE_LOCAL_POLICY;
268 case self::FILTER_SOURCE_TITLE:
272 case self::FILTER_SOURCE_OBJ_ID:
280 $pattern->toXml($writer);
288 case self::TPL_ACTION_OVERWRITE:
290 'localPolicyTemplate',
292 'type' =>
'overwrite',
298 case self::TPL_ACTION_INTERSECT:
300 'localPolicyTemplate',
302 'type' =>
'intersect',
308 case self::TPL_ACTION_UNION:
310 'localPolicyTemplate',
319 include_once
'./Services/AccessControl/classes/class.ilRoleXmlExport.php';
324 $writer->
appendXML($exp->xmlDumpMem(FALSE));
325 $writer->
xmlEndTag(
'localPolicyTemplate');
355 $query =
'SELECT * FROM didactic_tpl_alp '.
356 'WHERE action_id = '.$ilDB->quote($this->
getActionId());
366 include_once
'./Services/DidacticTemplate/classes/class.ilDidacticTemplateFilterPatternFactory.php';
382 global $rbacreview, $rbacadmin;
385 $role_data =
array();
386 foreach($rbacreview->getParentRoleIds($source->
getRefId()) as $role_id => $tmp_role)
388 if($role_id == $role[
'obj_id'])
390 $role_data = $tmp_role;
395 if(!$rbacreview->isRoleAssignedToObject($role[
'obj_id'],$source->
getRefId()))
397 $GLOBALS[
'DIC']->rbac()->admin()->assignRoleToFolder(
406 $GLOBALS[
'DIC']->rbac()->review()->isProtected($source->
getRefId(),$role[
'obj_id'])
409 $GLOBALS[
'DIC']->logger()->otpl()->info(
'Ignoring protected role: ' . $role[
'title']);
415 case self::TPL_ACTION_UNION:
418 $rbacadmin->copyRolePermissionUnion(
419 $role_data[
'obj_id'],
420 $role_data[
'parent'],
423 $role_data[
'obj_id'],
428 case self::TPL_ACTION_OVERWRITE:
431 $rbacadmin->copyRoleTemplatePermissions(
435 $role_data[
'obj_id'],
440 case self::TPL_ACTION_INTERSECT:
443 $rbacadmin->copyRolePermissionIntersection(
444 $role_data[
'obj_id'],
445 $role_data[
'parent'],
456 include_once
'./Services/AccessControl/classes/class.ilObjRole.php';
457 $role_obj =
new ilObjRole($role_data[
'obj_id']);
458 $role_obj->changeExistingObjects(
469 global $rbacadmin, $rbacreview,
$ilDB;
474 if(substr($role[
'title'],0,3) !=
'il_')
482 if(!$rbacreview->getLocalPolicies($source->
getRefId()))
487 $exploded_title = explode(
'_',$role[
'title']);
488 $rolt_title = $exploded_title[0].
'_'.$exploded_title[1].
'_'.$exploded_title[2];
491 $query =
'SELECT obj_id FROM object_data '.
492 'WHERE title = '.$ilDB->quote($rolt_title,
'text').
' '.
493 'AND type = '.$ilDB->quote(
'rolt',
'text');
497 $rolt_id =
$row->obj_id;
506 $rbacadmin->copyRoleTemplatePermissions(
515 include_once
'./Services/AccessControl/classes/class.ilObjRole.php';
516 $role_obj =
new ilObjRole($role[
'obj_id']);
517 $role_obj->changeExistingObjects(
setRoleTemplateType($a_tpl_type)
Set Role template type.
getRoleTemplateType()
Get role template type.
revertLocalPolicy(ilObject $source, $role)
__construct($action_id=0)
Constructor.
static lookupPatternsByParentId($a_parent_id, $a_parent_type)
Get patterns by template id.
const MODE_PROTECTED_DELETE_LOCAL_POLICIES
const TPL_ACTION_INTERSECT
Class ilObject Basic functions for all objects.
xmlStartTag($tag, $attrs=NULL, $empty=FALSE, $encode=TRUE, $escape=TRUE)
Writes a starttag.
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
const TPL_ACTION_SUBTRACT
toXml(ilXmlWriter $writer)
Export to xml.
const TPL_ACTION_OVERWRITE
getFilterPattern()
Get filter pattern.
xmlEndTag($tag)
Writes an endtag.
addFilterPattern(ilDidacticTemplateFilterPattern $pattern)
Add filter.
filterRoles(ilObject $source)
Filter roles.
setFilterType($a_type)
Set filter type.
createLocalPolicy(ilObject $source, $role)
Create local policy.
getType()
Get action type.
Create styles array
The data for the language used.
static _lookupType($a_id, $a_reference=false)
lookup object type
initSourceObject()
Init the source object.
setRoleTemplateId($a_id)
Set role template id.
setFilterPatterns(Array $patterns)
Set filter patterns.
Abstract class for template actions.
getFilterType()
Get filter type.
const MODE_UNPROTECTED_DELETE_LOCAL_POLICIES
Xml export of roles and role templates.
getRefId()
get reference id public
appendXML($a_str)
append xml string to document
static getLogger($a_component_id)
Get component logger.
getRoleTemplateId()
Get role template id.
Represents a filter pattern for didactic template actions.
getActionId()
Get action id.