6

In Magento Enterprise there is the module Enterprise_AdminGws which limits editing rights to specific store views.

How generally is this implemented? i.e. if I create an extension that implements its own data model with data that is stored on store view level, does that mean the limits imposed by AdminGws would work out of the box or is it necessary to register my additional resource models with the Enterprise_AdminGws extension.

And example could be a blog extension with blog entries and comments: Those have a store-view field and should only be edited by the store-view admin.

Edit (scope clarification): It is clear that I have to define my own ACLs in the adminhtml.xml as usual first.

2 Answers 2

4

While all of the code is provided for you if you're using Magento's built-in structures (customer, sales, etc.) you have to provide your own callback validators for permissions that are specific to your application.

For instance, this observer:

<model_save_before>
    <observers>
        <enterprise_admingws>
            <class>enterprise_admingws/observer</class>
            <method>validateModelSaveBefore</method>
        </enterprise_admingws>
    </observers>
</model_save_before>

Allows the method Enterprise_AdminGws_Model_Observer::validateModelSaveBefore to map to a custom callback method that is derived by the class name. This method is defined in Models.php, which has some bootstrap code to determine if the save privileges exist for a particular role.

The callback will either throw or return void. Its purpose is to validate only. Add in your own callbacks by extending Enterprise_AdminGws_Model_Models.

0

I believe you must declare the acl in the adminhtml.config as well (since it's in the title). Something like

<config>
    <acl>
        <resources>
            <admin>
                <children>
                    <system>
                        <children>
                            <config>
                                <children>
                                    <moduleName>
                                        <title>moduleName Section</title>
                                    </moduleName>
                                </children>
                            </config>
                        </children>
                    </system>
                    <report>
                        <children>
                            <salesroot>
                                <children>
                                    <moduleName_settlement_reports translate="title">
                                        <title>Settlement Reports</title>
                                        <children>
                                            <view translate="title">
                                                <title>View</title>
                                            </view>
                                            <fetch translate="title">
                                                <title>Fetch</title>
                                            </fetch>
                                        </children>
                                    </moduleName_settlement_reports>
                                </children>
                            </salesroot>
                        </children>
                    </report>
                </children>
            </admin>
        </resources>
    </acl>
</config>

Is what I'm using and it seems to be working just fine.

4
  • Did you test this with AdminGWS ? i.e. did you create several roles with permissions on different stores and where not able to see that report on another store? I have edited my question - it is not about the standard ACL definition.
    – Alex
    Commented Jun 26, 2013 at 15:10
  • No, I didn't use that module here, but I believe you must still declare it so use it. I see you edited the question to reflect this. Don't know why I got down voted for it.
    – Quantum
    Commented Jun 26, 2013 at 15:29
  • Just feel free to update you answer according to the edited question :-) no offense ... happy to vote up
    – Alex
    Commented Jun 27, 2013 at 10:25
  • FYI your answer only deals with standard ACL definition. OP is asking about the corresponding check via PHP for admin user scope restrictions specific to Enterprise Edition.
    – benmarks
    Commented Jun 27, 2013 at 10:55

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.