예제 #1
0
 /**
  * Function to check whether the user has access to the specified action/operation on a given module by tabid
  * @param <Number> $tabId
  * @param <String/Number> $action
  * @return <Boolean> true/false
  */
 public function hasModuleActionPermission($tabId, $action)
 {
     if (!is_a($action, 'Vtiger_Action_Model')) {
         $action = Vtiger_Action_Model::getInstance($action);
     }
     $actionId = $action->getId();
     $profileTabsPermissions = $this->get('profile_action_permission');
     $moduleModel = Vtiger_Module_Model::getInstance($tabId);
     return ($this->isAdminUser() || $profileTabsPermissions[$tabId][$actionId] === Settings_Profiles_Module_Model::IS_PERMITTED_VALUE) && $moduleModel->isActive();
 }
예제 #2
0
 public function hasModuleActionPermission($module, $action)
 {
     $actionId = false;
     if (is_object($action) && is_a($action, 'Vtiger_Action_Model')) {
         $actionId = $action->getId();
     } else {
         $action = Vtiger_Action_Model::getInstance($action);
         $actionId = $action->getId();
     }
     if (!$actionId) {
         return false;
     }
     $moduleModel = $this->getProfileTabModel($module);
     $modulePermissions = $moduleModel->get('permissions');
     $moduleAccessPermission = $modulePermissions['is_permitted'];
     if ($moduleAccessPermission != Settings_Profiles_Module_Model::IS_PERMITTED_VALUE) {
         return false;
     }
     $moduleActionPermissions = $modulePermissions['actions'];
     $moduleActionPermission = $moduleActionPermissions[$actionId];
     if (isset($moduleActionPermissions[$actionId]) && $moduleActionPermission == Settings_Profiles_Module_Model::IS_PERMITTED_VALUE) {
         return true;
     }
     return false;
 }