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
Features Review : Components MApplication Form untuk permohonan pekerjaan melalui laman web.
By abdkode Fri 22 Feb 2019 3:25 pm Board Bahasa Language
0
2967
Fri 22 Feb 2019 3:25 pm By abdkode
Features Review : Components MComponentgen & M Packet untuk membantu dengan Menjana Komponen, Modul, Plugin
By abdkode Fri 22 Feb 2019 2:26 pm Board Bahasa Language
0
2864
Fri 22 Feb 2019 2:26 pm By abdkode
Features Review : Components MCharts untuk memproses data dari MJForms menjadi graf
By abdkode Fri 22 Feb 2019 2:02 pm Board Bahasa Language
0
2654
Fri 22 Feb 2019 2:02 pm By abdkode
Features Review : Components MDBridge untuk menyambung data pengguna antara Joomla dan PHPbb Webboard
By abdkode Thu 21 Feb 2019 6:04 pm Board Bahasa Language
0
2871
Thu 21 Feb 2019 6:04 pm By abdkode
Features Review : MDEvents untuk mengurus pelbagai jadual data aktiviti
By abdkode Thu 21 Feb 2019 4:51 pm Board Bahasa Language
0
1843
Thu 21 Feb 2019 4:51 pm By abdkode
Features Review : Component MJUpgrade untuk menaik taraf Joomla 1.5 ke Joomla 2.5, 3.X
By abdkode Thu 21 Feb 2019 4:10 pm Board Bahasa Language
0
6003
Thu 21 Feb 2019 4:10 pm By abdkode
Features Review : Mod Mslideshows untuk memaparkan gambar, video Youtube dari kandungan
By abdkode Thu 21 Feb 2019 3:29 pm Board Bahasa Language
0
1352
Thu 21 Feb 2019 3:29 pm By abdkode
Plugin Editors XTD Multicontent 사용 지침과 설명
By wipaporn Thu 21 Feb 2019 12:28 pm Board korean Language - 한국어
0
9468
Thu 21 Feb 2019 12:28 pm By wipaporn
Module M Slideshows 사용 지침과 설명
By wipaporn Thu 21 Feb 2019 12:27 pm Board korean Language - 한국어
0
5171
Thu 21 Feb 2019 12:27 pm By wipaporn
Component M Multisite Master 사용 지침과 설명
By wipaporn Thu 21 Feb 2019 12:27 pm Board korean Language - 한국어
0
5365
Thu 21 Feb 2019 12:27 pm By wipaporn
Component M Multisite Client 사용 지침과 설명
By wipaporn Thu 21 Feb 2019 12:27 pm Board korean Language - 한국어
0
8313
Thu 21 Feb 2019 12:27 pm By wipaporn
MDFiles Featured 사용 지침과 설명
By wipaporn Thu 21 Feb 2019 12:26 pm Board korean Language - 한국어
0
9560
Thu 21 Feb 2019 12:26 pm By wipaporn
Module MDFiles Popular 사용 지침과 설명
By wipaporn Thu 21 Feb 2019 12:25 pm Board korean Language - 한국어
0
5885
Thu 21 Feb 2019 12:25 pm By wipaporn
Components MDFiles 사용 지침과 설명
By wipaporn Wed 20 Feb 2019 7:13 pm Board korean Language - 한국어
0
2359
Wed 20 Feb 2019 7:13 pm By wipaporn
Features Review : Mod Menu Json untuk menyemak Nama Domain dan memaparkan artikel dari master side
By abdkode Wed 20 Feb 2019 6:53 pm Board Bahasa Language
0
2216
Wed 20 Feb 2019 6:53 pm By abdkode
Module MDFiles Recent 사용 지침과 설명
By wipaporn Wed 20 Feb 2019 6:50 pm Board korean Language - 한국어
0
5551
Wed 20 Feb 2019 6:50 pm By wipaporn
Module MDFiles Categories 사용 지침과 설명
By wipaporn Wed 20 Feb 2019 6:41 pm Board korean Language - 한국어
0
5841
Wed 20 Feb 2019 6:41 pm By wipaporn
Features Review :Mod Lastnews json slider untuk ambil artikel dari Master Site dipaparkan di Web Client secara Slide.
By abdkode Wed 20 Feb 2019 6:11 pm Board Bahasa Language
0
2549
Wed 20 Feb 2019 6:11 pm By abdkode
Component MJForm 사용 지침과 설명
By wipaporn Wed 20 Feb 2019 5:59 pm Board korean Language - 한국어
0
5648
Wed 20 Feb 2019 5:59 pm By wipaporn
Features Review : M Multisite Content untuk mengedarkan data dari Master Site ke Webclient
By abdkode Wed 20 Feb 2019 5:23 pm Board Bahasa Language
0
5356
Wed 20 Feb 2019 5:23 pm By abdkode