本文整理汇总了PHP中Mage_Api2_Model_Acl_Global_Role类的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Api2_Model_Acl_Global_Role类的具体用法?PHP Mage_Api2_Model_Acl_Global_Role怎么用?PHP Mage_Api2_Model_Acl_Global_Role使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Mage_Api2_Model_Acl_Global_Role类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: _beforeToHtml
/**
* Hook before html rendering
*
* @return Mage_Api2_Block_Adminhtml_Roles_Tabs
*/
protected function _beforeToHtml()
{
$role = $this->getRole();
if ($role && Mage_Api2_Model_Acl_Global_Role::isSystemRole($role)) {
$this->setActiveTab('api2_role_section_resources');
} else {
$this->setActiveTab('api2_role_section_info');
}
return parent::_beforeToHtml();
}
示例3: _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;
}
示例4: isHidden
/**
* Whether tab is hidden
*
* @return bool
*/
public function isHidden()
{
return $this->getRole() && Mage_Api2_Model_Acl_Global_Role::isSystemRole($this->getRole());
}
示例5: setFilterValue
/**
* Set filter value
*
* @param Mage_Api2_Model_Acl_Global_Role $role
*/
public function setFilterValue($role)
{
if ($role && $role->getId()) {
$this->_role = $role;
}
}
示例6: getDeleteButtonHtml
/**
* Get delete button HTML
*
* @return string
*/
public function getDeleteButtonHtml()
{
if (!$this->getRole() || !$this->getRole()->getId() || Mage_Api2_Model_Acl_Global_Role::isSystemRole($this->getRole())) {
return '';
}
$this->getChildBlock('deleteButton')->setData('onclick', sprintf("deleteConfirm('%s', '%s')", Mage::helper('Mage_Adminhtml_Helper_Data')->__('Are you sure you want to do this?'), $this->getUrl('*/*/delete', array('id' => $this->getRole()->getId()))));
return $this->getChildHtml('deleteButton');
}
示例7: isSystemRole
/**
* Get role system belonging
*
* @param Mage_Api2_Model_Acl_Global_Role $role
* @return bool
*/
public static function isSystemRole($role)
{
return in_array($role->getId(), self::getSystemRoles());
}
示例8: getRoleUsers
/**
* Get users
*
* @param Mage_Api2_Model_Acl_Global_Role $role
* @return array
*/
public function getRoleUsers(Mage_Api2_Model_Acl_Global_Role $role)
{
$adapter = $this->_getReadAdapter();
$select = $adapter->select()->from($this->getTable('api2/acl_user'))->where('role_id=?', $role->getId());
$users = $adapter->fetchCol($select);
return $users;
}
示例9: decorateUserType
/**
* Decorate 'User Type' column
*
* @param string $renderedValue Rendered value
* @param Mage_Api2_Model_Acl_Global_Role $row
* @param Mage_Adminhtml_Block_Widget_Grid_Column $column
* @param bool $isExport
* @return string
*/
public function decorateUserType($renderedValue, $row, $column, $isExport)
{
switch ($row->getEntityId()) {
case Mage_Api2_Model_Acl_Global_Role::ROLE_GUEST_ID:
$userType = Mage::helper('api2')->__('Guest');
break;
case Mage_Api2_Model_Acl_Global_Role::ROLE_CUSTOMER_ID:
$userType = Mage::helper('api2')->__('Customer');
break;
default:
$userType = Mage::helper('api2')->__('Admin');
break;
}
return $userType;
}