當前位置: 首頁>>代碼示例>>PHP>>正文


PHP JAccess::checkGroup方法代碼示例

本文整理匯總了PHP中JAccess::checkGroup方法的典型用法代碼示例。如果您正苦於以下問題:PHP JAccess::checkGroup方法的具體用法?PHP JAccess::checkGroup怎麽用?PHP JAccess::checkGroup使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在JAccess的用法示例。


在下文中一共展示了JAccess::checkGroup方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: __construct

 public function __construct($id, $name, $lft, $rgt, $value, $chietKhau, $chucDanh, $ruleData = null)
 {
     $this->_id = $id;
     $this->_name = $name;
     $this->_lft = $lft;
     $this->_rgt = $rgt;
     $this->_value = $value;
     $this->_chietKhau = $chietKhau;
     $this->_chucDanh = $chucDanh;
     if (!empty($ruleData)) {
         foreach ($ruleData as $ruleDataItem) {
             $name = $ruleDataItem['name'];
             $value = $ruleDataItem['value'];
             $permissionStatus = JAccess::getPermissionStatusOnGroup($id, $name);
             if ($permissionStatus == 'inherited') {
                 if (JAccess::checkGroup($id, $name)) {
                     $status = 'allowed';
                 } else {
                     $status = 'denied';
                 }
             } else {
                 $status = $permissionStatus;
             }
             $permissionNode = new JPermissionNode($name, $value, $status, $permissionStatus);
             $this->_permissionNodes[] = $permissionNode;
         }
     }
 }
開發者ID:omarmm,項目名稱:MangLuoiBDS,代碼行數:28,代碼來源:usergroupNode.php

示例2: getGroups

 /**
  * Method to get the filtering groups (null means no filtering)
  *
  * @return  array|null	array of filtering groups or null.
  *
  * @since   1.6
  */
 protected function getGroups()
 {
     // Compute usergroups
     $db = JFactory::getDbo();
     $query = $db->getQuery(true)->select('id')->from('#__usergroups');
     $db->setQuery($query);
     try {
         $groups = $db->loadColumn();
     } catch (RuntimeException $e) {
         JError::raiseNotice(500, $e->getMessage());
         return null;
     }
     foreach ($groups as $i => $group) {
         if (JAccess::checkGroup($group, 'core.admin')) {
             continue;
         }
         if (!JAccess::checkGroup($group, 'core.manage', 'com_messages')) {
             unset($groups[$i]);
             continue;
         }
         if (!JAccess::checkGroup($group, 'core.login.admin')) {
             unset($groups[$i]);
             continue;
         }
     }
     return array_values($groups);
 }
開發者ID:adjaika,項目名稱:J3Base,代碼行數:34,代碼來源:usermessages.php

示例3: getOptions

 /**
  * Method to get the field options.
  *
  * @return  array  The field option objects.
  * @since   1.6
  */
 protected function getOptions()
 {
     $options = array();
     $db = JFactory::getDbo();
     $user = JFactory::getUser();
     $query = $db->getQuery(true)->select('a.id AS value, a.title AS text, COUNT(DISTINCT b.id) AS level')->from('#__users_groups AS a')->join('LEFT', $db->quoteName('#__users_groups') . ' AS b ON a.lft > b.lft AND a.rgt < b.rgt');
     // Prevent parenting to children of this item.
     if ($id = $this->form->getValue('id')) {
         $query->join('LEFT', $db->quoteName('#__users_groups') . ' AS p ON p.id = ' . (int) $id)->where('NOT(a.lft >= p.lft AND a.rgt <= p.rgt)');
     }
     $query->group('a.id, a.title, a.lft, a.rgt')->order('a.lft ASC');
     // Get the options.
     $db->setQuery($query);
     try {
         $options = $db->loadObjectList();
     } catch (RuntimeException $e) {
         JError::raiseWarning(500, $e->getMessage());
     }
     // Pad the option text with spaces using depth level as a multiplier.
     for ($i = 0, $n = count($options); $i < $n; $i++) {
         // Show groups only if user is super admin or group is not super admin
         if ($user->authorise('core.admin') || !JAccess::checkGroup($options[$i]->value, 'core.admin')) {
             $options[$i]->text = str_repeat('- ', $options[$i]->level) . $options[$i]->text;
         } else {
             unset($options[$i]);
         }
     }
     // Merge any additional options in the XML definition.
     $options = array_merge(parent::getOptions(), $options);
     return $options;
 }
