Пример #1
0
 /**
  * Returns user rights configuration
  * 
  * Avaliable options are:
  * force - forces to reload whole ini config
  * user_id - user id
  * 
  * @param array $options Associative array of options
  * @return ConfigContainer User rights configuration
  * @throws Exception Throws exception when required parameters are not set
  */
 public static function getUserRightsConfig(array $options = array())
 {
     if (!LMSDB::checkIfInstanceExists()) {
         throw new Exception('Cannot load uiconfig while database connection does not exist!');
     }
     if (!isset($options['user_id'])) {
         throw new Exception('Cannot load user rights config without user id!');
     }
     $force = isset($options['force']) ? $options['force'] : false;
     if ($force || self::$user_rights_config === null) {
         $options['provider'] = UserRightsConfigProvider::NAME;
         $options['parser'] = UserRightsConfigParser::NAME;
         $config_loader = new ConfigLoader();
         self::$user_rights_config = $config_loader->loadConfig($options);
     }
     return self::$user_rights_config;
 }