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) { return true; } $actionSecurity = ActionSecurityFactory::createActionSecurityFromActionType($actionType, $this->makeModel(), Yii::app()->user->userModel); return $actionSecurity->canUserPerformAction(); }
/** * @param $element * @param $elementInformation * @return bool */ protected function shouldRenderToolBarElement($element, $elementInformation) { assert('$element instanceof ActionElement'); assert('is_array($elementInformation)'); $moduleMenuItems = $this->module->getDesignerMenuItems(); if (!parent::shouldRenderToolBarElement($element, $elementInformation)) { return false; } if ($elementInformation['type'] == 'DesignerGeneralMenu' && !ArrayUtil::getArrayValue($moduleMenuItems, 'showGeneralLink')) { return false; } if ($elementInformation['type'] == 'DesignerFieldsMenu' && !ArrayUtil::getArrayValue($moduleMenuItems, 'showFieldsLink')) { return false; } if ($elementInformation['type'] == 'DesignerLayoutsMenu' && !ArrayUtil::getArrayValue($moduleMenuItems, 'showLayoutsLink')) { return false; } return true; }
protected function shouldRenderToolBarElement($element, $elementInformation) { if (!parent::shouldRenderToolBarElement($element, $elementInformation)) { return false; } if (in_array($elementInformation['type'], array('UserEditLink', 'AuditEventsModalListLink', 'ChangePasswordLink', 'UserConfigurationLink')) && !UserAccessUtil::canCurrentUserViewALinkRequiringElevatedAccess($this->model)) { return false; } return true; }
/** * 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. * @return boolean */ 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; } } return true; }
/** * Override to check for for MassEdit link. This link should only be rendered if there are selectable rows. * @return boolean */ protected function shouldRenderToolBarElement($element, $elementInformation) { assert('$element instanceof ActionElement'); assert('is_array($elementInformation)'); if (!parent::shouldRenderToolBarElement($element, $elementInformation)) { return false; } if ($elementInformation['type'] == 'MassEditLink' && !$this->listViewRowsAreSelectable) { return false; } return true; }
/** * Expects there to be a modelClassName parameter passed through the elementInformation that can be used * to compare the Rights security on based on the actionType of the element. * (non-PHPdoc) * @see MetadataView::shouldRenderToolBarElement() */ protected function shouldRenderToolBarElement($element, $elementInformation) { assert('$element instanceof ActionElement'); assert('is_array($elementInformation)'); if (!parent::shouldRenderToolBarElement($element, $elementInformation)) { return false; } if (isset($elementInformation['modelClassName'])) { $modelClassName = $elementInformation['modelClassName']; //Todo: figure out how to not need to new up a new model. return ActionSecurityUtil::canCurrentUserPerformAction($element->getActionType(), new $modelClassName(false)); } return true; }
/** * Override to check for for MassEdit link. This link should only be rendered if there are selectable rows. * @return boolean */ protected function shouldRenderToolBarElement($element, $elementInformation) { assert('$element instanceof ActionElement'); assert('is_array($elementInformation)'); if (!parent::shouldRenderToolBarElement($element, $elementInformation)) { return false; } if ($this->activeActionElementType == ListViewTypesToggleLinkActionElement::TYPE_KANBAN_BOARD && ($elementInformation['type'] == 'MassEditLink' || $elementInformation['type'] == 'MassDeleteLink' || $elementInformation['type'] == 'ExportLink')) { return false; } if ($elementInformation['type'] == 'MassEditLink' && !$this->listViewRowsAreSelectable) { return false; } return true; }