開發者ID:terryvisser,項目名稱:joomlatools-platform,代碼行數:37,代碼來源:groupparent.php

示例4: getGroups

 /**
  * Method to get the filtering groups (null means no filtering)
  *
  * @return	array|null	array of filtering groups or null.
  * @since	1.6
  */
 protected function getGroups()
 {
     // Compute usergroups
     $db = JFactory::getDbo();
     $query = $db->getQuery(true);
     $query->select('id');
     $query->from('#__usergroups');
     $db->setQuery($query);
     $groups = $db->loadColumn();
     // Check for a database error.
     if ($db->getErrorNum()) {
         JError::raiseNotice(500, $db->getErrorMsg());
         return null;
     }
     foreach ($groups as $i => $group) {
         if (JAccess::checkGroup($group, 'core.admin')) {
             continue;
         }
         if (!JAccess::checkGroup($group, 'core.manage', 'com_messages')) {
             unset($groups[$i]);
             continue;
         }
         if (!JAccess::checkGroup($group, 'core.login.admin')) {
             unset($groups[$i]);
             continue;
         }
     }
     return array_values($groups);
 }
開發者ID:Nechoj23,項目名稱:SVI-Homepage,代碼行數:35,代碼來源:usermessages.php

示例5: getItems

	/**
	 * Override getItems method.
	 *
	 * @return  array
	 * @since   1.6
	 */
	public function getItems()
	{
		$groupId = $this->getState('filter.group_id');

		if (($assets = parent::getItems()) && $groupId)
		{

			$actions = $this->getDebugActions();

			foreach ($assets as &$asset)
			{
				$asset->checks = array();

				foreach ($actions as $action)
				{
					$name = $action[0];
					$level = $action[1];

					// Check that we check this action for the level of the asset.
					if ($action[1] === null || $action[1] >= $asset->level)
					{
						// We need to test this action.
						$asset->checks[$name] = JAccess::checkGroup($groupId, $action[0], $asset->name);
					}
					else
					{
						// We ignore this action.
						$asset->checks[$name] = 'skip';
					}
				}
			}
		}

		return $assets;
	}
開發者ID:GitIPFire,項目名稱:Homeworks,代碼行數:41,代碼來源:debuggroup.php

示例6: groups

 /**
  * Displays a list of user groups.
  *
  * @param   boolean  true to include super admin groups, false to exclude them
  *
  * @return  array  An array containing a list of user groups.
  *
  * @since   11.4
  */
 public static function groups($includeSuperAdmin = false)
 {
     $db = JFactory::getDbo();
     $query = $db->getQuery(true);
     $query->select('a.id AS value, a.title AS text, COUNT(DISTINCT b.id) AS level');
     $query->from($db->quoteName('#__usergroups') . ' AS a');
     $query->join('LEFT', $db->quoteName('#__usergroups') . ' AS b ON a.lft > b.lft AND a.rgt < b.rgt');
     $query->group('a.id, a.title, a.lft, a.rgt');
     $query->order('a.lft ASC');
     $db->setQuery($query);
     $options = $db->loadObjectList();
     // Check for a database error.
     if ($db->getErrorNum()) {
         JError::raiseNotice(500, $db->getErrorMsg());
         return null;
     }
     for ($i = 0, $n = count($options); $i < $n; $i++) {
         $options[$i]->text = str_repeat('- ', $options[$i]->level) . $options[$i]->text;
         $groups[] = JHtml::_('select.option', $options[$i]->value, $options[$i]->text);
     }
     // Exclude super admin groups if requested
     if (!$includeSuperAdmin) {
         $filteredGroups = array();
         foreach ($groups as $group) {
             if (!JAccess::checkGroup($group->value, 'core.admin')) {
                 $filteredGroups[] = $group;
             }
         }
         $groups = $filteredGroups;
     }
     return $groups;
 }
