Vantiv / litle-integration-magento

Magento Integration for Vantiv eCommerce
https://developer.vantiv.com/community/ecommerce
MIT License
6 stars 10 forks source link

Plugin needs permissions to allow non-admins to use features (after SUPEE-6285) #24

Open kel opened 9 years ago

kel commented 9 years ago

Magento fixed a permissions bug in SUPEE-6285 where it didn't check permissions and set it so that only admins have access to plugins that don't have permissions set.

http://merch.docs.magento.com/ce/user_guide/Magento_Community_Edition_User_Guide.html#magento/patch-releases-2015.html

The only thing that we have non-admins doing is capturing from the orders page so I implemented the below code to fix it. I would submit a PR but I'm not sure if there are others things that should have permissions or if you wanted to do it a little bit differently.

app/code/local/Litle/CreditCard/controllers/Adminhtml/OrderController.php

protected function _isAllowed()
{
    return Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/creditcard');
}

app/code/local/Litle/CreditCard/etc/config.xml

<adminhtml>
    <acl>
        <resources>
            <all>
                <title>Allow Everything</title>
            </all>
            <admin>
                <children>
                    <sales>
                        <children>
                            <order>
                                <children>
                                    <actions>
                                        <children>
                                            <creditcard translate="title" module="creditcard">
                                                <title>Credit card capture (Litle)</title>
                                            </creditcard>
                                        </children>
                                    </actions>
                                </children>
                            </order>
                        </children>
                    </sales>
                </children>
            </admin>
        </resources>
    </acl>
</adminhtml>