We’re rewarding the question askers & reputations are being recalculated! Read more.

Hot answers tagged

9

I ended up doing something like the following in my data-install-1.0.0.php script, which creates a new role and user with 'all' privileges. $api_key = "your_key_here"; $api_role = Mage::getModel('api/roles') ->setName('<module>') ->setPid(false) ->setRoleType('G') ->save(); Mage::getModel('api/rules') ...


9

The problem here is that your resource has to match the menu name. This is a convention in Magento and if you do not do this, then it will show, but you cannot save the values. This is a problem I faced often before. Here is a simple example of how it should work: <?xml version="1.0" ?> <config> <menu> <mycustom_menu ...


8

Here is one way to do it: Make an observer to watch when an admin logs in, namely the admin_session_user_login_success event Check what the current admins' role is, use the following code: $roleId = implode('', Mage::getSingleton('admin/session')->getUser()->getRoles()); $roleName = Mage::getModel('admin/roles')->load($roleId)->getRoleName(); ...


6

You have to just add image role using create image attribute from Stores -> Attribute -> Product Click on Create new attribute. Set Catalog Input type for store owner is Media Image Save Attribute. Now set above attribute in Attribute Set like default. Run command php bin/magento indexer:reindex


5

Go to System > Configuration > Webservice and you will find the settings for Magento's APIs. Depending on what kind of API they want to use (SOAP-XML / REST) you can create a user for that kind of API and a role to go with it. When creating the role I would advise you to be specific in what a third party can, and can not have access to. Only give ...


5

Take a look at app/code/core/Mage/Adminhtml/Block/Permissions/Tab/Rolesedit.php. Look for method getResTreeJson. This method returns a json array of all resources. Also you can just call this code: $resources = Mage::getModel('admin/roles')->getResourcesTree(); It returns a Varien_Simplexml_Element object.


4

In short: What you call "the role" is the group (like "Administrators"). Each group has an entry with the type G and each user has an entry with the type U which refers to the user's group via parent_id. All access rules are defined at group level. If you look at the table admin_rules, you will see that all entries have G as role type. The admin_rule....


3

