User Rating: 2 / 5

Star ActiveStar ActiveStar InactiveStar InactiveStar Inactive
 
Access Control List (ACL)

 

Let's start creating files in the folder access.xml com_helloworld. 

com_helloworld/access.xml

<?xml version="1.0" encoding="utf-8" ?>
<access component="com_helloworld">
   <section name="com_helloworld">
      <action name="core.admin" title="JACTION_ADMIN" description="JACTION_ADMIN_COMPONENT_DESC" />
      <action name="core.manage" title="JACTION_MANAGE" description="JACTION_MANAGE_COMPONENT_DESC" />
      <action name="core.create" title="JACTION_CREATE" description="JACTION_CREATE_COMPONENT_DESC" />
      <action name="core.delete" title="JACTION_DELETE" description="JACTION_DELETE_COMPONENT_DESC" />
      <action name="core.edit" title="JACTION_EDIT" description="JACTION_EDIT_COMPONENT_DESC" />
      <action name="core.edit.state" title="JACTION_EDITSTATE" description="JACTION_EDITSTATE_COMPONENT_DESC" />
      <action name="core.edit.own" title="JACTION_EDITOWN" description="JACTION_EDITOWN_COMPONENT_DESC" />
   </section>
</access>

In the config.xml file in the code must have permissions. 

com_helloworld/config.xml

<fieldset
        name="permissions"
        label="JCONFIG_PERMISSIONS_LABEL"
        description="JCONFIG_PERMISSIONS_DESC"
        >

        <field
                name="rules"
                type="rules"
                label="JCONFIG_PERMISSIONS_LABEL"
                class="inputbox"
                validate="rules"
                filter="rules"
                component="com_helloworld"
                section="component" />
</fieldset>

For configuring an ACL, it's set in the Config Component.

For ACL 

First we need to create a function for checking ACL will be created in the Class Helper helper.php file to put the code.

com_helloworld/helpers/helper.php

protected static $actions;
public static function getActions()
{
        if (empty(self::$actions))
        {
                $user = JFactory::getUser();
                self::$actions = new JObject;

                $actions = JAccess::getActions('com_helloworld');

                foreach ($actions as $action)
                {
                        self::$actions->set($action->name, $user->authorise($action->name, 'com_helloworld'));
                }
        }

        return self::$actions;
}

Then open view.html.php in a fix folder hellos 

com_helloworld/views/hellos/view.html.php

