Ejemplo n.º 1
0
 /**
  * Lookups the categories (their IDs), that the user has access to perforn the specified action(s)
  *
  * @param object	$user             The user on which to check privileges
  * @param array		$actions_allowed  The required actions
  * @param bool		$require_all      True to require --all-- (Logical AND) or false to require --any-- (Logical OR)
  * @param bool		$check_published  True to include only published categories
  *
  * @return array									The category IDs
  * @since	2.0
  */
 static function getAllowedCats(&$user, $actions_allowed = array('core.create', 'core.edit', 'core.edit.own'), $require_all = true, $check_published = false, $specific_catids = false, $find_first = false)
 {
     // Return cached data
     $user_id = $user ? $user->id : JFactory::getUser()->id;
     if (FLEXI_CACHE) {
         $catscache = JFactory::getCache('com_flexicontent_cats');
         // Get Joomla Cache of '...items' Caching Group
         $catscache->setCaching(1);
         // Force cache ON
         $catscache->setLifeTime(FLEXI_CACHE_TIME);
         // set expire time (default is 1 hour)
         $allowedCats = $catscache->call(array('FlexicontentHelperPerm', '_getAllowedCats'), $user_id, $actions_allowed, $require_all, $check_published, $specific_catids, $find_first);
     } else {
         $allowedCats = FlexicontentHelperPerm::_getAllowedCats($user_id, $actions_allowed, $require_all, $check_published, $specific_catids, $find_first);
     }
     return $allowedCats;
 }