Ejemplo n.º 1
0
 public function getAccessListItems($accessType = PermissionKey::ACCESS_TYPE_INCLUDE, $filterEntities = array())
 {
     $db = Loader::db();
     $list = parent::getAccessListItems($accessType, $filterEntities);
     foreach ($list as $l) {
         $pe = $l->getAccessEntityObject();
         if ($this->permissionObjectToCheck instanceof Page && $l->getAccessType() == PermissionKey::ACCESS_TYPE_INCLUDE) {
             $permission = 'A';
         } else {
             $permission = $db->GetOne('select permission from UserPermissionViewAttributeAccessList where paID = ? and peID = ?', array($l->getPermissionAccessID(), $pe->getAccessEntityID()));
             if ($permission != 'N' && $permission != 'C') {
                 $permission = 'A';
             }
         }
         $l->setAttributesAllowedPermission($permission);
         if ($permission == 'C') {
             $akIDs = $db->GetCol('select akID from UserPermissionViewAttributeAccessListCustom where paID = ? and peID = ?', array($l->getPermissionAccessID(), $pe->getAccessEntityID()));
             $l->setAttributesAllowedArray($akIDs);
         }
     }
     return $list;
 }
Ejemplo n.º 2
0
 public function getAccessListItems($accessType = UserPermissionKey::ACCESS_TYPE_INCLUDE, $filterEntities = array())
 {
     $db = Loader::db();
     $list = parent::getAccessListItems($accessType, $filterEntities);
     $list = PermissionDuration::filterByActive($list);
     foreach ($list as $l) {
         $pe = $l->getAccessEntityObject();
         $prow = $db->GetRow('select attributePermission, uName, uPassword, uEmail, uAvatar, uTimezone, uDefaultLanguage from UserPermissionEditPropertyAccessList where peID = ? and paID = ?', array($pe->getAccessEntityID(), $this->getPermissionAccessID()));
         if (is_array($prow) && $prow['attributePermission']) {
             $l->setAttributesAllowedPermission($prow['attributePermission']);
             $l->setAllowEditUserName($prow['uName']);
             $l->setAllowEditEmail($prow['uEmail']);
             $l->setAllowEditPassword($prow['uPassword']);
             $l->setAllowEditAvatar($prow['uAvatar']);
             $l->setAllowEditTimezone($prow['uTimezone']);
             $l->setAllowEditDefaultLanguage($prow['uDefaultLanguage']);
             $attributePermission = $prow['attributePermission'];
         } else {
             if ($l->getAccessType() == UserPermissionKey::ACCESS_TYPE_INCLUDE) {
                 $l->setAttributesAllowedPermission('A');
                 $l->setAllowEditUserName(1);
                 $l->setAllowEditEmail(1);
                 $l->setAllowEditPassword(1);
                 $l->setAllowEditAvatar(1);
                 $l->setAllowEditTimezone(1);
                 $l->setAllowEditDefaultLanguage(1);
             } else {
                 $l->setAttributesAllowedPermission('N');
                 $l->setAllowEditUserName(0);
                 $l->setAllowEditEmail(0);
                 $l->setAllowEditPassword(0);
                 $l->setAllowEditAvatar(0);
                 $l->setAllowEditTimezone(0);
                 $l->setAllowEditDefaultLanguage(0);
             }
         }
         if ($attributePermission == 'C') {
             $akIDs = $db->GetCol('select akID from UserPermissionEditPropertyAttributeAccessListCustom where peID = ? and paID = ?', array($pe->getAccessEntityID(), $this->getPermissionAccessID()));
             $l->setAttributesAllowedArray($akIDs);
         }
     }
     return $list;
 }
Ejemplo n.º 3
0
    }
    if ($_REQUEST['task'] == 'save_permission' && Loader::helper("validation/token")->validate('save_permission')) {
        $pk = UserPermissionKey::getByID($_REQUEST['pkID']);
        $pa = PermissionAccess::getByID($_REQUEST['paID'], $pk);
        $pa->save($_POST);
        $pa->clearWorkflows();
        if (is_array($_POST['wfID'])) {
            foreach ($_POST['wfID'] as $wfID) {
                $wf = Workflow::getByID($wfID);
                if (is_object($wf)) {
                    $pa->attachWorkflow($wf);
                }
            }
        }
    }
    if ($_REQUEST['task'] == 'display_access_cell' && Loader::helper("validation/token")->validate('display_access_cell')) {
        $pk = UserPermissionKey::getByID($_REQUEST['pkID']);
        $pa = UserPermissionAccess::getByID($_REQUEST['paID'], $pk);
        Loader::element('permission/labels', array('pk' => $pk, 'pa' => $pa));
    }
    if ($_REQUEST['task'] == 'save_workflows' && Loader::helper("validation/token")->validate('save_workflows')) {
        $pk = UserPermissionKey::getByID($_REQUEST['pkID']);
        $pk->clearWorkflows();
        foreach ($_POST['wfID'] as $wfID) {
            $wf = Workflow::getByID($wfID);
            if (is_object($wf)) {
                $pk->attachWorkflow($wf);
            }
        }
    }
}