I want to give access to 2 new roles. This new role will manage the customers, but one will manage the customers of the 'group X' and the other the 'group Y'. Is there a solution to filter this?

I mean, 'role 1' will not see customers group Y, but group X, and role 2 the opposite of role 1.

Is this possible? I searched for extensions but the research was useless.


1 Answer 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


the modules Model for the event observer configured above (your name space will vary in the <class> node of the config.xml:

public function gridByUsers($observer) {

    $collection = $observer->getCollection();
    if ($collection instanceof Mage_Customer_Model_Resource_Customer_Collection) {

        // Check for Admin's user group role ID
        $adminRoleId = Mage::getSingleton('admin/session')->getUser()->getRole()->getRoleId();            
        if ($adminRoleId == "1") {

            // filter out customers by their group ID
            $collection->addFieldToFilter('group_id', '1');

            // remove group column from grid layout
            $block = Mage::app()->getLayout()->getBlock('customer.grid');


Keep in mind this is only with hardcoded values for the Admin's role ID and the Customers Group ID, you would most likely want to create an custom customer attribute to associate the two IDs together. If you are only doing it for a handful of Admin's Role and Customer Group's it may suffice with a simple array or just adding extra conditioning for your IDs.

Also here's a semi-related article:


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.