開發者ID:jimyb3,項目名稱:mathematicalteachingsite,代碼行數:41,代碼來源:user.php

示例7: onAfterInitialise

 /**
  * Disables creating new admins or updating new ones
  */
 public function onAfterInitialise()
 {
     $input = $this->input;
     $option = $input->getCmd('option', '');
     $task = $input->getCmd('task', '');
     $gid = $input->getInt('gid', 0);
     if ($option != 'com_users' && $option != 'com_admin') {
         return;
     }
     $jform = $this->input->get('jform', array(), 'array');
     $allowedTasks = array('save', 'apply', 'user.apply', 'user.save', 'user.save2new', 'profile.apply', 'profile.save');
     if (!in_array($task, $allowedTasks)) {
         return;
     }
     // Not editing, just core devs using the same task throughout the component, dammit
     if (empty($jform)) {
         return;
     }
     $groups = array();
     if (isset($jform['groups'])) {
         $groups = $jform['groups'];
     }
     $user = JFactory::getUser((int) $jform['id']);
     // Sometimes $user->groups is null... let's be 100% sure that we loaded all the groups of the user
     if (empty($user->groups)) {
         $user->groups = JUserHelper::getUserGroups($user->id);
     }
     if (!empty($user->groups)) {
         foreach ($user->groups as $title => $gid) {
             if (!in_array($gid, $groups)) {
                 $groups[] = $gid;
             }
         }
     }
     $isAdmin = false;
     if (!empty($groups)) {
         foreach ($groups as $group) {
             // First try to see if the group has explicit backend login privileges
             $backend = JAccess::checkGroup($group, 'core.login.admin', 1);
             // If not, is it a Super Admin (ergo inherited privileges)?
             if (is_null($backend)) {
                 $backend = JAccess::checkGroup($group, 'core.admin', 1);
             }
             $isAdmin |= $backend;
         }
     }
     if ($isAdmin) {
         $jlang = JFactory::getLanguage();
         $jlang->load('joomla', JPATH_ROOT, 'en-GB', true);
         $jlang->load('joomla', JPATH_ROOT, $jlang->getDefault(), true);
         $jlang->load('joomla', JPATH_ROOT, null, true);
         if (version_compare(JVERSION, '3.0', 'ge')) {
             throw new Exception(JText::_('JGLOBAL_AUTH_ACCESS_DENIED'), '403');
         } else {
             JError::raiseError(403, JText::_('JGLOBAL_AUTH_ACCESS_DENIED'));
         }
     }
 }
開發者ID:knigherrant,項目名稱:decopatio,代碼行數:61,代碼來源:nonewadmins.php

示例8: allowEdit

 /**
  * Overrides JControllerForm::allowEdit
  *
  * Checks that non-Super Admins are not editing Super Admins.
  *
  * @param	array	An array of input data.
  * @param	string	The name of the key for the primary key.
  *
  * @return	boolean
  * @since	1.6
  */
 protected function allowEdit($data = array(), $key = 'id')
 {
     // Edit a Super Admin User Group is only allowed to a Super Admin
     if (JAccess::checkGroup($data[$key], 'core.admin')) {
         if (!JFactory::getUser()->authorise('core.admin')) {
             return false;
         }
     }
     return parent::allowEdit($data, $key);
 }
