protected function auth($area) { //echo '<pre>' . print_r(JAccess::getActions('com_chessvn','gamechat'),true).'</pre>';die(); $aclLocal = array(); foreach (JAccess::getActions('com_chessvn', 'gamechat') as $ar) { $aclLocal[] = $ar->name; } if (in_array($area, $aclLocal)) { return $this->user->authorise($area, 'com_chessvn', 'gamechat'); } else { $aclGlobal = array(); foreach (JAccess::getActions('com_chessvn') as $ar) { $aclGlobal[] = $ar->name; } if (in_array($area, $aclGlobal)) { if (!empty($aclLocal)) { JFactory::getApplication()->enqueueMessage('Undefined authorization area: ' . $area . ' -- fall back on component acl', 'Warning'); } return $this->user->authorise($area, 'com_chessvn'); } else { JFactory::getApplication()->enqueueMessage('Undefined authorization area: ' . $area . ' -- NO fall back found', 'Error'); return true; } } }
/** * Gets a list of the actions that can be performed. * * @param integer The category ID. * * @return JObject * @since 1.6 */ public static function getActions($categoryId = 0) { $user = JFactory::getUser(); $result = new JObject; if (empty($categoryId)) { $assetName = 'com_mvceditor'; $level = 'component'; } else { $assetName = 'com_mvceditor.category.'.(int) $categoryId; $level = 'category'; } $actions = JAccess::getActions('com_mvceditor', $level); foreach ($actions as $action) { $result->set($action->name, $user->authorise($action->name, $assetName)); } return $result; }
function edit() { JEVHelper::stylesheet('eventsadmin.css', 'administrator/components/' . JEV_COM_COMPONENT . '/assets/css/'); $document =& JFactory::getDocument(); $document->setTitle(JText::_('COM_JEVENTS_CONFIGURATION')); // Set toolbar items for the page JToolBarHelper::title(JText::_('COM_JEVENTS_CONFIGURATION'), 'jevents'); //APPLY BUTTON BY PRAKASH. JToolBarHelper::apply('params.apply'); //APPLY BUTTON JToolBarHelper::save('params.save'); JToolBarHelper::cancel('cpanel.cpanel'); $model = $this->getModel(); $this->params =& $model->getParams(); $component = JComponentHelper::getComponent(JEV_COM_COMPONENT); JHTML::_('behavior.tooltip'); if (JVersion::isCompatible("1.6.0")) { // Get the actions for the asset. $actions = JAccess::getActions(JEV_COM_COMPONENT, "component"); jimport('joomla.form.form'); // Add the search path for the admin component config.xml file. JForm::addFormPath(JPATH_ADMINISTRATOR . '/components/' . JEV_COM_COMPONENT); // Get the form. $modelForm = $model->getForm(); $this->assignRef("form", $modelForm); } }
/** * Gets a list of the actions that can be performed. * * @return Object */ public static function getActions() { $result = new \Hubzero\Base\Object(); $actions = JAccess::getActions('com_templates'); foreach ($actions as $action) { $result->set($action->name, User::authorise($action->name, 'com_templates')); } return $result; }
/** * Gets a list of the actions that can be performed. * * @return JObject */ public static function getActions() { $user = JFactory::getUser(); $result = new JObject(); $actions = JAccess::getActions('com_messages'); foreach ($actions as $action) { $result->set($action->name, $user->authorise($action->name, 'com_messages')); } return $result; }
/** * Get list of all actions described in access.xml * * @return array of strings */ public static function getActions() { jimport('joomla.access.access'); $result = array(); $actions = JAccess::getActions('com_newsletter', 'component'); foreach ($actions as $action) { $result[] = $action->name; } return $result; }
/** * Gets a list of the actions that can be performed. * * @return Object */ public static function getActions() { $result = new \Hubzero\Base\Object(); $assetName = 'com_languages'; $actions = JAccess::getActions($assetName); foreach ($actions as $action) { $result->set($action->name, User::authorise($action->name, $assetName)); } return $result; }
/** * Gets a list of the actions that can be performed. * * @return object */ public static function getActions() { $result = new Object(); $assetName = self::$extension; $actions = \JAccess::getActions($assetName); foreach ($actions as $action) { $result->set($action->name, User::authorise($action->name, $assetName)); } return $result; }
/** * Gets a list of the actions that can be performed. * * @return JObject */ public static function getActions() { $user = JFactory::getUser(); $result = new JObject(); $assetName = 'com_redirect'; $actions = JAccess::getActions($assetName); foreach ($actions as $action) { $result->set($action->name, $user->authorise($action->name, $assetName)); } return $result; }
/** * Gets a list of the actions that can be performed. * * @return Object * * @since 1.6 * @todo Refactor to work with notes */ public static function getActions() { if (empty(self::$actions)) { self::$actions = new \Hubzero\Base\Object(); $actions = JAccess::getActions('com_users'); foreach ($actions as $action) { self::$actions->set($action->name, User::authorise($action->name, 'com_users')); } } return self::$actions; }
public static function getActions($messageId = 0) { jimport('joomla.access.access'); $user = JFactory::getUser(); $result = new JObject(); $assetName = 'com_fees'; $actions = JAccess::getActions('com_fees', 'component'); foreach ($actions as $action) { $result->set($action->name, $user->authorise($action->name, $assetName)); } return $result; }
/** * @return JObject */ public static function getActions() { $user = JFactory::getUser(); $result = new JObject(); $assetName = 'com_estivole'; $level = 'component'; $actions = JAccess::getActions('com_estivole', $level); foreach ($actions as $action) { $result->set($action->name, $user->authorise($action->name, $assetName)); } return $result; }
/** * 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_users'); foreach ($actions as $action) { self::$actions->set($action->name, $user->authorise($action->name, 'com_users')); } } return self::$actions; }
public static function getActions($messageId = 0) { $result = new JObject(); if (empty($messageId)) { $assetName = 'com_heartcare'; } else { $assetName = 'com_heartcare.message.' . (int) $messageId; } $actions = JAccess::getActions('com_heartcare', 'component'); foreach ($actions as $action) { $result->set($action->name, JFactory::getUser()->authorise($action->name, $assetName)); } return $result; }
/** * Gets a list of the actions that can be performed. * * @param integer The category ID. * @param integer The contact ID. * * @return JObject * @since 1.6 */ public static function getActions($contactId = 0) { $user = JFactory::getUser(); $result = new JObject(); if (empty($contactId)) { $assetName = 'com_b2jcontact'; $level = 'component'; } $actions = JAccess::getActions('com_b2jcontact', $level); foreach ($actions as $action) { $result->set($action->name, $user->authorise($action->name, $assetName)); } return $result; }
/** * Gets a list of the actions that can be performed. * * @param int The menu ID. * * @return Object * @since 1.6 */ public static function getActions($parentId = 0) { $result = new \Hubzero\Base\Object(); if (empty($parentId)) { $assetName = 'com_menus'; } else { $assetName = 'com_menus.item.' . (int) $parentId; } $actions = JAccess::getActions('com_menus'); foreach ($actions as $action) { $result->set($action->name, User::authorise($action->name, $assetName)); } return $result; }
public function testGetActions() { $access = new JAccess(); $array1 = array('name' => "core.admin", 'title' => "JACTION_ADMIN", 'description' => "JACTION_ADMIN_COMPONENT_DESC"); $array2 = array('name' => "core.manage", 'title' => "JACTION_MANAGE", 'description' => "JACTION_MANAGE_COMPONENT_DESC"); $array3 = array('name' => "core.create", 'title' => "JACTION_CREATE", 'description' => "JACTION_CREATE_COMPONENT_DESC"); $array4 = array('name' => "core.delete", 'title' => "JACTION_DELETE", 'description' => "JACTION_DELETE_COMPONENT_DESC"); $array5 = array('name' => "core.edit", 'title' => "JACTION_EDIT", 'description' => "JACTION_EDIT_COMPONENT_DESC"); $array6 = array('name' => "core.edit.state", 'title' => "JACTION_EDITSTATE", 'description' => "JACTION_EDITSTATE_COMPONENT_DESC"); $obj = $access->getActions('com_banners', 'component'); $arraystdClass = (array) $obj[0]; $this->assertThat($array1, $this->equalTo($arraystdClass)); $arraystdClass = (array) $obj[1]; $this->assertThat($array2, $this->equalTo($arraystdClass)); $arraystdClass = (array) $obj[2]; $this->assertThat($array3, $this->equalTo($arraystdClass)); $arraystdClass = (array) $obj[3]; $this->assertThat($array4, $this->equalTo($arraystdClass)); $arraystdClass = (array) $obj[4]; $this->assertThat($array5, $this->equalTo($arraystdClass)); $arraystdClass = (array) $obj[5]; $this->assertThat($array6, $this->equalTo($arraystdClass)); $this->assertThat($array7 = array(), $this->equalTo($access->getActions('com_complusoft', 'component'))); }
/** * Gets a list of the actions that can be performed. * * @param int The menu ID. * * @return JObject * @since 1.6 */ public static function getActions($parentId = 0) { $user = JFactory::getUser(); $result = new JObject(); if (empty($parentId)) { $assetName = 'com_menus'; } else { $assetName = 'com_menus.item.' . (int) $parentId; } $actions = JAccess::getActions('com_menus'); foreach ($actions as $action) { $result->set($action->name, $user->authorise($action->name, $assetName)); } return $result; }
/** * Get a list of the actions for the component or code actions. * * @param string The name of the component. * * @return array * @since 1.6 */ public static function getDebugActions($component = null) { $actions = array(); // Try to get actions for the component if (!empty($component)) { $component_actions = JAccess::getActions($component); if (!empty($component_actions)) { foreach ($component_actions as &$action) { echo $action->name . " -- "; if (JString::substr($action->name, 0, 5) != 'core.') { continue; } $action_title = str_replace('core.', '', $action->name); //$action->title; $actions[$action_title] = array($action->name, $action->description); } unset($action); // unset the variable reference to avoid trouble if variable is reused, thus overwritting last pointed variable } } // Use default actions from configuration if no component selected or component doesn't have actions if (empty($actions)) { $filename = JPATH_ADMINISTRATOR . '/components/com_config/models/forms/application.xml'; if (is_file($filename)) { $xml = simplexml_load_file($filename); foreach ($xml->children()->fieldset as $fieldset) { if ('permissions' == (string) $fieldset['name']) { foreach ($fieldset->children() as $field) { if ('rules' == (string) $field['name']) { foreach ($field->children() as $action) { $actions[(string) $action['title']] = array((string) $action['name'], (string) $action['description']); } break; break; break; } } } } // Load language $lang = JFactory::getLanguage(); $extension = 'com_config'; $source = JPATH_ADMINISTRATOR . '/components/' . $extension; $lang->load("{$extension}.sys", JPATH_ADMINISTRATOR, null, false, true) || $lang->load("{$extension}.sys", $source, null, false, true); } } return $actions; }
/** * Gets allowed actions * * @param int $messageId - message id * @param string $unit - the unit * @param string $assetName - asset name * * @return JObject */ public static function getActions($messageId = 0, $unit = 'component', $assetName = '') { jimport('joomla.access.access'); $user = JFactory::getUser(); $result = new JObject(); if (empty($messageId)) { $asset = $assetName; } else { $asset = $assetName . '.' . $unit . '.' . (int) $messageId; } $actions = JAccess::getActions($assetName, $unit); foreach ($actions as $action) { $result->set($action->name, $user->authorise($action->name, $asset)); } return $result; }
/** * Get the actions */ public static function getActions($Id = 0) { jimport('joomla.access.access'); $user = JFactory::getUser(); $result = new JObject(); if (empty($Id)) { $assetName = 'com_fandb'; } else { $assetName = 'com_fandb.message.' . (int) $Id; } $actions = JAccess::getActions('com_fandb', 'component'); foreach ($actions as $action) { $result->set($action->name, $user->authorise($action->name, $assetName)); } return $result; }
/** * Gets a list of the actions that can be performed. * * @param int The category ID. * * @return Object */ public static function getActions($categoryId = 0, $newsfeedId = 0) { $result = new \Hubzero\Base\Object(); if (empty($categoryId)) { $assetName = 'com_newsfeeds'; $level = 'component'; } else { $assetName = 'com_newsfeeds.category.' . (int) $categoryId; $level = 'category'; } $actions = JAccess::getActions('com_newsfeeds', $level); foreach ($actions as $action) { $result->set($action->name, User::authorise($action->name, $assetName)); } return $result; }
public static function getRights($categoryId = 0) { $user = JFactory::getUser(); $res = new JObject(); if (empty($categoryId)) { $asset = 'com_aimysitemap'; $level = 'component'; } else { $asset = 'com_aimysitemap.category.' . (int) $categoryId; $level = 'category'; } $actions = JAccess::getActions('com_aimysitemap', $level); foreach ($actions as $action) { $res->set($action->name, $user->authorise($action->name, $asset)); } return $res; }
/** * Gets a list of the actions that can be performed. * * @return JObject */ public static function getActions($module = 0) { $user = JFactory::getUser(); $result = new JObject(); if (empty($articleId)) { $assetName = 'com_advancedmodules'; $section = ''; } else { $assetName = 'com_advancedmodules.module.' . (int) $module; $section = 'module'; } $actions = JAccess::getActions('com_advancedmodules'); foreach ($actions as $action) { $result->set($action->name, $user->authorise($action->name, $assetName)); } return $result; }
/** * Gets a list of the actions that can be performed. * * @param integer $categoryId The category ID. * @param integer $id The item ID. * @param string $assetName The asset name * * @return JObject * * @since 3.1 */ public static function getActions($component = '', $section = '', $id = 0) { // Reverted a change for version 2.5.6 $user = JFactory::getUser(); $result = new JObject(); $path = JPATH_ADMINISTRATOR . '/components/' . $component . '/access.xml'; if ($section && $id) { $assetName = $component . '.' . $section . '.' . (int) $id; } else { $assetName = $component; } $actions = JAccess::getActions('com_azurapagebuilder', 'component'); foreach ($actions as $action) { $result->set($action->name, $user->authorise($action->name, $assetName)); } return $result; }
/** * Gets a list of the actions that can be performed. * * @param string $extension The extension. * @param int $categoryId The category ID. * @return Object * @since 1.6 */ public static function getActions($extension, $categoryId = 0) { $result = new \Hubzero\Base\Object(); $parts = explode('.', $extension); $component = $parts[0]; if (empty($categoryId)) { $assetName = $component; $level = 'component'; } else { $assetName = $component . '.category.' . (int) $categoryId; $level = 'category'; } $actions = JAccess::getActions($component, $level); foreach ($actions as $action) { $result->set($action->name, User::authorise($action->name, $assetName)); } return $result; }
public static function getActions($itemid = 0) { jimport('joomla.access.access'); $user = JFactory::getUser(); $result = new JObject(); if (empty($itemid)) { $assetName = S_APP_NAME; $level = 'component'; } else { $assetName = S_APP_NAME . '.category.' . (int) $itemid; $level = 'category'; } $actions = JAccess::getActions(S_APP_NAME, $level); foreach ($actions as $action) { $result->set($action->name, $user->authorise($action->name, $assetName)); } return $result; }
public static function getActions() { $user = JFactory::getUser(); $result = new JObject(); //Get the core actions $core_actions = JAccess::getActions('com_virtuemart', 'component'); foreach ($core_actions as $action) { $result->set($action->name, $user->authorise($action->name, 'com_virtuemart')); } //Get the actions for each section $sections = array('product', 'category', 'manufacturer', 'orders', 'shop', 'other'); foreach ($sections as $section) { $section_actions = JAccess::getActions('com_virtuemart', $section); foreach ($section_actions as $action) { $result->set($action->name, $user->authorise($action->name, 'com_virtuemart')); } } return $result; }
/** * Gets a list of the actions that can be performed. * * @param string $component The component name. * @param string $section The access section name. * @param integer $id The item ID. * * @return JObject */ public static function getActions($component = '', $section = '', $id = 0) { $user = JFactory::getUser(); $result = new JObject(); if ($section and $id) { $asset_name = $component . '.' . $section . '.' . (int) $id; } else { $section = 'component'; $asset_name = $component; } if ($section == 'category') { $actions = JAccess::getActions($component, $section); } else { $actions = JAccess::getActions($component); } foreach ($actions as $action) { $result->set($action->name, $user->authorise($action->name, $asset_name)); } return $result; }
/** * Method to get the list of possible permission action names for the form field. * * @param SimpleXMLElement $element The SimpleXMLElement object representing the `<field>` tag for the form field object. * * @return array A list of permission action names from the form field element definition. * * @since 11.1 */ protected function getFieldActions(SimpleXMLElement $element) { $actions = array(); // Initialise some field attributes. $section = $element['section'] ? (string) $element['section'] : ''; $component = $element['component'] ? (string) $element['component'] : ''; // Get the asset actions for the element. $elActions = JAccess::getActions($component, $section); // Iterate over the asset actions and add to the actions. foreach ($elActions as $item) { $actions[] = $item->name; } // Iterate over the children and add to the actions. foreach ($element->children() as $el) { if ($el->getName() == 'action') { $actions[] = (string) $el['name']; } } return $actions; }