/** * Add the page title and toolbar. * * @since 1.6 */ protected function addToolbar() { $canDo = Hs_usersHelper::getActions(); JToolbarHelper::title(JText::_('COM_USERS_VIEW_HS_USERS_TITLE'), 'user'); if ($canDo->get('core.admin')) { JToolbarHelper::preferences('com_hs_users'); JToolbarHelper::divider(); } }
/** * Gets a list of the actions that can be performed. * * @return JObject * * @since 1.6 * @todo Refactor to work with notes */ public static function getActions() { if (empty(self::$actions)) { $user = JFactory::getUser(); self::$actions = new JObject(); $actions = JAccess::getActions('com_hs_users'); foreach ($actions as $action) { self::$actions->set($action->name, $user->authorise($action->name, 'com_hs_users')); } } return self::$actions; }
/** * Checks whether a user can see this view. * * @param string $view The view name. * * @return boolean * @since 1.6 */ protected function canView($view) { $canDo = Hs_usersHelper::getActions(); switch ($view) { // Special permissions. case 'top': return $canDo->get('core.admin'); break; // Default permissions. // Default permissions. default: return true; } }