本文整理汇总了PHP中Mage_Api2_Model_Acl_Global_Role::getSystemRoles方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Api2_Model_Acl_Global_Role::getSystemRoles方法的具体用法?PHP Mage_Api2_Model_Acl_Global_Role::getSystemRoles怎么用?PHP Mage_Api2_Model_Acl_Global_Role::getSystemRoles使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Api2_Model_Acl_Global_Role
的用法示例。
在下文中一共展示了Mage_Api2_Model_Acl_Global_Role::getSystemRoles方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _prepareCollection
/**
* Prepare grid collection object
*
* @return Mage_Api2_Block_Adminhtml_Permissions_User_Edit_Tab_Roles
*/
protected function _prepareCollection()
{
/** @var $collection Mage_Api2_Model_Resource_Acl_Global_Role_Collection */
$collection = Mage::getResourceModel('api2/acl_global_role_collection');
$collection->addFieldToFilter('entity_id', array('nin' => Mage_Api2_Model_Acl_Global_Role::getSystemRoles()));
$this->setCollection($collection);
return parent::_prepareCollection();
}
示例2: _setRules
/**
* Retrieve rules data from DB and inject it into ACL
*
* @return Mage_Api2_Model_Acl
*/
protected function _setRules()
{
$resources = $this->getResources();
/** @var Mage_Api2_Model_Resource_Acl_Global_Rule_Collection $rulesCollection */
$rulesCollection = Mage::getResourceModel('api2/acl_global_rule_collection');
foreach ($rulesCollection as $rule) {
/** @var Mage_Api2_Model_Acl_Global_Rule $rule */
if (Mage_Api2_Model_Acl_Global_Rule::RESOURCE_ALL === $rule->getResourceId()) {
if (in_array($rule->getRoleId(), Mage_Api2_Model_Acl_Global_Role::getSystemRoles())) {
/** @var Mage_Api2_Model_Acl_Global_Role $role */
$role = $this->_getRolesCollection()->getItemById($rule->getRoleId());
$privileges = $this->_getConfig()->getResourceUserPrivileges($this->_resourceType, $role->getConfigNodeName());
if (!array_key_exists($this->_operation, $privileges)) {
continue;
}
}
$this->allow($rule->getRoleId());
} elseif (in_array($rule->getResourceId(), $resources)) {
$this->allow($rule->getRoleId(), $rule->getResourceId(), $rule->getPrivilege());
}
}
return $this;
}