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;
123 $ilDB = $DIC[
'ilDB'];
127 $query =
'INSERT INTO didactic_tpl_alp (action_id,filter_type,template_type,template_id) ' .
139 $pattern->setParentType(self::PATTERN_PARENT_TYPE);
149 public function delete()
153 $ilDB = $DIC[
'ilDB'];
157 $query =
'DELETE FROM didactic_tpl_alp ' .
175 $rbacreview =
$GLOBALS[
'DIC']->rbac()->review();
183 foreach ($roles as $role_id => $role) {
184 $this->
getLogger()->debug(
'Apply to role: ' . $role[
'title']);
185 $this->
getLogger()->debug(
'Role parent: ' . $role[
'parent']);
190 $rbacreview->isProtected($role[
'parent'], $role_id) &&
191 $role[
'parent'] !=
$source->getRefId()
193 $this->
getLogger()->debug(
'Ignoring protected role.');
210 $rbacadmin = $DIC[
'rbacadmin'];
211 $tree = $DIC[
'tree'];
212 $rbacreview =
$GLOBALS[
'DIC']->rbac()->review();
218 foreach ($roles as $role_id => $role) {
220 if (!$rbacreview->isGlobalRole($role[
'obj_id'])
and 221 $rbacreview->isAssignable($role[
'obj_id'],
$source->getRefId())
and 222 $rbacreview->isSystemGeneratedRole($role[
'obj_id'])) {
223 $this->
getLogger()->debug(
'Reverting local policy of auto generated role: ' . $role[
'title']);
226 $this->
getLogger()->debug(
'Reverting local policy and deleting local role: ' . $role[
'title']);
229 $rbacadmin->deleteLocalRole($role_id,
$source->getRefId());
231 include_once
'./Services/AccessControl/classes/class.ilObjRole.php';
234 $protected = $rbacreview->isProtected($role[
'parent'], $role[
'rol_id']);
236 $role_obj->changeExistingObjects(
254 return self::TYPE_LOCAL_POLICY;
267 case self::FILTER_SOURCE_TITLE:
268 $writer->
xmlStartTag(
'roleFilter', [
'source' =>
'title']);
271 case self::FILTER_SOURCE_OBJ_ID:
272 $writer->
xmlStartTag(
'roleFilter', [
'source' =>
'objId']);
275 case self::FILTER_PARENT_ROLES:
276 $writer->
xmlStartTag(
'roleFilter', [
'source' =>
'parentRoles']);
279 case self::FILTER_LOCAL_ROLES:
280 $writer->
xmlStartTag(
'roleFilter', [
'source' =>
'localRoles']);
284 $writer->
xmlStartTag(
'roleFilter', [
'source' =>
'title']);
289 $pattern->toXml($writer);
296 case self::TPL_ACTION_OVERWRITE:
298 'localPolicyTemplate',
300 'type' =>
'overwrite',
306 case self::TPL_ACTION_INTERSECT:
308 'localPolicyTemplate',
310 'type' =>
'intersect',
316 case self::TPL_ACTION_UNION:
318 'localPolicyTemplate',
327 include_once
'./Services/AccessControl/classes/class.ilRoleXmlExport.php';
332 $writer->
appendXML($exp->xmlDumpMem(
false));
333 $writer->
xmlEndTag(
'localPolicyTemplate');
357 $ilDB = $DIC[
'ilDB'];
359 if (!parent::read()) {
363 $query =
'SELECT * FROM didactic_tpl_alp ' .
373 include_once
'./Services/DidacticTemplate/classes/class.ilDidacticTemplateFilterPatternFactory.php';
390 $rbacreview = $DIC->rbac()->review();
391 $rbacadmin = $DIC->rbac()->admin();
394 $role_data = array();
395 foreach ($rbacreview->getParentRoleIds($source->
getRefId()) as $role_id => $tmp_role) {
396 if ($role_id == $role[
'obj_id']) {
397 $role_data = $tmp_role;
402 if (!$rbacreview->isRoleAssignedToObject($role[
'obj_id'], $source->
getRefId())) {
403 $GLOBALS[
'DIC']->rbac()->admin()->assignRoleToFolder(
413 $rbacreview->isProtected($source->
getRefId(),$role[
'obj_id']) &&
414 $role[
'parent'] != $source->
getRefId()
416 $this->
getLogger()->info(
'Ignoring protected role: ' . $role[
'title']);
421 case self::TPL_ACTION_UNION:
424 $rbacadmin->copyRolePermissionUnion(
425 $role_data[
'obj_id'],
426 $role_data[
'parent'],
429 $role_data[
'obj_id'],
434 case self::TPL_ACTION_OVERWRITE:
437 $rbacadmin->copyRoleTemplatePermissions(
441 $role_data[
'obj_id'],
446 case self::TPL_ACTION_INTERSECT:
449 $rbacadmin->copyRolePermissionIntersection(
450 $role_data[
'obj_id'],
451 $role_data[
'parent'],
462 include_once
'./Services/AccessControl/classes/class.ilObjRole.php';
463 $role_obj =
new ilObjRole($role_data[
'obj_id']);
464 $role_obj->changeExistingObjects(
477 $rbacadmin = $DIC[
'rbacadmin'];
478 $rbacreview = $DIC[
'rbacreview'];
479 $ilDB = $DIC[
'ilDB'];
484 if (substr($role[
'title'], 0, 3) !=
'il_') {
491 if (!$rbacreview->getLocalPolicies($source->
getRefId())) {
495 $exploded_title = explode(
'_', $role[
'title']);
496 $rolt_title = $exploded_title[0] .
'_' . $exploded_title[1] .
'_' . $exploded_title[2];
499 $query =
'SELECT obj_id FROM object_data ' .
500 'WHERE title = ' .
$ilDB->quote($rolt_title,
'text') .
' ' .
501 'AND type = ' .
$ilDB->quote(
'rolt',
'text');
504 $rolt_id =
$row->obj_id;
512 $rbacadmin->copyRoleTemplatePermissions(
521 include_once
'./Services/AccessControl/classes/class.ilObjRole.php';
522 $role_obj =
new ilObjRole($role[
'obj_id']);
523 $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
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.
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.
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.