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 : Mhosting Components untuk mengumpul Packet hosting
By abdkode Mon 22 Apr 2019 6:50 pm Board Bahasa Language
0
1927
Mon 22 Apr 2019 6:50 pm By abdkode
Features Review : Components MD Gallery untuk membuat gelari dalam laman web
By abdkode Mon 22 Apr 2019 6:49 pm Board Bahasa Language
0
4153
Mon 22 Apr 2019 6:49 pm By abdkode
3 Investment Worthly in Thaland
By wannapat Tue 19 Mar 2019 4:38 pm Board Chinese Language - 简体中文
0
16352
Tue 19 Mar 2019 4:38 pm By wannapat
Features Review : Plugin Addons Payment Omise untuk membuat pembayaran melalui Omise
By abdkode Mon 11 Mar 2019 6:58 pm Board Bahasa Language
0
2372
Mon 11 Mar 2019 6:58 pm By abdkode
Features Review : Memperkenalkan Mooziicart untuk Joomla
By abdkode Thu 07 Mar 2019 7:06 pm Board Bahasa Language
0
2808
Thu 07 Mar 2019 7:06 pm By abdkode
Features Review : Plugin M Product Match untuk menghungkan produk dengan artikel
By abdkode Thu 07 Mar 2019 6:19 pm Board Bahasa Language
0
2873
Thu 07 Mar 2019 6:19 pm By abdkode
Features Review : Module MD Client History modul memapar sajarah yang telah masuk
By abdkode Tue 05 Mar 2019 7:15 pm Board Bahasa Language
0
2031
Tue 05 Mar 2019 7:15 pm By abdkode
Features Review : Plugin M Animate Number untuk memaparkan nombor yang bergerak
By abdkode Mon 04 Mar 2019 7:02 pm Board Bahasa Language
0
2290
Mon 04 Mar 2019 7:02 pm By abdkode
Features Review : Plugin PayToRead untuk mempaparkan teks hanya sebahagian
By abdkode Mon 04 Mar 2019 7:01 pm Board Bahasa Language
0
2482
Mon 04 Mar 2019 7:01 pm By abdkode
Features Review : Component MFacebook untuk membantu pendaftaran laman web dgn Facebook
By abdkode Mon 04 Mar 2019 6:57 pm Board Bahasa Language
0
3028
Mon 04 Mar 2019 6:57 pm By abdkode
Features Review : MJClone untuk mengklon laman web joomla dan backup
By abdkode Thu 28 Feb 2019 6:59 pm Board Bahasa Language
0
3324
Thu 28 Feb 2019 6:59 pm By abdkode
Features Review : Module Mrelated Article Specific Category untuk menyimpan sejarah lawatan
By abdkode Thu 28 Feb 2019 6:48 pm Board Bahasa Language
1
2160
Tue 27 Oct 2020 6:07 pm By prmindphp
Features Review : Plugin MLinkarticle untuk menghubungkan konten artikel kepada artikel yang berkaitan
By abdkode Tue 26 Feb 2019 6:37 pm Board Bahasa Language
0
2695
Tue 26 Feb 2019 6:37 pm By abdkode
Features Review : Plugin Authentication untuk login Joomla dengan phpBB
By abdkode Tue 26 Feb 2019 6:29 pm Board Bahasa Language
0
3585
Tue 26 Feb 2019 6:29 pm By abdkode
Features Review : untuk menghasilkan link memuat naik video pada artikel, Joomla 2.5, 3.x
By abdkode Tue 26 Feb 2019 5:26 pm Board Bahasa Language
0
2214
Tue 26 Feb 2019 5:26 pm By abdkode
Features Review : Plugin MVDO untuk memuat naik video Youtube dan Clipmass
By abdkode Mon 25 Feb 2019 5:54 pm Board Bahasa Language
0
2499
Mon 25 Feb 2019 5:54 pm By abdkode
Features Review : Content Msocial untuk berkongsi kandungan artikel ke Facebook, Twitter, Google Plus dan Line
By abdkode Mon 25 Feb 2019 4:56 pm Board Bahasa Language
0
2095
Mon 25 Feb 2019 4:56 pm By abdkode
Features Review : Module Mod slideshowck untuk membantu memaparkan imej dan video Youtube secara slaid
By abdkode Mon 25 Feb 2019 2:19 pm Board Bahasa Language
0
2182
Mon 25 Feb 2019 2:19 pm By abdkode
Features Review : Mod MD recent untuk menunjukkan Papan phpbb pada Joomla.
By abdkode Fri 22 Feb 2019 6:59 pm Board Bahasa Language
0
2823
Fri 22 Feb 2019 6:59 pm By abdkode
Features Review : Mod vinaora visitors counter untuk menghitungkan pelewat laman web di joomla
By abdkode Fri 22 Feb 2019 4:17 pm Board Bahasa Language
0
2751
Fri 22 Feb 2019 4:17 pm By abdkode