Spamworldpro Mini Shell
Spamworldpro


Server : Apache
System : Linux indy02.toastserver.com 3.10.0-962.3.2.lve1.5.85.el7.x86_64 #1 SMP Thu Apr 18 15:18:36 UTC 2024 x86_64
User : palandch ( 1163)
PHP Version : 7.1.33
Disable Function : NONE
Directory :  /home/palandch/www/core/model/modx/processors/security/access/policy/template/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/palandch/www/core/model/modx/processors/security/access/policy/template/duplicate.class.php
<?php
/**
 * Duplicates a policy template
 *
 * @param integer $id The ID of the policy template
 *
 * @package modx
 * @subpackage processors.security.access.policy.template
 */
class modAccessPolicyTemplateDuplicateProcessor extends modObjectDuplicateProcessor {
    public $classKey = 'modAccessPolicyTemplate';
    public $languageTopics = array('policy');
    public $permission = 'policy_template_new';
    public $objectType = 'policy_template';

    public function afterSave() {
        $permissions = $this->object->getMany('Permissions');

        /* save new permissions for template */
        if (!empty($permissions)) {
            /** @var modAccessPermission $permission */
            foreach ($permissions as $permission) {
                /** @var modAccessPermission $newPermission */
                $newPermission = $this->modx->newObject('modAccessPermission');
                $newPermission->set('name',$permission->get('name'));
                $newPermission->set('description',$permission->get('description'));
                $newPermission->set('value',$permission->get('value'));
                $newPermission->set('template',$this->newObject->get('id'));
                $newPermission->save();
            }
        }
        return parent::afterSave();
    }
}
return 'modAccessPolicyTemplateDuplicateProcessor';

Spamworldpro Mini