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) ' .
127 $ilDB->quote($this->
getActionId(),
'integer') .
', ' .
132 $ilDB->manipulate(
$query);
137 $pattern->setParentType(self::PATTERN_PARENT_TYPE);
147 public function delete()
153 $query =
'DELETE FROM didactic_tpl_alp ' .
154 'WHERE action_id = ' . $ilDB->quote($this->
getActionId(),
'integer');
155 $ilDB->manipulate(
$query);
171 $rbacreview =
$GLOBALS[
'DIC']->rbac()->review();
179 foreach ($roles as $role_id => $role) {
180 $this->
getLogger()->debug(
'Apply to role: ' . $role[
'title']);
184 $rbacreview->isProtected($role[
'parent'], $role_id) &&
185 $role[
'parent'] !=
$source->getRefId()
187 $this->
getLogger()->debug(
'Ignoring protected role.');
202 global $rbacadmin,$tree;
203 $rbacreview =
$GLOBALS[
'DIC']->rbac()->review();
209 foreach ($roles as $role_id => $role) {
211 if (!$rbacreview->isGlobalRole($role[
'obj_id']) and
212 $rbacreview->isAssignable($role[
'obj_id'],
$source->getRefId()) and
213 $rbacreview->isSystemGeneratedRole($role[
'obj_id'])) {
214 $this->
getLogger()->debug(
'Reverting local policy of auto generated role: ' . $role[
'title']);
217 $this->
getLogger()->debug(
'Reverting local policy and deleting local role: ' . $role[
'title']);
220 $rbacadmin->deleteLocalRole($role_id,
$source->getRefId());
222 include_once
'./Services/AccessControl/classes/class.ilObjRole.php';
225 $protected = $rbacreview->isProtected($role[
'parent'], $role[
'rol_id']);
227 $role_obj->changeExistingObjects(
245 return self::TYPE_LOCAL_POLICY;
258 case self::FILTER_SOURCE_TITLE:
262 case self::FILTER_SOURCE_OBJ_ID:
269 $pattern->toXml($writer);
276 case self::TPL_ACTION_OVERWRITE:
278 'localPolicyTemplate',
280 'type' =>
'overwrite',
286 case self::TPL_ACTION_INTERSECT:
288 'localPolicyTemplate',
290 'type' =>
'intersect',
296 case self::TPL_ACTION_UNION:
298 'localPolicyTemplate',
307 include_once
'./Services/AccessControl/classes/class.ilRoleXmlExport.php';
312 $writer->
appendXML($exp->xmlDumpMem(
false));
313 $writer->
xmlEndTag(
'localPolicyTemplate');
337 if (!parent::read()) {
341 $query =
'SELECT * FROM didactic_tpl_alp ' .
342 'WHERE action_id = ' . $ilDB->quote($this->
getActionId());
351 include_once
'./Services/DidacticTemplate/classes/class.ilDidacticTemplateFilterPatternFactory.php';
366 global $rbacreview, $rbacadmin;
369 $role_data =
array();
370 foreach ($rbacreview->getParentRoleIds($source->
getRefId()) as $role_id => $tmp_role) {
371 if ($role_id == $role[
'obj_id']) {
372 $role_data = $tmp_role;
377 if (!$rbacreview->isRoleAssignedToObject($role[
'obj_id'], $source->
getRefId())) {
378 $GLOBALS[
'DIC']->rbac()->admin()->assignRoleToFolder(
387 $GLOBALS[
'DIC']->rbac()->review()->isProtected($source->
getRefId(), $role[
'obj_id'])
389 $GLOBALS[
'DIC']->logger()->otpl()->info(
'Ignoring protected role: ' . $role[
'title']);
394 case self::TPL_ACTION_UNION:
397 $rbacadmin->copyRolePermissionUnion(
398 $role_data[
'obj_id'],
399 $role_data[
'parent'],
402 $role_data[
'obj_id'],
407 case self::TPL_ACTION_OVERWRITE:
410 $rbacadmin->copyRoleTemplatePermissions(
414 $role_data[
'obj_id'],
419 case self::TPL_ACTION_INTERSECT:
422 $rbacadmin->copyRolePermissionIntersection(
423 $role_data[
'obj_id'],
424 $role_data[
'parent'],
435 include_once
'./Services/AccessControl/classes/class.ilObjRole.php';
436 $role_obj =
new ilObjRole($role_data[
'obj_id']);
437 $role_obj->changeExistingObjects(
448 global $rbacadmin, $rbacreview,
$ilDB;
453 if (substr($role[
'title'], 0, 3) !=
'il_') {
460 if (!$rbacreview->getLocalPolicies($source->
getRefId())) {
464 $exploded_title = explode(
'_', $role[
'title']);
465 $rolt_title = $exploded_title[0] .
'_' . $exploded_title[1] .
'_' . $exploded_title[2];
468 $query =
'SELECT obj_id FROM object_data ' .
469 'WHERE title = ' . $ilDB->quote($rolt_title,
'text') .
' ' .
470 'AND type = ' . $ilDB->quote(
'rolt',
'text');
473 $rolt_id =
$row->obj_id;
481 $rbacadmin->copyRoleTemplatePermissions(
490 include_once
'./Services/AccessControl/classes/class.ilObjRole.php';
491 $role_obj =
new ilObjRole($role[
'obj_id']);
492 $role_obj->changeExistingObjects(
setRoleTemplateType($a_tpl_type)
Set Role template type.
getRoleTemplateType()
Get role template type.
xmlStartTag($tag, $attrs=null, $empty=false, $encode=true, $escape=true)
Writes a starttag.
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
$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.
foreach($_POST as $key=> $value) $res
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.
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.
setFilterPatterns(array $patterns)
Set filter patterns.
Represents a filter pattern for didactic template actions.
getActionId()
Get action id.