Changeset 20508
- Timestamp:
- 07/26/09 22:19:59 (4 years ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
plugins/sfTabMenuPeytzPlugin/lib/sfTabMenuPeytz.class.php
r20450 r20508 43 43 'route' => '@homepage', 44 44 'default' => false, 45 'security' => array( 46 'is_secure' => false, 47 'credentials' => array() 48 /* 49 This is run before anything else, and will determaine if the user got access to this, if u set a permission the 50 is_secure it not needed since the user will be check for authenticated before checking for is_secure. 51 */ 52 ), 53 'matches' => array( //Must match one of these 54 'module/action?get=asdad&get=sadasd', 55 /* 56 Written in the same syntax as routes, if a parameter has a value specified, that value will be check 57 else it will just verify that the parameter is availible by sfWebRequest. 58 This makes a tab able to match different things. the match with highest score for that tab 59 will be used in the overall score matching. 60 */ 61 ), 45 62 'match' => array( 46 63 'module' => null, … … 87 104 88 105 /** 106 * Holds the user object 107 * 108 * @var sfUser 109 */ 110 private $_User; 111 112 /** 89 113 * Renders tabs, uses sf_app_dir to determaine the location of the tabs.yml file. 90 114 * The params array is appended to the routes … … 105 129 self::$_ParsedYamlFile = sfYaml::load($configFile); 106 130 } 131 132 $this->_User = sfContext::getInstance()->getUser(); 107 133 108 134 $config = self::$_ParsedYamlFile; … … 213 239 //Generate the tab parameters 214 240 $config = self::merge($this->_DefaultTabConfig, $this->config['tabs'][$index]); 241 242 //Check the user can access this else just return; 243 if ($config['security']['is_secure'] === true || count($config['security']['credentials'])) { 244 //Is the user authenticated 245 if (!$this->_User->isAuthenticated()) { 246 return; 247 } 248 249 //Credentials checking 250 if (count($config['security']['credentials'])) { 251 if ($this->_User->hasCredential((array) $config['security']['credentials'])) { 252 return; 253 } 254 } 255 } 215 256 216 257 //Generate the correct name