4include_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;
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()
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'];
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(
268 $writer->
xmlStartTag(
'roleFilter', [
'source' =>
'title']);
272 $writer->
xmlStartTag(
'roleFilter', [
'source' =>
'objId']);
276 $writer->
xmlStartTag(
'roleFilter', [
'source' =>
'parentRoles']);
280 $writer->
xmlStartTag(
'roleFilter', [
'source' =>
'localRoles']);
284 $writer->
xmlStartTag(
'roleFilter', [
'source' =>
'title']);
298 'localPolicyTemplate',
300 'type' =>
'overwrite',
308 'localPolicyTemplate',
310 'type' =>
'intersect',
318 'localPolicyTemplate',
327 include_once
'./Services/AccessControl/classes/class.ilRoleXmlExport.php';
332 $writer->
appendXML($exp->xmlDumpMem(
false));
333 $writer->
xmlEndTag(
'localPolicyTemplate');
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']);
424 $rbacadmin->copyRolePermissionUnion(
425 $role_data[
'obj_id'],
426 $role_data[
'parent'],
429 $role_data[
'obj_id'],
437 $rbacadmin->copyRoleTemplatePermissions(
441 $role_data[
'obj_id'],
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'];
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(
An exception for terminatinating execution or to throw for unit testing.
Abstract class for template actions.
getActionId()
Get action id.
const FILTER_SOURCE_TITLE
const FILTER_PARENT_ROLES
const FILTER_SOURCE_OBJ_ID
initSourceObject()
Init the source object.
filterRoles(ilObject $source)
Filter roles.
static lookupPatternsByParentId($a_parent_id, $a_parent_type)
Get patterns by template id.
Represents a filter pattern for didactic template actions.
const TPL_ACTION_SUBTRACT
setFilterType($a_type)
Set filter type.
createLocalPolicy(ilObject $source, $role)
Create local policy.
getRoleTemplateId()
Get role template id.
getFilterType()
Get filter type.
toXml(ilXmlWriter $writer)
Export to xml.
const TPL_ACTION_INTERSECT
getType()
Get action type.
getFilterPattern()
Get filter pattern.
setFilterPatterns(array $patterns)
Set filter patterns.
const TPL_ACTION_OVERWRITE
revertLocalPolicy(ilObject $source, $role)
setRoleTemplateId($a_id)
Set role template id.
__construct($action_id=0)
Constructor.
setRoleTemplateType($a_tpl_type)
Set Role template type.
getRoleTemplateType()
Get role template type.
addFilterPattern(ilDidacticTemplateFilterPattern $pattern)
Add filter.
static getLogger($a_component_id)
Get component logger.
const MODE_PROTECTED_DELETE_LOCAL_POLICIES
const MODE_UNPROTECTED_DELETE_LOCAL_POLICIES
Class ilObject Basic functions for all objects.
static _lookupType($a_id, $a_reference=false)
lookup object type
Xml export of roles and role templates.
xmlEndTag($tag)
Writes an endtag.
appendXML($a_str)
append xml string to document
xmlStartTag($tag, $attrs=null, $empty=false, $encode=true, $escape=true)
Writes a starttag.
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.
foreach($_POST as $key=> $value) $res