SlideShare ist ein Scribd-Unternehmen logo
1 von 65
Downloaden Sie, um offline zu lesen
Enrich your extensions with
   Joomla! ACL support
               Sander Potjer
                   @sanderpotjer


       J	
  and	
  Beyond	
  -­‐	
  May	
  20,	
  2012
Sander Potjer?
Twitter:
@sanderpotjer

E-mail:
sander@sanderpotjer.nl

Slides:
http://www.slideshare.net/sanderpotjer/
Joomla! ACL
It took a while...
                                                                      DrupalCon, October 2005
                                                                          Johan Janssens




• http://www.slideshare.net/JohanJanssens/drupalcon-2005-joomla-drupal-and-you-presentation
ACL?!?!
ACL = Access Control List
ACL?!?!
ACL = Access Control List

Access to parts of the website
– e.g. menu / module visibility
– “view” action
ACL?!?!
ACL = Access Control List

Access to parts of the website
– e.g. menu / module visibility
– “view” action


User actions on objects
example: create / edit / edit state / delete article
ACL?!?!
ACL = Access Control List

Access to parts of the website
– e.g. menu / module visibility
– “view” action


User actions on objects
example: create / edit / edit state / delete article
Joomla! 2.5
ACL Overview
• http://community.joomla.org/blogs/community/1252-16-acl.html
• http://community.joomla.org/blogs/community/1252-16-acl.html
User
       • Guest is also a
         ‘user’

       • Users can be
         assigned to one or
         multiple groups
• http://community.joomla.org/blogs/community/1252-16-acl.html
Permissions
Assigned to group (not to a user!)

                                     10 Actions
                                     – Site Login
                                     – Admin Login
                                     – Offline Access (since 1.7)
                                     – Super Admin / Configure
                                     – Access Administration
                                       Interface
                                     – Create
                                     – Delete
                                     – Edit
                                     – Edit State
                                     – Edit Own
• http://community.joomla.org/blogs/community/1252-16-acl.html
Group

        • Users with same permissions

        • Inherited permissions from
          parent groups

        • Unlimited nested groups

        • Keep it simple! Only use
          nested groups if needed
• http://community.joomla.org/blogs/community/1252-16-acl.html
Access Level

               • What is visible for the group
                 (article, menu, module, etc.)

               • Permissions are inherit
                 between Access Levels

               • Even Super Users can not
                 view content on frontend if
                 not assigned
• http://community.joomla.org/blogs/community/1252-16-acl.html
Permissions Settings
 4 possible permission settings

– Not Set

– Inherited

– Allowed

– Denied
Permission Hierarchy (levels)
Level 1: Global configuration
– default permissions settings for actions for a group
Permission Hierarchy (levels)
Level 1: Global configuration
– default permissions settings for actions for a group
Level 2: Component Options
– can override the permissions of Level 1
Permission Hierarchy (levels)
Level 1: Global configuration
– default permissions settings for actions for a group
Level 2: Component Options
– can override the permissions of Level 1
Level 3: Category
– can override the permissions of Level 1 & Level 2
– available for components with categories (Articles, Banners, etc...)
Permission Hierarchy (levels)
Level 1: Global configuration
– default permissions settings for actions for a group
Level 2: Component Options
– can override the permissions of Level 1
Level 3: Category
– can override the permissions of Level 1 & Level 2
– available for components with categories (Articles, Banners, etc...)
Level 4: Item
– can override the permissions of Level 1 & Level 2 & Level 3
– only available for article manager in Joomla core
Permission Hierarchy (levels)
Level 1: Global configuration
– default permissions settings for actions for a group
Level 2: Component Options
– can override the permissions of Level 1
Level 3: Category
– can override the permissions of Level 1 & Level 2
– available for components with categories (Articles, Banners, etc...)
Level 4: Item
– can override the permissions of Level 1 & Level 2 & Level 3
– only available for article manager in Joomla core
Override permissions of higher levels only works if
permission setting is not ‘Denied’!
Inheriting example for ‘Create’ Action


   Level 1



   Level 2



   Level 3



   Level 4