開發者ID:khetsothea,項目名稱:flexicontent-cck,代碼行數:21,代碼來源:group.php

示例9: checkUser

 public static function checkUser($userId, $action, $asset = null)
 {
     $userId = (int) $userId;
     if ($userId == 0) {
         return JAccess::checkGroup(0, $action, $asset);
     }
     $action = strtolower(trim($action));
     $asset = strtolower(trim($asset));
     if (empty($asset)) {
         $asset = 1;
     }
     if (empty(JAccess::$_assetRules[$asset])) {
         JAccess::$_assetRules[$asset] = JAccess::getAssetRules($asset);
     }
     $identities = JAccess::getGroupByUsers($userId);
     array_unshift($identities, $userId * -1);
     return JAccess::$_assetRules[$asset]->allow($action, $identities);
 }
開發者ID:omarmm,項目名稱:MangLuoiBDS,代碼行數:18,代碼來源:access_org.php

示例10: getAdminGroups

 function getAdminGroups()
 {
     $db =& JFactory::getDBO();
     // J! 1.6 only
     if (RSTicketsProHelper::isJ16()) {
         $db->setQuery("SELECT id FROM #__usergroups");
         $groups = $db->loadResultArray();
         $admin_groups = array();
         foreach ($groups as $group_id) {
             if (JAccess::checkGroup($group_id, 'core.login.admin')) {
                 $admin_groups[] = $group_id;
             } elseif (JAccess::checkGroup($group_id, 'core.admin')) {
                 $admin_groups[] = $group_id;
             }
         }
         $admin_groups = array_unique($admin_groups);
         return $admin_groups;
     }
 }
開發者ID:atikahmed,項目名稱:joomla-probid,代碼行數:19,代碼來源:rsticketspro.php

示例11: groups

 /**
  * Displays a list of user groups.
  *
  * @param   boolean  $includeSuperAdmin  true to include super admin groups, false to exclude them
  *
  * @return  array  An array containing a list of user groups.
  *
  * @since   2.5
  */
 public static function groups($includeSuperAdmin = false)
 {
     $options = array_values(JHelperUsergroups::getInstance()->getAll());
     for ($i = 0, $n = count($options); $i < $n; $i++) {
         $options[$i]->value = $options[$i]->id;
         $options[$i]->text = str_repeat('- ', $options[$i]->level) . $options[$i]->title;
         $groups[] = JHtml::_('select.option', $options[$i]->value, $options[$i]->text);
     }
     // Exclude super admin groups if requested
     if (!$includeSuperAdmin) {
         $filteredGroups = array();
         foreach ($groups as $group) {
             if (!JAccess::checkGroup($group->value, 'core.admin')) {
                 $filteredGroups[] = $group;
             }
         }
         $groups = $filteredGroups;
     }
     return $groups;
 }
開發者ID:joomla-projects,項目名稱:media-manager-improvement,代碼行數:29,代碼來源:user.php

示例12: getOptions

 /**
  * Method to get the options to populate list
  *
  * @return  array  The field option objects.
  *
  * @since   3.2
  */
 protected function getOptions()
 {
     // Hash for caching
     $hash = md5($this->element);
     if (!isset(static::$options[$hash])) {
         static::$options[$hash] = parent::getOptions();
         $groups = JHelperUsergroups::getInstance()->getAll();
         $checkSuperUser = (int) $this->getAttribute('checksuperusergroup', 0);
         $isSuperUser = JFactory::getUser()->authorise('core.admin');
         $options = array();
         foreach ($groups as $group) {
             // Don't show super user groups to non super users.
             if ($checkSuperUser && !$isSuperUser && JAccess::checkGroup($group->id, 'core.admin')) {
                 continue;
             }
             $options[] = (object) array('text' => str_repeat('- ', $group->level) . $group->title, 'value' => $group->id, 'level' => $group->level);
         }
         static::$options[$hash] = array_merge(static::$options[$hash], $options);
     }
     return static::$options[$hash];
 }
