/** * @param ActionElement $element * @param array $elementInformation * @return bool */ protected function shouldRenderToolBarElement($element, $elementInformation) { assert('$element instanceof ActionElement'); assert('is_array($elementInformation)'); if (!parent::shouldRenderToolBarElement($element, $elementInformation)) { return false; } return ActionSecurityUtil::canCurrentUserPerformAction($element->getActionType(), $this->model); }
/** * Override to check for delete rights * Checks for $elementInformation['resolveToDisplay'] to be present and if it is, * will run the resolveName as a function on the group model. * @param $element * @param $elementInformation * @return bool */ protected function shouldRenderToolBarElement($element, $elementInformation) { assert('$element instanceof ActionElement'); assert('is_array($elementInformation)'); if (!parent::shouldRenderToolBarElement($element, $elementInformation)) { return false; } $actionType = $element->getActionType(); if ($actionType == null || $actionType != 'Delete') { return true; } return RightsUtil::doesUserHaveAllowByRightName('RolesModule', $actionType, Yii::app()->user->userModel); }
/** * Override to check for different scenarios depending on if the group is * special or not. Everyone and SuperAdministrators are special groups * for example. * Checks for $elementInformation['resolveToDisplay'] to be present and if it is, * will run the resolveName as a function on the group model. * @param $element * @param $elementInformation * @return bool */ protected function shouldRenderToolBarElement($element, $elementInformation) { assert('$element instanceof ActionElement'); assert('is_array($elementInformation)'); if (!parent::shouldRenderToolBarElement($element, $elementInformation)) { return false; } if (isset($elementInformation['resolveToDisplay'])) { $resolveMethodName = $elementInformation['resolveToDisplay']; if (!$this->model->{$resolveMethodName}()) { return false; } } $actionType = $element->getActionType(); if ($actionType == null || $actionType != 'Delete') { return true; } return RightsUtil::doesUserHaveAllowByRightName('GroupsModule', GroupsModule::RIGHT_DELETE_GROUPS, Yii::app()->user->userModel); }