if the issue is for the custom/third-party modules, then you probably need to add the following function in the admin controllers: protected function _isAllowed() { return Mage::getSingleton('admin/session')->isAllowed('your module'); // or like module/controller etc. } In this way the permissions will return error only for the ones not selected/...


3

Problem resolved. By modifying _isAllowed() function like following protected function _isAllowed() { return true; } It's a very bad decision. In you case right way is: protected function _isAllowed() { return Mage::getSingleton('admin/session')->isAllowed('system/vendor'); }


3

To get all the Roles $roles = Mage::getModel('admin/roles')->getCollection(); foreach($roles as $role): echo '<br/>Role : '.$role->getId()." | ".$role->getRoleName(); endforeach; To get the Role users $roles_users = Mage::getResourceModel('admin/roles_user_collection'); foreach($roles_users as $roleuser): $user = Mage::...


3

That issue of Magento Cache when loading rule collection from the database Just Clean Magento Cache.


3

Yes, the that is 'the group'. Each user has a User Role which has a parent of a Group Role, all users are assigned to a group via the parent_id in that table. The only real value I can see is in the acl generation where they can dump in the whole table and generate the acl structure based on the information provided, in Mage_Admin_Model_Resource_Acl::...


3

This is taken directly from Inchoo http://inchoo.net/magento/configure-magento-rest-and-oauth-settings/ per BOOMER's comment about posting the answer. I give them full credit for this answer. 1. Creating oAuth Consumer Since Magento REST service is working only with oAuth authentication, we need to create oAuth consumer application first. Navigate to ...


3

You need to create in your extension, inside the etc folder a file named adminhtml.xml. In this file you should have the ACL for your menu. Actually you should have the menu in here also but it works even if you added the menu in config.xml In this file you need to add an xml structura similar to the one you added for the menu. Here is an example. Let's ...


3

It seams you are doing it OK. It all depends on the values you use. This piece of code worked for me. Assuming $id is the admin id in question: $user = Mage::getModel('admin/user')->load($id); $user->setRoleIds(array(5)) ->setRoleUserId($user->getUserId()) ->saveRelations(); 5 is the id of the role. It even works with a role id that ...


2

Strange! But finaly got a solution from here. Gave a try catch like this, try { $role = Mage::getModel("admin/role"); $role->setParent_id(5); $role->setTree_level(1); $role->setRole_type('U'); $role->setUser_id($user_id); $role->save(); echo "Your username: ".$...


2

TL;DR: no it is not possible to assign more than one role The database tables admin_* look like this is possible. There are rules in admin_rule, users in admin_users and a tree in admin_role |-- Administrator (role name) | |-- John Doe (user) | +-- Martha Example (user) +-- CMS Manager (role name) |-- user 3 +-- user 4 So theoretically ...


2

Create your own controller replacing Mage_Adminhtml_Sales_OrderController. In your controller, create an _isAllowed method: /** * Acl check for admin * * @return bool */ protected function _isAllowed() { $action = strtolower($this->getRequest()->getActionName()); $aclResource = null; switch ($action) { case 'addressSave': ...


2

For getting custom product image role at any place using product object like below way, You can just get product image role using below way, $_products->getData('global'); If product with global role is assigned at that time you got global image value in above query. Clear cache and check.


2

You can get products image by Type by following Code : $baseImage = $product->getImage(); $smallImage = $product->getSmallImage(); $thumbnail = $product->getThumbnail(); OR You can get types of gallery images of a product by following code: $existingMediaGalleryEntries = $product->getMediaGalleryEntries(); foreach ($...


1

I do it, using this code : $role = $this->_roleCollection->addFieldToFilter('role_name', 'test')->getFirstItem(); $resource = $this->_aclRetriver->getAllowedResourcesByRole($role->getId()); array_push($resource, 'Magento_Catalog::products' ); $this->_rulesFactory->create()->setRoleId($role->getId())->setResources($...


1

You can set role to admin user using role and user models. /** @var \Magento\Authorization\Model\Role $role */ $role = $this->getRole(); /** @var $model \Magento\User\Model\User */ $user = $this->getUser(); $user->setRoleId($role->getId()); $user->save(); In your case: $userModel->setRoleId($roleAuthModel->getId()); $userModel->...


1

path : /vendor/magento/module-user/Block/Role/Tab/Edit.php in the function getTree() I changed: isset($resources[1]['children']) ? $resources[1]['children'] into: isset($resources[2]['children']) ? $resources[2]['children'] and the resource tree is shown again. For More Details


1

$resources = Mage::getModel('admin/roles')->getResourcesList(); for more information refer a http://sonimanthan228.blogspot.in/2015/12/fetch-all-resource-list-in-magento-by.html


1

To have a list of the resources you can call this code: $resources = Mage::getModel('admin/roles')->getResourcesList2D(); This will return an array with all the path of the resources.


1

Your requests seem tailored for this extension: Aitoc Advanced Permissions. ..>Edit Role>Advanced Permisssions > Allow manage own products only ..>Edit Role>Advanced Permisssions > Limit Access to Store Views/Categories System>Configuration>Advanced>Admin > Products Approve These are very close to what you need. There are a lot of settings with which you ...


1

Try using: return Mage::getSingleton('admin/session')->isAllowed('catalog/inventory/inventory');


1

You will have to create a custom module for such since Magento's ACL isn't that fine grained for control. Normally I would just override the customer grid admin block, but I've been making it a point to learn ways to do things with observers, so I learned a few things as well, hope this helps! the modules config.xml <config> <adminhtml> ...


1

https://stackoverflow.com/questions/6199605/how-to-configure-multiple-admin-users-to-multiple-websites-in-one-installation-i I also wanted to have this feature, you can check the answer made by 'Joseph Mastey' and see the links that he posted there. :)


Only top voted, non community-wiki answers of a minimum length are eligible