開發者ID:gorgozilla,項目名稱:Estivole,代碼行數:28,代碼來源:usergrouplist.php

示例13: getOptions

 /**
  * Method to get the field options.
  *
  * @return  array  The field option objects
  *
  * @since   1.6
  */
 protected function getOptions()
 {
     $options = JHelperUsergroups::getInstance()->getAll();
     $user = JFactory::getUser();
     // Prevent parenting to children of this item.
     if ($id = $this->form->getValue('id')) {
         unset($options[$id]);
     }
     $options = array_values($options);
     // Pad the option text with spaces using depth level as a multiplier.
     for ($i = 0, $n = count($options); $i < $n; $i++) {
         // Show groups only if user is super admin or group is not super admin
         if ($user->authorise('core.admin') || !JAccess::checkGroup($options[$i]->value, 'core.admin')) {
             $options[$i]->value = $options[$i]->id;
             $options[$i]->text = str_repeat('- ', $options[$i]->level) . $options[$i]->title;
         } else {
             unset($options[$i]);
         }
     }
     // Merge any additional options in the XML definition.
     $options = array_merge(parent::getOptions(), $options);
     return $options;
 }
開發者ID:joomla-projects,項目名稱:media-manager-improvement,代碼行數:30,代碼來源:groupparent.php

示例14: getArticlesInCategoryByUsergroup

 /**
  *  Funkce vracející hodnotu konkrétní položky
  */
 public function getArticlesInCategoryByUsergroup($userGroupId, $categoryId = -1)
 {
     $db =& JFactory::getDBO();
     $user =& JFactory::getUser();
     //nastavení where částí SQL dotazu
     $whereClause = "(state>=0) AND (" . $this->getAccessWhereSql('ct') . ")";
     if ($categoryId > -1) {
         $whereClause .= " AND (ct.catid='" . $categoryId . "')";
     }
     //
     $db->setQuery("SELECT ct.title,ct.id,date_format(ct.created, '%d.%m.%y %h:%i') as cdate,date_format(ct.modified, '%d.%m.%y %h:%i') as mdate,cat.title as categoryTitle,ct.checked_out FROM #__content ct LEFT JOIN #__categories cat ON ct.catid=cat.id WHERE {$whereClause}");
     $rows = $db->loadObjectList();
     $resultRows = array();
     if (count($rows) > 0) {
         //musíme zkontrolovat, jestli může uživatelská skupina upravovat dané články
         foreach ($rows as $row) {
             if (JAccess::checkGroup($userGroupId, 'core.delete', 'com_content.article.' . $row->id)) {
                 $resultRows[] = $row;
             }
         }
     }
     return $resultRows;
 }
開發者ID:KIZI,項目名稱:sewebar-cms,代碼行數:26,代碼來源:articles.php

示例15: foreach

				</th>
				<th class="nowrap id-col">
					<?php 
echo JText::_('JGRID_HEADING_ID');
?>
				</th>
			</tr>
		</thead>

		<tbody>
		<?php 
foreach ($this->items as $i => $item) {
    $canCreate = $user->authorise('core.create', 'com_users');
    $canEdit = $user->authorise('core.edit', 'com_users');
    // If this group is super admin and this user is not super admin, $canEdit is false
    if (!$user->authorise('core.admin') && JAccess::checkGroup($item->id, 'core.admin')) {
        $canEdit = false;
    }
    $canChange = $user->authorise('core.edit.state', 'com_users');
    ?>
			<tr class="row<?php 
    echo $i % 2;
    ?>
">
				<td>
					<?php 
    if ($canEdit) {
        ?>
						<?php 
        echo JHtml::_('grid.id', $i, $item->id);
        ?>
開發者ID:educakanchay,項目名稱:educared,代碼行數:31,代碼來源:default.php


注:本文中的JAccess::checkGroup方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。