• http://www.theartofjoomla.com/home/5-commentary/84-introducing-the-new-permissions-in-joomla-16.html
Database: #__assets
Database: #__assets: rules names
10 Actions:
– Site Login: core.login.site
– Admin Login: core.login.admin
– Offline Access: core.login.offline
– Super Admin / Configure: core.admin
– Access Administration Interface: core.manager
– Create: core.create
– Delete: core.delete
– Edit: core.edit
– Edit State: core.edit.state
– Edit Own: core.edit.own
Database: #__assets: rules values
Permissions values “Null”, ‘0’ and ‘1’
– Null: Not Set or Inherited
– 0: Denied
– 1: Allowed
Database: #__assets: rules format




   {"core.login.site":{"6":1,"2":1}
Database: #__assets: name format




     com_content.category.19
Database: #__assets
Joomla Basic ACL support
2 actions required
Configure
To configure the access settings via the 'Options' toolbar button

Access Administration Interface
To define which group is able to access/manage the component
18 lines of code
     4 steps
couple minutes
1. Add/modify config.xml
File: administrator/components/com_foobar/config.xml

<?xml version="1.0" encoding="utf-8"?>
<config>
    <fieldset name="permissions" label="JCONFIG_PERMISSIONS_LABEL"
description="JCONFIG_PERMISSIONS_DESC">
         <field name="rules" type="rules"
label="JCONFIG_PERMISSIONS_LABEL" filter="rules"
component="com_foobar" section="component">
              <action name="core.admin" title="JACTION_ADMIN"
description="JACTION_ADMIN_COMPONENT_DESC" />
              <action name="core.manage" title="JACTION_MANAGE"
description="JACTION_MANAGE_COMPONENT_DESC" />
         </field>
    </fieldset>
</config>
2. Add access check
File: administrator/components/com_foobar/foobar.php

defined('_JEXEC') or die('Restricted access');

// Access check.
if (!JFactory::getUser()->authorise('core.manage', 'com_foobar')) {
      return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR'));
}
3. Add the 'Options' toolbar button
File: administrator/components/com_foobar/views/foobars/view.html.php

// Options button.
if (JFactory::getUser()->authorise('core.admin', 'com_foobar')) {
      JToolBarHelper::preferences('com_foobar');
}
4. Add one language string
File: administrator/language/en-GB/en-GB.com_foobar.ini

COM_FOOBAR_CONFIGURATION="FooBar Options"
That’s all!
Actually, basic ACL support is
 not optional, it should be a
 requirement for a “native”
   Joomla 2.5 extension.
Adding custom actions
Adding custom actions
    Example: administrator/components/com_foobar/access.xml



<?xml version="1.0" encoding="utf-8" ?>
<access component="com_helloworld">
!     <section name="component">
!     !     <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="foobar.delete.own" title="FOOBAR_DELETE_OWN" description="FOOBAR_DELETE_OWN_DESC" />
!     </section>
!     <section name="message">
!     !     <action name="core.delete" title="JACTION_DELETE" description="COM_HELLOWORLD_ACCESS_DELETE_DESC" />
!     !     <action name="core.edit" title="JACTION_EDIT" description="COM_HELLOWORLD_ACCESS_EDIT_DESC" />
            <action name="foobar.delete.own" title="FOOBAR_DELETE_OWN" description="FOOBAR_DELETE_OWN_DESC" />
!     </section>
</access>
Adding custom actions
   Example: administrator/components/com_foobar/config.xml
<?xml version="1.0" encoding="utf-8"?>
<config>
!      <fieldset
!      !      name="greetings"
!      !      label="COM_FOOBAR_CONFIG_GREETING_SETTINGS_LABEL"
!      !      description="COM_FOOBAR_CONFIG_GREETING_SETTINGS_DESC"
!      >
!      !      <field
!      !      !      name="show_category"
!      !      !      type="radio"
!      !      !      label="COM_FOOBAR_HELLOWORLD_FIELD_SHOW_CATEGORY_LABEL"
!      !      !      description="COM_FOOBAR_HELLOWORLD_FIELD_SHOW_CATEGORY_DESC"
!      !      !      default="0"
!      !      >
!      !      !      <option value="0">JHIDE</option>
!      !      !      <option value="1">JSHOW</option>
!      !      </field>
!      </fieldset>
!      <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_foobar"
!      !      !      section="component"
!      !      />
!      </fieldset>
</config>
Extension X (not so good) example
Extension X (not so good) example
Extension X (not so good) example
Extension X (not so good) example
Action check
Simple action check
File: administrator/components/com_foobar/views/foobars/view.html.php

// Options button.
if (JFactory::getUser()->authorise('core.admin', 'com_foobar')) {
      JToolBarHelper::preferences('com_foobar');
}
Multiple action check
    File: administrator/components/com_foobar/views/foobars/view.html.php
    /**
!     * Setting the toolbar
!     */
!   protected function addToolBar()
!   {
!   !     $canDo = FoobarHelper::getActions();
!   !     JToolBarHelper::title(JText::_('COM_FOOBAR_MANAGER_HELLOWORLDS'), 'foobar');
!   !     if ($canDo->get('core.create'))
!   !     {
!   !     !     JToolBarHelper::addNew('foobar.add', 'JTOOLBAR_NEW');
!   !     }
!   !     if ($canDo->get('core.edit'))
!   !     {
!   !     !     JToolBarHelper::editList('foobar.edit', 'JTOOLBAR_EDIT');
!   !     }
!   !     if (($canDo->get('core.delete')) || ($canDo->get('foobar.delete.own')))
!   !     {
!   !     !     JToolBarHelper::deleteList('', 'foobar.delete', 'JTOOLBAR_DELETE');
!   !     }
!   !     if ($canDo->get('core.admin'))
!   !     {
!   !     !     JToolBarHelper::divider();
!   !     !     JToolBarHelper::preferences('com_foobar');
!   !     }
!   }
Multiple action check
    File: administrator/components/com_foobar/helpers/foobar.php
    /**
!     * Get the actions
!     */
!   public static function getActions($messageId = 0)
!   {!
!   !     jimport('joomla.access.access');
!   !     $user !    = JFactory::getUser();
!   !     $result!   = new JObject;

!   !    if (empty($messageId)) {
!   !    !    $assetName = 'com_foobar';
!   !    }
!   !    else {
!   !    !    $assetName = 'com_foobar.message.'.(int) $messageId;
!   !    }

!   !    $actions = JAccess::getActions('com_foobar', 'component');

!   !    foreach ($actions as $action) {
!   !    !    $result->set($action->name, $user->authorise($action->name, $assetName));
!   !    }

!   !    return $result;
!   }
Multiple action check
File: administrator/components/com_content/helpers/content.php
Displaying permission
      interface
Display permission interface
  File: administrator/components/com_foobar/views/foobar/tmpl/edit.php

 <?php if ($this->canDo->get('core.admin')): ?>
      <div class="width-100 fltlft">
         <?php echo JHtml::_('sliders.start', 'permissions-sliders-'.$this->item->id,
array('useCookie'=>1)); ?>

              <?php echo JHtml::_('sliders.panel', JText::_('COM_HELLOWORLD_FIELDSET_RULES'), 'access-
rules'); ?>
              <fieldset class="panelform">
                 <?php echo $this->form->getLabel('rules'); ?>
                 <?php echo $this->form->getInput('rules'); ?>
              </fieldset>

         <?php echo JHtml::_('sliders.end'); ?>
      </div>
   <?php endif; ?>
Display permission interface
File: administrator/components/com_foobar/views/foobar/tmpl/edit.php
Usage examples in MVC
Usage examples - Model
File: administrator/components/com_content/models/article.php
Usage examples - Model
File: administrator/components/com_content/models/articles.php
Usage examples - View
File: administrator/components/com_content/views/articles/tmpl/default.php
Usage examples - View
File: administrator/components/com_content/views/articles/tmpl/default.php
Usage examples - Controller
File: administrator/components/com_content/controllers/articles.php
Be Creative!
Resources
• http://www.aclmanager.net/news/general/28-is-your-extension-really-
    joomla-17-ready
•   http://www.aclmanager.net/news/general/31-how-to-add-basic-acl-support-to-
    your-extension
•   http://docs.joomla.org/Developing_a_Model-View-
    Controller_(MVC)_Component_for_Joomla!2.5_-_Part_14
•   http://docs.joomla.org/How_to_implement_actions_in_your_code
•   http://community.joomla.org/blogs/community/1252-16-acl.html
•   http://docs.joomla.org/ACL_Tutorial_for_Joomla_1.6
•   http://docs.joomla.org/Access_Control_System_In_Joomla_1.6
•   http://magazine.joomla.org/issues/Issue-May-2012/item/761-Joomla-ACL-
    Configuring-back-end

Weitere ähnliche Inhalte

Was ist angesagt?

Intro to Joomla Development
Intro to Joomla DevelopmentIntro to Joomla Development
Intro to Joomla DevelopmentAlex Andreae
 
Comparing Joomla CCKs
Comparing Joomla CCKsComparing Joomla CCKs
Comparing Joomla CCKsJustin Herrin
 
Improving Joomla’s Backend User Experience
Improving Joomla’s Backend User ExperienceImproving Joomla’s Backend User Experience
Improving Joomla’s Backend User ExperienceRandy Carey
 
Многопользовательские проекты на WordPress
Многопользовательские проекты на WordPressМногопользовательские проекты на WordPress
Многопользовательские проекты на WordPressNikolay Mironov
 
Justin Herrin Comparing Joomla CCKs from jd12ne
Justin Herrin Comparing Joomla CCKs from jd12neJustin Herrin Comparing Joomla CCKs from jd12ne
Justin Herrin Comparing Joomla CCKs from jd12neJustin Herrin
 
Extending eZ Platform v2 with Symfony and React
Extending eZ Platform v2 with Symfony and ReactExtending eZ Platform v2 with Symfony and React
Extending eZ Platform v2 with Symfony and ReacteZ Systems
 
Clase 19 roles modificada
Clase 19 roles   modificadaClase 19 roles   modificada
Clase 19 roles modificadaTitiushko Jazz
 
Customizing the Django Admin
Customizing the Django AdminCustomizing the Django Admin
Customizing the Django AdminLincoln Loop
 
PLAT-14 Forms Config, Customization, and Extension
PLAT-14 Forms Config, Customization, and ExtensionPLAT-14 Forms Config, Customization, and Extension
PLAT-14 Forms Config, Customization, and ExtensionAlfresco Software
 
Android ActionBar Navigation reloaded
Android ActionBar Navigation reloadedAndroid ActionBar Navigation reloaded
Android ActionBar Navigation reloadedDominik Helleberg
 

Was ist angesagt? (13)

WordPress 3.3 Feature Tour
WordPress 3.3 Feature TourWordPress 3.3 Feature Tour
WordPress 3.3 Feature Tour
 
Critical extensions
Critical extensionsCritical extensions
Critical extensions
 
Intro to Joomla Development
Intro to Joomla DevelopmentIntro to Joomla Development
Intro to Joomla Development
 
Comparing Joomla CCKs
Comparing Joomla CCKsComparing Joomla CCKs
Comparing Joomla CCKs
 
Improving Joomla’s Backend User Experience
Improving Joomla’s Backend User ExperienceImproving Joomla’s Backend User Experience
Improving Joomla’s Backend User Experience
 
Многопользовательские проекты на WordPress
Многопользовательские проекты на WordPressМногопользовательские проекты на WordPress
Многопользовательские проекты на WordPress
 
Justin Herrin Comparing Joomla CCKs from jd12ne
Justin Herrin Comparing Joomla CCKs from jd12neJustin Herrin Comparing Joomla CCKs from jd12ne
Justin Herrin Comparing Joomla CCKs from jd12ne
 
Extending eZ Platform v2 with Symfony and React
Extending eZ Platform v2 with Symfony and ReactExtending eZ Platform v2 with Symfony and React
Extending eZ Platform v2 with Symfony and React
 
Clase 19 roles modificada
Clase 19 roles   modificadaClase 19 roles   modificada
Clase 19 roles modificada
 
Customizing the Django Admin
Customizing the Django AdminCustomizing the Django Admin
Customizing the Django Admin
 
PLAT-14 Forms Config, Customization, and Extension
PLAT-14 Forms Config, Customization, and ExtensionPLAT-14 Forms Config, Customization, and Extension
PLAT-14 Forms Config, Customization, and Extension
 
Loi code mahoa
Loi code mahoaLoi code mahoa
Loi code mahoa
 
Android ActionBar Navigation reloaded
Android ActionBar Navigation reloadedAndroid ActionBar Navigation reloaded
Android ActionBar Navigation reloaded
 

Ähnlich wie Enrich your extensions with Joomla! ACL support

Joomla! ACL - Joomla!Day Germany
Joomla! ACL - Joomla!Day GermanyJoomla! ACL - Joomla!Day Germany
Joomla! ACL - Joomla!Day GermanySander Potjer
 
Joomla ACL introduction, limit site access
Joomla ACL introduction, limit site accessJoomla ACL introduction, limit site access
Joomla ACL introduction, limit site accessSander Potjer
 
Make your extension more powerful by implementing Joomla ACL - J and Beyond 2014
Make your extension more powerful by implementing Joomla ACL - J and Beyond 2014Make your extension more powerful by implementing Joomla ACL - J and Beyond 2014
Make your extension more powerful by implementing Joomla ACL - J and Beyond 2014Sander Potjer
 
Joomla 2.5 ACL @ Dutch Joomla!Days #jd12nl
Joomla 2.5 ACL @ Dutch Joomla!Days #jd12nlJoomla 2.5 ACL @ Dutch Joomla!Days #jd12nl
Joomla 2.5 ACL @ Dutch Joomla!Days #jd12nlSander Potjer
 
Cutting corners from a wheel -
Cutting corners from a wheel - Cutting corners from a wheel -
Cutting corners from a wheel - kauselot
 
Cairo meetup low code best practices
Cairo meetup low code best practicesCairo meetup low code best practices
Cairo meetup low code best practicesAhmed Keshk
 
Modules and Components Introduction in Joomla! 2.5
Modules and Components Introduction in Joomla! 2.5Modules and Components Introduction in Joomla! 2.5
Modules and Components Introduction in Joomla! 2.5Vishwash Gaur
 
Alfresco : Implementing Membership and Security
Alfresco  : Implementing Membership and Security	Alfresco  : Implementing Membership and Security
Alfresco : Implementing Membership and Security Wildan Maulana
 
Techgig Webinar: Joomla Introduction and Module Development June 2012
Techgig Webinar: Joomla Introduction and Module Development June 2012Techgig Webinar: Joomla Introduction and Module Development June 2012
Techgig Webinar: Joomla Introduction and Module Development June 2012Vishwash Gaur
 
Creating Custom Templates for Joomla! 2.5
Creating Custom Templates for Joomla! 2.5Creating Custom Templates for Joomla! 2.5
Creating Custom Templates for Joomla! 2.5Don Cranford
 
Simple module Development in Joomla! 2.5
Simple module Development in Joomla! 2.5Simple module Development in Joomla! 2.5
Simple module Development in Joomla! 2.5Vishwash Gaur
 
24 - Panorama Necto 14 administration - visualization & data discovery solution
24  - Panorama Necto 14 administration - visualization & data discovery solution24  - Panorama Necto 14 administration - visualization & data discovery solution
24 - Panorama Necto 14 administration - visualization & data discovery solutionPanorama Software
 
Mageguru - magento custom module development
Mageguru -  magento custom module development Mageguru -  magento custom module development
Mageguru - magento custom module development Mage Guru
 
Improving joomla's backend user experience
Improving joomla's backend user experienceImproving joomla's backend user experience
Improving joomla's backend user experienceLuke Summerfield
 

Ähnlich wie Enrich your extensions with Joomla! ACL support (20)

Joomla! ACL - Joomla!Day Germany
Joomla! ACL - Joomla!Day GermanyJoomla! ACL - Joomla!Day Germany
Joomla! ACL - Joomla!Day Germany
 
Joomla ACL introduction, limit site access
Joomla ACL introduction, limit site accessJoomla ACL introduction, limit site access
Joomla ACL introduction, limit site access
 
Make your extension more powerful by implementing Joomla ACL - J and Beyond 2014
Make your extension more powerful by implementing Joomla ACL - J and Beyond 2014Make your extension more powerful by implementing Joomla ACL - J and Beyond 2014
Make your extension more powerful by implementing Joomla ACL - J and Beyond 2014
 
Joomla 2.5 ACL @ Dutch Joomla!Days #jd12nl
Joomla 2.5 ACL @ Dutch Joomla!Days #jd12nlJoomla 2.5 ACL @ Dutch Joomla!Days #jd12nl
Joomla 2.5 ACL @ Dutch Joomla!Days #jd12nl
 
Cutting corners from a wheel -
Cutting corners from a wheel - Cutting corners from a wheel -
Cutting corners from a wheel -
 
Cairo meetup low code best practices
Cairo meetup low code best practicesCairo meetup low code best practices
Cairo meetup low code best practices
 
Joomla Overview
Joomla OverviewJoomla Overview
Joomla Overview
 
Modules and Components Introduction in Joomla! 2.5
Modules and Components Introduction in Joomla! 2.5Modules and Components Introduction in Joomla! 2.5
Modules and Components Introduction in Joomla! 2.5
 
What's new in Joomla 1.6?
What's new in Joomla 1.6?What's new in Joomla 1.6?
What's new in Joomla 1.6?
 
Using advanced features in joomla
Using advanced features in joomlaUsing advanced features in joomla
Using advanced features in joomla
 
Alfresco : Implementing Membership and Security
Alfresco  : Implementing Membership and Security	Alfresco  : Implementing Membership and Security
Alfresco : Implementing Membership and Security
 
Techgig Webinar: Joomla Introduction and Module Development June 2012
Techgig Webinar: Joomla Introduction and Module Development June 2012Techgig Webinar: Joomla Introduction and Module Development June 2012
Techgig Webinar: Joomla Introduction and Module Development June 2012
 
Creating Custom Templates for Joomla! 2.5
Creating Custom Templates for Joomla! 2.5Creating Custom Templates for Joomla! 2.5
Creating Custom Templates for Joomla! 2.5
 
Simple module Development in Joomla! 2.5
Simple module Development in Joomla! 2.5Simple module Development in Joomla! 2.5
Simple module Development in Joomla! 2.5
 
Joomla Presentations
Joomla PresentationsJoomla Presentations
Joomla Presentations
 
Java Server Faces
Java Server FacesJava Server Faces
Java Server Faces
 
Joomla Day1
Joomla  Day1Joomla  Day1
Joomla Day1
 
24 - Panorama Necto 14 administration - visualization & data discovery solution
24  - Panorama Necto 14 administration - visualization & data discovery solution24  - Panorama Necto 14 administration - visualization & data discovery solution
24 - Panorama Necto 14 administration - visualization & data discovery solution
 
Mageguru - magento custom module development
Mageguru -  magento custom module development Mageguru -  magento custom module development
Mageguru - magento custom module development
 
Improving joomla's backend user experience
Improving joomla's backend user experienceImproving joomla's backend user experience
Improving joomla's backend user experience
 

Mehr von Sander Potjer

Daarom Joomla! - Makkelijk content publiceren
Daarom Joomla! - Makkelijk content publicerenDaarom Joomla! - Makkelijk content publiceren
Daarom Joomla! - Makkelijk content publicerenSander Potjer
 
Daarom Joomla! - Inspiratie uit de praktijk
Daarom Joomla! - Inspiratie uit de praktijkDaarom Joomla! - Inspiratie uit de praktijk
Daarom Joomla! - Inspiratie uit de praktijkSander Potjer
 
Daarom Joomla! - Een fantastische basis
Daarom Joomla! - Een fantastische basisDaarom Joomla! - Een fantastische basis
Daarom Joomla! - Een fantastische basisSander Potjer
 
Performance budget @ Joomla! Performance Expert Sessie
Performance budget @ Joomla! Performance Expert SessiePerformance budget @ Joomla! Performance Expert Sessie
Performance budget @ Joomla! Performance Expert SessieSander Potjer
 
Technieken & tools @ Joomla! Performance Expert Sessie
Technieken & tools @ Joomla! Performance Expert SessieTechnieken & tools @ Joomla! Performance Expert Sessie
Technieken & tools @ Joomla! Performance Expert SessieSander Potjer
 
CDN @ Joomla! Performance Expert Sessie
CDN @ Joomla! Performance Expert SessieCDN @ Joomla! Performance Expert Sessie
CDN @ Joomla! Performance Expert SessieSander Potjer
 
Proxy caching @ Joomla! Performance Expert Sessie
Proxy caching @ Joomla! Performance Expert SessieProxy caching @ Joomla! Performance Expert Sessie
Proxy caching @ Joomla! Performance Expert SessieSander Potjer
 
Server performance @ Joomla! Performance Expert Sessie
Server performance @ Joomla! Performance Expert SessieServer performance @ Joomla! Performance Expert Sessie
Server performance @ Joomla! Performance Expert SessieSander Potjer
 
.htaccess performance @ Joomla! Performance Expert Sessie
.htaccess performance @ Joomla! Performance Expert Sessie.htaccess performance @ Joomla! Performance Expert Sessie
.htaccess performance @ Joomla! Performance Expert SessieSander Potjer
 
Google AMP @ Joomla! Performance Expert Sessie
Google AMP @ Joomla! Performance Expert SessieGoogle AMP @ Joomla! Performance Expert Sessie
Google AMP @ Joomla! Performance Expert SessieSander Potjer
 
Optimaliseer afbeeldingen @ Joomla! Performance Expert Sessie
Optimaliseer afbeeldingen @ Joomla! Performance Expert SessieOptimaliseer afbeeldingen @ Joomla! Performance Expert Sessie
Optimaliseer afbeeldingen @ Joomla! Performance Expert SessieSander Potjer
 
Optimalisatie plugins @ Joomla! Performance Expert Sessie
Optimalisatie plugins @ Joomla! Performance Expert SessieOptimalisatie plugins @ Joomla! Performance Expert Sessie
Optimalisatie plugins @ Joomla! Performance Expert SessieSander Potjer
 
Cache handlers @ Joomla! Performance Expert Sessie
Cache handlers @ Joomla! Performance Expert SessieCache handlers @ Joomla! Performance Expert Sessie
Cache handlers @ Joomla! Performance Expert SessieSander Potjer
 
Performance & Joomla! core @ Joomla! Performance Expert Sessie
Performance & Joomla! core @ Joomla! Performance Expert SessiePerformance & Joomla! core @ Joomla! Performance Expert Sessie
Performance & Joomla! core @ Joomla! Performance Expert SessieSander Potjer
 
Joomla! First - JoomlaDagen 2017 #jd17nl
Joomla! First - JoomlaDagen 2017 #jd17nlJoomla! First - JoomlaDagen 2017 #jd17nl
Joomla! First - JoomlaDagen 2017 #jd17nlSander Potjer
 
Complexe pagina's gebruiksvriendelijk (Joomla Page Builders)
Complexe pagina's gebruiksvriendelijk (Joomla Page Builders)Complexe pagina's gebruiksvriendelijk (Joomla Page Builders)
Complexe pagina's gebruiksvriendelijk (Joomla Page Builders)Sander Potjer
 
Performance & SEO - Joomla SEO Expert Sessie
Performance & SEO - Joomla SEO Expert SessiePerformance & SEO - Joomla SEO Expert Sessie
Performance & SEO - Joomla SEO Expert SessieSander Potjer
 
Social Media & SEO - Joomla SEO Expert Sessie
Social Media & SEO - Joomla SEO Expert SessieSocial Media & SEO - Joomla SEO Expert Sessie
Social Media & SEO - Joomla SEO Expert SessieSander Potjer
 
Joomla 3.6: nieuwe router - Joomla SEO Expert Sessie
Joomla 3.6: nieuwe router - Joomla SEO Expert SessieJoomla 3.6: nieuwe router - Joomla SEO Expert Sessie
Joomla 3.6: nieuwe router - Joomla SEO Expert SessieSander Potjer
 
SEO Audit - Joomla SEO Expert Sessie
SEO Audit - Joomla SEO Expert SessieSEO Audit - Joomla SEO Expert Sessie
SEO Audit - Joomla SEO Expert SessieSander Potjer
 

Mehr von Sander Potjer (20)

Daarom Joomla! - Makkelijk content publiceren
Daarom Joomla! - Makkelijk content publicerenDaarom Joomla! - Makkelijk content publiceren
Daarom Joomla! - Makkelijk content publiceren
 
Daarom Joomla! - Inspiratie uit de praktijk
Daarom Joomla! - Inspiratie uit de praktijkDaarom Joomla! - Inspiratie uit de praktijk
Daarom Joomla! - Inspiratie uit de praktijk
 
Daarom Joomla! - Een fantastische basis
Daarom Joomla! - Een fantastische basisDaarom Joomla! - Een fantastische basis
Daarom Joomla! - Een fantastische basis
 
Performance budget @ Joomla! Performance Expert Sessie
Performance budget @ Joomla! Performance Expert SessiePerformance budget @ Joomla! Performance Expert Sessie
Performance budget @ Joomla! Performance Expert Sessie
 
Technieken & tools @ Joomla! Performance Expert Sessie
Technieken & tools @ Joomla! Performance Expert SessieTechnieken & tools @ Joomla! Performance Expert Sessie
Technieken & tools @ Joomla! Performance Expert Sessie
 
CDN @ Joomla! Performance Expert Sessie
CDN @ Joomla! Performance Expert SessieCDN @ Joomla! Performance Expert Sessie
CDN @ Joomla! Performance Expert Sessie
 
Proxy caching @ Joomla! Performance Expert Sessie
Proxy caching @ Joomla! Performance Expert SessieProxy caching @ Joomla! Performance Expert Sessie
Proxy caching @ Joomla! Performance Expert Sessie
 
Server performance @ Joomla! Performance Expert Sessie
Server performance @ Joomla! Performance Expert SessieServer performance @ Joomla! Performance Expert Sessie
Server performance @ Joomla! Performance Expert Sessie
 
.htaccess performance @ Joomla! Performance Expert Sessie
.htaccess performance @ Joomla! Performance Expert Sessie.htaccess performance @ Joomla! Performance Expert Sessie
.htaccess performance @ Joomla! Performance Expert Sessie
 
Google AMP @ Joomla! Performance Expert Sessie
Google AMP @ Joomla! Performance Expert SessieGoogle AMP @ Joomla! Performance Expert Sessie
Google AMP @ Joomla! Performance Expert Sessie
 
Optimaliseer afbeeldingen @ Joomla! Performance Expert Sessie
Optimaliseer afbeeldingen @ Joomla! Performance Expert SessieOptimaliseer afbeeldingen @ Joomla! Performance Expert Sessie
Optimaliseer afbeeldingen @ Joomla! Performance Expert Sessie
 
Optimalisatie plugins @ Joomla! Performance Expert Sessie
Optimalisatie plugins @ Joomla! Performance Expert SessieOptimalisatie plugins @ Joomla! Performance Expert Sessie
Optimalisatie plugins @ Joomla! Performance Expert Sessie
 
Cache handlers @ Joomla! Performance Expert Sessie
Cache handlers @ Joomla! Performance Expert SessieCache handlers @ Joomla! Performance Expert Sessie
Cache handlers @ Joomla! Performance Expert Sessie
 
Performance & Joomla! core @ Joomla! Performance Expert Sessie
Performance & Joomla! core @ Joomla! Performance Expert SessiePerformance & Joomla! core @ Joomla! Performance Expert Sessie
Performance & Joomla! core @ Joomla! Performance Expert Sessie
 
Joomla! First - JoomlaDagen 2017 #jd17nl
Joomla! First - JoomlaDagen 2017 #jd17nlJoomla! First - JoomlaDagen 2017 #jd17nl
Joomla! First - JoomlaDagen 2017 #jd17nl
 
Complexe pagina's gebruiksvriendelijk (Joomla Page Builders)
Complexe pagina's gebruiksvriendelijk (Joomla Page Builders)Complexe pagina's gebruiksvriendelijk (Joomla Page Builders)
Complexe pagina's gebruiksvriendelijk (Joomla Page Builders)
 
Performance & SEO - Joomla SEO Expert Sessie
Performance & SEO - Joomla SEO Expert SessiePerformance & SEO - Joomla SEO Expert Sessie
Performance & SEO - Joomla SEO Expert Sessie
 
Social Media & SEO - Joomla SEO Expert Sessie
Social Media & SEO - Joomla SEO Expert SessieSocial Media & SEO - Joomla SEO Expert Sessie
Social Media & SEO - Joomla SEO Expert Sessie
 
Joomla 3.6: nieuwe router - Joomla SEO Expert Sessie
Joomla 3.6: nieuwe router - Joomla SEO Expert SessieJoomla 3.6: nieuwe router - Joomla SEO Expert Sessie
Joomla 3.6: nieuwe router - Joomla SEO Expert Sessie
 
SEO Audit - Joomla SEO Expert Sessie
SEO Audit - Joomla SEO Expert SessieSEO Audit - Joomla SEO Expert Sessie
SEO Audit - Joomla SEO Expert Sessie
 

Kürzlich hochgeladen

Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilV3cube
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 

Kürzlich hochgeladen (20)

Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 

Enrich your extensions with Joomla! ACL support

  • 1. Enrich your extensions with Joomla! ACL support Sander Potjer @sanderpotjer J  and  Beyond  -­‐  May  20,  2012
  • 4. It took a while... DrupalCon, October 2005 Johan Janssens • http://www.slideshare.net/JohanJanssens/drupalcon-2005-joomla-drupal-and-you-presentation
  • 5. ACL?!?! ACL = Access Control List
  • 6. ACL?!?! ACL = Access Control List Access to parts of the website – e.g. menu / module visibility – “view” action
  • 7. ACL?!?! ACL = Access Control List Access to parts of the website – e.g. menu / module visibility – “view” action User actions on objects example: create / edit / edit state / delete article
  • 8. ACL?!?! ACL = Access Control List Access to parts of the website – e.g. menu / module visibility – “view” action User actions on objects example: create / edit / edit state / delete article
  • 12. User • Guest is also a ‘user’ • Users can be assigned to one or multiple groups
  • 14. Permissions Assigned to group (not to a user!) 10 Actions – Site Login – Admin Login – Offline Access (since 1.7) – Super Admin / Configure – Access Administration Interface – Create – Delete – Edit – Edit State – Edit Own
  • 16. Group • Users with same permissions • Inherited permissions from parent groups • Unlimited nested groups • Keep it simple! Only use nested groups if needed
  • 18. Access Level • What is visible for the group (article, menu, module, etc.) • Permissions are inherit between Access Levels • Even Super Users can not view content on frontend if not assigned
  • 20. Permissions Settings 4 possible permission settings – Not Set – Inherited – Allowed – Denied
  • 21. Permission Hierarchy (levels) Level 1: Global configuration – default permissions settings for actions for a group
  • 22. Permission Hierarchy (levels) Level 1: Global configuration – default permissions settings for actions for a group Level 2: Component Options – can override the permissions of Level 1
  • 23. Permission Hierarchy (levels) Level 1: Global configuration – default permissions settings for actions for a group Level 2: Component Options – can override the permissions of Level 1 Level 3: Category – can override the permissions of Level 1 & Level 2 – available for components with categories (Articles, Banners, etc...)
  • 24. Permission Hierarchy (levels) Level 1: Global configuration – default permissions settings for actions for a group Level 2: Component Options – can override the permissions of Level 1 Level 3: Category – can override the permissions of Level 1 & Level 2 – available for components with categories (Articles, Banners, etc...) Level 4: Item – can override the permissions of Level 1 & Level 2 & Level 3 – only available for article manager in Joomla core
  • 25. Permission Hierarchy (levels) Level 1: Global configuration – default permissions settings for actions for a group Level 2: Component Options – can override the permissions of Level 1 Level 3: Category – can override the permissions of Level 1 & Level 2 – available for components with categories (Articles, Banners, etc...) Level 4: Item – can override the permissions of Level 1 & Level 2 & Level 3 – only available for article manager in Joomla core Override permissions of higher levels only works if permission setting is not ‘Denied’!
  • 26. Inheriting example for ‘Create’ Action Level 1 Level 2 Level 3 Level 4 • http://www.theartofjoomla.com/home/5-commentary/84-introducing-the-new-permissions-in-joomla-16.html
  • 28. Database: #__assets: rules names 10 Actions: – Site Login: core.login.site – Admin Login: core.login.admin – Offline Access: core.login.offline – Super Admin / Configure: core.admin – Access Administration Interface: core.manager – Create: core.create – Delete: core.delete – Edit: core.edit – Edit State: core.edit.state – Edit Own: core.edit.own
  • 29. Database: #__assets: rules values Permissions values “Null”, ‘0’ and ‘1’ – Null: Not Set or Inherited – 0: Denied – 1: Allowed
  • 30. Database: #__assets: rules format {"core.login.site":{"6":1,"2":1}
  • 31. Database: #__assets: name format com_content.category.19
  • 33. Joomla Basic ACL support
  • 34. 2 actions required Configure To configure the access settings via the 'Options' toolbar button Access Administration Interface To define which group is able to access/manage the component
  • 35. 18 lines of code 4 steps couple minutes
  • 36. 1. Add/modify config.xml File: administrator/components/com_foobar/config.xml <?xml version="1.0" encoding="utf-8"?> <config> <fieldset name="permissions" label="JCONFIG_PERMISSIONS_LABEL" description="JCONFIG_PERMISSIONS_DESC"> <field name="rules" type="rules" label="JCONFIG_PERMISSIONS_LABEL" filter="rules" component="com_foobar" section="component"> <action name="core.admin" title="JACTION_ADMIN" description="JACTION_ADMIN_COMPONENT_DESC" /> <action name="core.manage" title="JACTION_MANAGE" description="JACTION_MANAGE_COMPONENT_DESC" /> </field> </fieldset> </config>
  • 37. 2. Add access check File: administrator/components/com_foobar/foobar.php defined('_JEXEC') or die('Restricted access'); // Access check. if (!JFactory::getUser()->authorise('core.manage', 'com_foobar')) { return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR')); }
  • 38. 3. Add the 'Options' toolbar button File: administrator/components/com_foobar/views/foobars/view.html.php // Options button. if (JFactory::getUser()->authorise('core.admin', 'com_foobar')) { JToolBarHelper::preferences('com_foobar'); }
  • 39. 4. Add one language string File: administrator/language/en-GB/en-GB.com_foobar.ini COM_FOOBAR_CONFIGURATION="FooBar Options"
  • 41.
  • 42. Actually, basic ACL support is not optional, it should be a requirement for a “native” Joomla 2.5 extension.
  • 44. Adding custom actions Example: administrator/components/com_foobar/access.xml <?xml version="1.0" encoding="utf-8" ?> <access component="com_helloworld"> ! <section name="component"> ! ! <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="foobar.delete.own" title="FOOBAR_DELETE_OWN" description="FOOBAR_DELETE_OWN_DESC" /> ! </section> ! <section name="message"> ! ! <action name="core.delete" title="JACTION_DELETE" description="COM_HELLOWORLD_ACCESS_DELETE_DESC" /> ! ! <action name="core.edit" title="JACTION_EDIT" description="COM_HELLOWORLD_ACCESS_EDIT_DESC" /> <action name="foobar.delete.own" title="FOOBAR_DELETE_OWN" description="FOOBAR_DELETE_OWN_DESC" /> ! </section> </access>
  • 45. Adding custom actions Example: administrator/components/com_foobar/config.xml <?xml version="1.0" encoding="utf-8"?> <config> ! <fieldset ! ! name="greetings" ! ! label="COM_FOOBAR_CONFIG_GREETING_SETTINGS_LABEL" ! ! description="COM_FOOBAR_CONFIG_GREETING_SETTINGS_DESC" ! > ! ! <field ! ! ! name="show_category" ! ! ! type="radio" ! ! ! label="COM_FOOBAR_HELLOWORLD_FIELD_SHOW_CATEGORY_LABEL" ! ! ! description="COM_FOOBAR_HELLOWORLD_FIELD_SHOW_CATEGORY_DESC" ! ! ! default="0" ! ! > ! ! ! <option value="0">JHIDE</option> ! ! ! <option value="1">JSHOW</option> ! ! </field> ! </fieldset> ! <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_foobar" ! ! ! section="component" ! ! /> ! </fieldset> </config>
  • 46. Extension X (not so good) example
  • 47. Extension X (not so good) example
  • 48. Extension X (not so good) example
  • 49. Extension X (not so good) example
  • 51. Simple action check File: administrator/components/com_foobar/views/foobars/view.html.php // Options button. if (JFactory::getUser()->authorise('core.admin', 'com_foobar')) { JToolBarHelper::preferences('com_foobar'); }
  • 52. Multiple action check File: administrator/components/com_foobar/views/foobars/view.html.php /** ! * Setting the toolbar ! */ ! protected function addToolBar() ! { ! ! $canDo = FoobarHelper::getActions(); ! ! JToolBarHelper::title(JText::_('COM_FOOBAR_MANAGER_HELLOWORLDS'), 'foobar'); ! ! if ($canDo->get('core.create')) ! ! { ! ! ! JToolBarHelper::addNew('foobar.add', 'JTOOLBAR_NEW'); ! ! } ! ! if ($canDo->get('core.edit')) ! ! { ! ! ! JToolBarHelper::editList('foobar.edit', 'JTOOLBAR_EDIT'); ! ! } ! ! if (($canDo->get('core.delete')) || ($canDo->get('foobar.delete.own'))) ! ! { ! ! ! JToolBarHelper::deleteList('', 'foobar.delete', 'JTOOLBAR_DELETE'); ! ! } ! ! if ($canDo->get('core.admin')) ! ! { ! ! ! JToolBarHelper::divider(); ! ! ! JToolBarHelper::preferences('com_foobar'); ! ! } ! }
  • 53. Multiple action check File: administrator/components/com_foobar/helpers/foobar.php /** ! * Get the actions ! */ ! public static function getActions($messageId = 0) ! {! ! ! jimport('joomla.access.access'); ! ! $user ! = JFactory::getUser(); ! ! $result! = new JObject; ! ! if (empty($messageId)) { ! ! ! $assetName = 'com_foobar'; ! ! } ! ! else { ! ! ! $assetName = 'com_foobar.message.'.(int) $messageId; ! ! } ! ! $actions = JAccess::getActions('com_foobar', 'component'); ! ! foreach ($actions as $action) { ! ! ! $result->set($action->name, $user->authorise($action->name, $assetName)); ! ! } ! ! return $result; ! }
  • 54. Multiple action check File: administrator/components/com_content/helpers/content.php
  • 56. Display permission interface File: administrator/components/com_foobar/views/foobar/tmpl/edit.php <?php if ($this->canDo->get('core.admin')): ?> <div class="width-100 fltlft"> <?php echo JHtml::_('sliders.start', 'permissions-sliders-'.$this->item->id, array('useCookie'=>1)); ?> <?php echo JHtml::_('sliders.panel', JText::_('COM_HELLOWORLD_FIELDSET_RULES'), 'access- rules'); ?> <fieldset class="panelform"> <?php echo $this->form->getLabel('rules'); ?> <?php echo $this->form->getInput('rules'); ?> </fieldset> <?php echo JHtml::_('sliders.end'); ?> </div> <?php endif; ?>
  • 57. Display permission interface File: administrator/components/com_foobar/views/foobar/tmpl/edit.php
  • 59. Usage examples - Model File: administrator/components/com_content/models/article.php
  • 60. Usage examples - Model File: administrator/components/com_content/models/articles.php
  • 61. Usage examples - View File: administrator/components/com_content/views/articles/tmpl/default.php
  • 62. Usage examples - View File: administrator/components/com_content/views/articles/tmpl/default.php
  • 63. Usage examples - Controller File: administrator/components/com_content/controllers/articles.php
  • 65. Resources • http://www.aclmanager.net/news/general/28-is-your-extension-really- joomla-17-ready • http://www.aclmanager.net/news/general/31-how-to-add-basic-acl-support-to- your-extension • http://docs.joomla.org/Developing_a_Model-View- Controller_(MVC)_Component_for_Joomla!2.5_-_Part_14 • http://docs.joomla.org/How_to_implement_actions_in_your_code • http://community.joomla.org/blogs/community/1252-16-acl.html • http://docs.joomla.org/ACL_Tutorial_for_Joomla_1.6 • http://docs.joomla.org/Access_Control_System_In_Joomla_1.6 • http://magazine.joomla.org/issues/Issue-May-2012/item/761-Joomla-ACL- Configuring-back-end