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;
 
  125        $query = 
'INSERT INTO didactic_tpl_alp (action_id,filter_type,template_type,template_id) ' .
 
  132        $ilDB->manipulate(
$query);
 
  137            $pattern->setParentType(self::PATTERN_PARENT_TYPE);
 
  147    public function delete()
 
  153        $query = 
'DELETE FROM didactic_tpl_alp ' .
 
  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(
 
  259                $writer->
xmlStartTag(
'roleFilter', array(
'source' => 
'title'));
 
  263                $writer->
xmlStartTag(
'roleFilter', array(
'source' => 
'objId'));
 
  278                    'localPolicyTemplate',
 
  280                        'type'  => 
'overwrite',
 
  288                    'localPolicyTemplate',
 
  290                        'type'  => 
'intersect',
 
  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 ' .
 
  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']);
 
  397                $rbacadmin->copyRolePermissionUnion(
 
  398                    $role_data[
'obj_id'],
 
  399                    $role_data[
'parent'],
 
  402                    $role_data[
'obj_id'],
 
  410                $rbacadmin->copyRoleTemplatePermissions(
 
  414                    $role_data[
'obj_id'],
 
  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(
 
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_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['loaded']
Global hash that tracks already loaded includes.
foreach($_POST as $key=> $value) $res