4 include_once
'./Services/DidacticTemplate/classes/class.ilDidacticTemplateAction.php';
51 $this->pattern = $patterns;
69 $this->filter_type = $a_type;
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);
181 foreach($roles as $role_id => $role)
184 if($role[
'protected'] and $role[
'parent'] != $source->getRefId())
200 global $rbacreview,$rbacadmin,$tree;
206 foreach($roles as $role_id => $role)
209 if(!$rbacreview->isGlobalRole($role[
'obj_id']) and
210 $rbacreview->isAssignable($role[
'obj_id'],$source->getRefId()) and
211 $rbacreview->isSystemGeneratedRole($role[
'obj_id']))
218 $rbacadmin->deleteLocalRole($role_id,$source->getRefId());
220 include_once
'./Services/AccessControl/classes/class.ilObjRole.php';
222 $role_obj->changeExistingObjects(
241 return self::TYPE_LOCAL_POLICY;
255 case self::FILTER_SOURCE_TITLE:
256 $writer->
xmlStartTag(
'roleFilter',array(
'source' =>
'title'));
259 case self::FILTER_SOURCE_OBJ_ID:
260 $writer->
xmlStartTag(
'roleFilter',array(
'source' =>
'objId'));
267 $pattern->toXml($writer);
275 case self::TPL_ACTION_OVERWRITE:
277 'localPolicyTemplate',
279 'type' =>
'overwrite',
285 case self::TPL_ACTION_INTERSECT:
287 'localPolicyTemplate',
289 'type' =>
'intersect',
295 case self::TPL_ACTION_UNION:
297 'localPolicyTemplate',
306 include_once
'./Services/AccessControl/classes/class.ilRoleXmlExport.php';
311 $writer->
appendXML($exp->xmlDumpMem(FALSE));
312 $writer->
xmlEndTag(
'localPolicyTemplate');
342 $query =
'SELECT * FROM didactic_tpl_alp '.
343 'WHERE action_id = '.$ilDB->quote($this->
getActionId());
353 include_once
'./Services/DidacticTemplate/classes/class.ilDidacticTemplateFilterPatternFactory.php';
369 global $rbacreview, $rbacadmin;
371 $GLOBALS[
'ilLog']->write(__METHOD__.
': Using role: '.print_r($role,
true));
376 if(!$rbacreview->isRoleAssignedToObject($role[
'obj_id'],$source->
getRefId()))
378 $rbacadmin->assignRoleToFolder($role[
'obj_id'],$source->
getRefId(),
'n');
383 case self::TPL_ACTION_UNION:
385 $GLOBALS[
'ilLog']->write(__METHOD__.
': Using ilRbacAdmin::copyRolePermissionUnion()');
386 $rbacadmin->copyRolePermissionUnion(
396 case self::TPL_ACTION_OVERWRITE:
398 $GLOBALS[
'ilLog']->write(__METHOD__.
': Using ilRbacAdmin::copyRoleTemplatePermissions()');
399 $rbacadmin->copyRoleTemplatePermissions(
408 case self::TPL_ACTION_INTERSECT:
410 $GLOBALS[
'ilLog']->write(__METHOD__.
': Using ilRbacAdmin::copyRolePermissionIntersection()');
411 $rbacadmin->copyRolePermissionIntersection(
424 include_once
'./Services/AccessControl/classes/class.ilObjRole.php';
425 $role_obj =
new ilObjRole($role[
'obj_id']);
426 $role_obj->changeExistingObjects(
437 global $rbacadmin, $rbacreview,
$ilDB;
439 $GLOBALS[
'ilLog']->write(__METHOD__.
': Reverting policy for role: '.print_r($role,
true));
443 if(substr($role[
'title'],0,3) !=
'il_')
445 $GLOBALS[
'ilLog']->write(__METHOD__.
': Cannot revert local policy for role '. $role[
'title']);
451 if(!$rbacreview->getLocalPolicies($source->
getRefId()))
456 $exploded_title = explode(
'_',$role[
'title']);
457 $rolt_title = $exploded_title[0].
'_'.$exploded_title[1].
'_'.$exploded_title[2];
460 $query =
'SELECT obj_id FROM object_data '.
461 'WHERE title = '.$ilDB->quote($rolt_title,
'text').
' '.
462 'AND type = '.$ilDB->quote(
'rolt',
'text');
466 $rolt_id =
$row->obj_id;
475 $rbacadmin->copyRoleTemplatePermissions(
484 include_once
'./Services/AccessControl/classes/class.ilObjRole.php';
485 $role_obj =
new ilObjRole($role[
'obj_id']);
486 $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.
const TPL_ACTION_SUBTRACT
toXml(ilXmlWriter $writer)
Export to xml.
const TPL_ACTION_OVERWRITE
getFilterPattern()
Get filter pattern.
xmlEndTag($tag)
Writes an endtag.
const DB_FETCHMODE_OBJECT
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.
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
getRoleTemplateId()
Get role template id.
Represents a filter pattern for didactic template actions.
getActionId()
Get action id.