Source for file group.php

Documentation is available at group.php

  1. <?php
  2. /**
  3.  * @package     Joomla.Administrator
  4.  * @subpackage  com_users
  5.  *
  6.  * @copyright   Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
  7.  * @license     GNU General Public License version 2 or later; see LICENSE.txt
  8.  */
  9.  
  10. defined('_JEXEC'or die;
  11.  
  12. /**
  13.  * User view level controller class.
  14.  *
  15.  * @package     Joomla.Administrator
  16.  * @subpackage  com_users
  17.  * @since       1.6
  18.  */
  19. {
  20.         /**
  21.      * @var        string    The prefix to use with controller messages.
  22.      * @since   1.6
  23.      */
  24.     protected $text_prefix = 'COM_USERS_GROUP';
  25.  
  26.     /**
  27.      * Method to check if you can save a new or existing record.
  28.      *
  29.      * Overrides JControllerForm::allowSave to check the core.admin permission.
  30.      *
  31.      * @param   array  An array of input data.
  32.      * @param   string    The name of the key for the primary key.
  33.      *
  34.      * @return  boolean 
  35.      * @since   1.6
  36.      */
  37.     protected function allowSave($data$key 'id')
  38.     {
  39.         return (JFactory::getUser()->authorise('core.admin'$this->option&& parent::allowSave($data$key));
  40.     }
  41.  
  42.     /**
  43.      * Overrides JControllerForm::allowEdit
  44.      *
  45.      * Checks that non-Super Admins are not editing Super Admins.
  46.      *
  47.      * @param   array  An array of input data.
  48.      * @param   string    The name of the key for the primary key.
  49.      *
  50.      * @return  boolean 
  51.      * @since   1.6
  52.      */
  53.     protected function allowEdit($data array()$key 'id')
  54.     {
  55.         // Check if this group is a Super Admin
  56.         if (JAccess::checkGroup($data[$key]'core.admin'))
  57.         {
  58.             // If I'm not a Super Admin, then disallow the edit.
  59.             if (!JFactory::getUser()->authorise('core.admin'))
  60.             {
  61.                 return false;
  62.             }
  63.         }
  64.  
  65.         return parent::allowEdit($data$key);
  66.     }
  67.  
  68. }

Documentation generated on Tue, 19 Nov 2013 15:04:06 +0100 by phpDocumentor 1.4.3