Access Control Lists in Magento

Nhận xét sản phẩm này

Tình trạng: Còn hàng

0,00 US$
Hoặc

Access Control Lists in Magento

Access Control Lists in Magento

1.         Function :

-           To define the permitted user in application access

 

2.         Declaration location:

- Go to  <adminhtml> (in config.xml file or in adminhtml.xml file)

 

3.         Declaring Configuration in the system:

-       <acl>

-           <resources>

-             <all>

-               <title>Allow Everything</title>

-             </all>

-             <admin>

-               <children>

-                 <system>

-                   <children>

-                     <config>

-                       <children>

-                         <tên nhận diên của section>

-                           <title>Tiêu đề tên nhận diện của section</title>

-                         </tên nhận diên của section>   

-                       </children> 

-                     </config>

-                   </children>  

-                 </system>     

-               </children>   

-             </admin>

-           </resources>

-         </acl>

4. Declaring menu :

-       For example, create a new menu named “Hello” in Catalog Menu:

<menu>

      <catalog>

        <title>Catalog</title>

        <sort_order>71</sort_order>              

        <children>

          <hello>

            <title>Manage Hello Menu</title>

            <sort_order>0</sort_order>

            <action>hello/adminhtml_index</action>

          </hello>

        </children>

      </catalog>

    </menu>

-       Declare acl for this above menu:

<acl>

        <resources>

            <admin>

                <children>

                    <catalog>

                        <children>

                            <hello translate="title">

                                <title>Manage Hello Menu</title>

                                <sort_order>15</sort_order>

                            </hello>

                        </children>

                    </catalog>

                  </children>

            </admin>

        </resources>

    </acl>

 5. Declaring Action in Controller:

-       Create custom acl for the module which contains Router admin “Hello”, set Manage for Controller and other Actions in Controller are Index , View , Edit , delete :

<acl>

      <resources>

        <admin>

          <children>

            <hello translate="title">

              <title>Bss_Hello</title>

              <sort_order>60</sort_order>

              <children>

                <manage translate="title">

                  <title>Manage</title>

                  <children>

                    <actions translate="title">

                      <title>Actions</title>

                      <children>

                        <index translate="title"><title>Index</title></index>

<view translate="title"><title>View</title></view>

                        <edit translate="title"><title>Edit</title></edit>

                        <delete translate="title"><title>Delete</title></delete>

                      </children>

                    </actions>

                  </children>

                  <sort_order>10</sort_order>

                </manage>

              </children>

            </hello>

          </children>

        </admin>

      </resources>

    </acl>

-       Edit controller admin to grant permission to Action according to each user’s permission: (check lại)

+     Declare function _isAllowed :

           

protected function _isAllowed()

    {

                   //get the name of action

        $action = strtolower($this->getRequest()->getActionName());

       //set true and allow to access to action if resource acl is chosen

        return Mage::getSingleton('admin/session')->isAllowed(hello/manage/actions/'.$action);

    }

 6. Set up permission for each account:

-       Go to Roles to declare permission

-       Choose the applications that are allowed to access to that Roles  

-       Set Roles for User :

 

Thông tin kỹ thuật

Author BSS Member
(0)

Questions and Answers

add your question

There are no entries.