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
Plugin MDGallery
By MattijsFranken Sun 25 Oct 2020 11:35 pm Board English Language
1
21
Mon 26 Oct 2020 6:31 am By mindphp
Does MD Watermark work under Joomla 3.9.20?
By Balazs Thu 16 Jul 2020 4:48 pm Board English Language
6
851
Thu 16 Jul 2020 10:31 pm By Balazs
The program calculates the PMT
By prmindphp Wed 20 May 2020 6:45 pm Board English Language
1
244
Thu 21 May 2020 5:57 pm By prmindphp
Helper for calculating NPER values
By prmindphp Tue 19 May 2020 6:55 pm Board English Language
1
227
Thu 21 May 2020 5:59 pm By prmindphp
Program that will be used for home loan calculations
By prmindphp Mon 18 May 2020 6:49 pm Board English Language
1
252
Thu 21 May 2020 6:02 pm By prmindphp
Tools that will help calculate car tax
By prmindphp Thu 14 May 2020 7:00 pm Board English Language
1
251
Fri 15 May 2020 12:03 am By prmindphp
Helper to create slidershow, Module Product Slide of MooZiiCart
By prmindphp Thu 30 Apr 2020 6:32 pm Board English Language
0
307
Thu 30 Apr 2020 6:32 pm By prmindphp
Helper in searching products by category and keywords with Module Ajax Search of MooZiiCart
By prmindphp Tue 28 Apr 2020 6:17 pm Board English Language
0
282
Tue 28 Apr 2020 6:17 pm By prmindphp
Helper to restore the system to clear data, Plugin System MRestore
By prmindphp Fri 24 Apr 2020 7:05 pm Board English Language
0
261
Fri 24 Apr 2020 7:05 pm By prmindphp
Creating social share buttons, share the website's content to Social Media With Plugin Content Msocial
By prmindphp Wed 22 Apr 2020 7:05 pm Board English Language
0
246
Wed 22 Apr 2020 7:05 pm By prmindphp
Create Content Marketing and Product with Content Product Match of MooZiiCart
By prmindphp Tue 21 Apr 2020 7:19 pm Board English Language
0
289
Tue 21 Apr 2020 7:19 pm By prmindphp
Filtering for find the product with Module Filter product of MooZiiCart
By prmindphp Thu 09 Apr 2020 6:51 pm Board English Language
0
287
Thu 09 Apr 2020 6:51 pm By prmindphp
Template Megadeal of MooZiiCart for creating websites to sell products online
By prmindphp Fri 03 Apr 2020 6:45 pm Board English Language
0
443
Fri 03 Apr 2020 6:45 pm By prmindphp
[MooZiiCart] [Module] Displaying products that customers are interested by Wishlist Module
By prmindphp Fri 27 Mar 2020 5:46 pm Board English Language
0
684
Fri 27 Mar 2020 5:46 pm By prmindphp
Show the Bestsellers Product by Module Bestseller
By prmindphp Wed 25 Mar 2020 6:04 pm Board English Language
0
446
Wed 25 Mar 2020 6:04 pm By prmindphp
Show Products Category by Module Category
By prmindphp Tue 24 Mar 2020 6:07 pm Board English Language
0
549
Tue 24 Mar 2020 6:07 pm By prmindphp
Plugin System MZC Auto Close to enable the open and close odering system
By prmindphp Wed 19 Feb 2020 6:38 pm Board English Language
0
3142
Wed 19 Feb 2020 6:38 pm By prmindphp
MDPartner Component for store client data in CRM system
By prmindphp Sat 25 Jan 2020 3:04 pm Board English Language
0
905
Sat 25 Jan 2020 3:04 pm By prmindphp
i am looking for help
By Anonymous Tue 14 Jan 2020 5:46 pm Board English Language
1
938
Tue 14 Jan 2020 6:03 pm By noppadonsk
Dot Net Training
By Poonaam Fri 10 Jan 2020 2:20 pm Board English Language
0
1185
Fri 10 Jan 2020 2:20 pm By Poonaam