function addToolbar() 
{
    $helper = new Helper();
    $canDo = $helper->getActions();

    JToolbarHelper::title(JText::_('COM_HELLOWORLD_HELLO_HELLO_LIST'));

    if($canDo->get('core.create')) {
            JToolbarHelper::addNew('add');
    }

    if($canDo->get('core.edit')) {
            JToolbarHelper::editList('edit');
    }

    if($canDo->get('core.delete')) { 
            JToolbarHelper::deleteList('Are you sure?', 'delete');
    }

    if($canDo->get('core.admin')) { 
            JToolbarHelper::preferences('com_helloworld');
    }

    JHtmlSidebar::setAction('index.php?option=com_content&view=articles');
    JHtmlSidebar::addFilter(
            JText::_('JOPTION_SELECT_PUBLISHED'),
            'filter_published',
            JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.published'), true)
    );
}
Recent Topics
Subject
Post Reply
Open
Recent
介绍Module Mrelated Article Specific Category。存储浏览历史记录。
By wipaporn Wed 13 Feb 2019 3:23 pm Board Chinese Language - 简体中文
0
973
Wed 13 Feb 2019 3:23 pm By wipaporn
介绍Component mFaceBook以帮助在Facebook上注册网站成员资
By wipaporn Wed 13 Feb 2019 3:20 pm Board Chinese Language - 简体中文
0
338
Wed 13 Feb 2019 3:20 pm By wipaporn
介绍Paytoread。插件只显示一些文本。
By wipaporn Wed 13 Feb 2019 3:17 pm Board Chinese Language - 简体中文
0
325
Wed 13 Feb 2019 3:17 pm By wipaporn
介绍插件MD水印(MD水印插件),自动水印插件
By wipaporn Wed 13 Feb 2019 3:15 pm Board Chinese Language - 简体中文
0
1075
Wed 13 Feb 2019 3:15 pm By wipaporn
Introducing Plugin MD Watermark, plug for automatic watermarking
By wipaporn Wed 13 Feb 2019 3:11 pm Board English Language
0
1395
Wed 13 Feb 2019 3:11 pm By wipaporn
Introducing PayToRead. The plugin shows only some text.
By wipaporn Wed 13 Feb 2019 3:08 pm Board English Language
0
1492
Wed 13 Feb 2019 3:08 pm By wipaporn
Introducing Component MFacebook to help with website membership registration with Facebook
By wipaporn Wed 13 Feb 2019 3:06 pm Board English Language
0
1481
Wed 13 Feb 2019 3:06 pm By wipaporn
Introducing Mrelated Article Specific Category Module (Storage browsing history).
By wipaporn Wed 13 Feb 2019 3:03 pm Board English Language
1
1802
Tue 27 Oct 2020 6:28 pm By prmindphp
Introducing Mod MDFiles Categories Module Bring Categories from MDFile.
By wipaporn Wed 13 Feb 2019 2:59 pm Board English Language
0
5362
Wed 13 Feb 2019 2:59 pm By wipaporn
Introducing the Mod MDFile recent module to show files from MDFile
By wipaporn Wed 13 Feb 2019 2:56 pm Board English Language
0
6634
Wed 13 Feb 2019 2:56 pm By wipaporn
Introducing MDFile Components for Joomla, helping to download document files on the website.
By wipaporn Wed 13 Feb 2019 2:49 pm Board English Language
3
2837
Wed 29 Apr 2020 11:49 am By mindphp
Features Review : Components MDFile membantu memuat turun fail dokumen di laman web.
By abdkode Wed 13 Feb 2019 2:37 pm Board Bahasa Language
0
1065
Wed 13 Feb 2019 2:37 pm By abdkode
Features Review : Mod MDFile recent Module yang menunjukkan fail yang diupload
By abdkode Tue 12 Feb 2019 6:45 pm Board Bahasa Language
0
1402
Tue 12 Feb 2019 6:45 pm By abdkode
Features Review : Plugin MD Watermark memudahkan dalam meletakan tanda air atau watermark
By abdkode Tue 12 Feb 2019 4:20 pm Board Bahasa Language
0
797
Tue 12 Feb 2019 4:20 pm By abdkode
这个(Pace)是什么?
By Parichat Wed 06 Feb 2019 7:25 pm Board Chinese Language - 简体中文
0
716
Wed 06 Feb 2019 7:25 pm By Parichat
pace 가 뭐죠?
By Parichat Wed 06 Feb 2019 7:25 pm Board korean Language - 한국어
0
500
Wed 06 Feb 2019 7:25 pm By Parichat
Mindphp webboard 등록하는 방법
By wipaporn Wed 06 Feb 2019 6:12 pm Board korean Language - 한국어
0
145
Wed 06 Feb 2019 6:12 pm By wipaporn
minephp webboard 注册方法
By wipaporn Wed 06 Feb 2019 5:49 pm Board Chinese Language - 简体中文
0
221
Wed 06 Feb 2019 5:49 pm By wipaporn
How to register minephp webboard
By wipaporn Wed 06 Feb 2019 5:30 pm Board English Language
0
410
Wed 06 Feb 2019 5:30 pm By wipaporn
Let's get to know Korea
By wipaporn Mon 04 Feb 2019 8:04 pm Board korean Language - 한국어
0
544
Mon 04 Feb 2019 8:04 pm By wipaporn