}
$classname = __CLASS__;
- $GLOBALS['registry'] = new $classname($s_ctrl);
+ $registry = $GLOBALS['registry'] = new $classname($s_ctrl);
- $appob = $GLOBALS['registry']->getApiInstance($app, 'application');
+ $appob = $registry->getApiInstance($app, 'application');
$appob->initParams = $args;
try {
- $GLOBALS['registry']->pushApp($app, array('check_perms' => ($args['authentication'] != 'none'), 'logintasks' => !$args['nologintasks']));
+ $registry->pushApp($app, array('check_perms' => ($args['authentication'] != 'none'), 'logintasks' => !$args['nologintasks']));
- if ($args['admin'] && !$GLOBALS['registry']->isAdmin()) {
+ if ($args['admin'] && !$registry->isAdmin()) {
throw new Horde_Exception('Not an admin');
}
} catch (Horde_Exception $e) {
throw $e;
}
- $GLOBALS['registry']->authenticateFailure($app, $e);
+ $registry->authenticateFailure($app, $e);
}
- $GLOBALS['registry']->initialApp = $app;
+ $registry->initialApp = $app;
if (!$args['nocompress']) {
Horde::compressOutput();
if (empty($GLOBALS['conf']['auth']['admins'])) {
throw new Horde_Exception('No admin users defined in configuration.');
}
- Horde_Auth::setAuth(reset($GLOBALS['conf']['auth']['admins']), array());
+ $registry->setAuth(reset($GLOBALS['conf']['auth']['admins']), array());
}
$appob->init();
* - To all authenticated users if no permission is set on $app.
* - To anyone who is allowed by an explicit ACL on $app. */
if ($checkPerms) {
- if ($GLOBALS['registry']->getAuth() && !Horde_Auth::checkExistingAuth()) {
+ if ($this->getAuth() && !Horde_Auth::checkExistingAuth()) {
throw new Horde_Exception('User is not authorized', self::AUTH_FAILURE);
}
if (!$this->hasPermission($app, Horde_Perms::READ)) {
throw new Horde_Exception('User is not authorized', self::AUTH_FAILURE);
}
- Horde::logMessage(sprintf('%s does not have READ permission for %s', $GLOBALS['registry']->getAuth() ? 'User ' . $GLOBALS['registry']->getAuth() : 'Guest user', $app), 'DEBUG');
- throw new Horde_Exception(sprintf(_('%s is not authorized for %s.'), $GLOBALS['registry']->getAuth() ? 'User ' . $GLOBALS['registry']->getAuth() : 'Guest user', $this->applications[$app]['name']), self::PERMISSION_DENIED);
+ Horde::logMessage(sprintf('%s does not have READ permission for %s', $this->getAuth() ? 'User ' . $this->getAuth() : 'Guest user', $app), 'DEBUG');
+ throw new Horde_Exception(sprintf(_('%s is not authorized for %s.'), $this->getAuth() ? 'User ' . $this->getAuth() : 'Guest user', $this->applications[$app]['name']), self::PERMISSION_DENIED);
}
}
* explicit permissions, or for apps that allow the given permission. */
return $this->isAdmin() ||
($GLOBALS['injector']->getInstance('Horde_Perms')->exists($app)
- ? $GLOBALS['injector']->getInstance('Horde_Perms')->hasPermission($app, $GLOBALS['registry']->getAuth(), $perms)
- : (bool)$GLOBALS['registry']->getAuth());
+ ? $GLOBALS['injector']->getInstance('Horde_Perms')->hasPermission($app, $this->getAuth(), $perms)
+ : (bool)$this->getAuth());
}
/**
/* If there is no logged in user, return an empty Horde_Prefs::
* object with just default preferences. */
- if (!$GLOBALS['registry']->getAuth()) {
+ if (!$this->getAuth()) {
$GLOBALS['prefs'] = Horde_Prefs::factory('Session', $app, '', '', null, false);
} else {
if (!isset($GLOBALS['prefs']) ||
- ($GLOBALS['prefs']->getUser() != $GLOBALS['registry']->getAuth())) {
- $GLOBALS['prefs'] = Horde_Prefs::factory($GLOBALS['conf']['prefs']['driver'], $app, $GLOBALS['registry']->getAuth(), Horde_Auth::getCredential('password'));
+ ($GLOBALS['prefs']->getUser() != $this->getAuth())) {
+ $GLOBALS['prefs'] = Horde_Prefs::factory($GLOBALS['conf']['prefs']['driver'], $app, $this->getAuth(), Horde_Auth::getCredential('password'));
} else {
$GLOBALS['prefs']->retrieve($app);
}
/* Using cache while not authenticated isn't possible because,
* although storage is possible, retrieval isn't since there is no
* MD5 sum in the session to use to build the cache IDs. */
- if (!$GLOBALS['registry']->getAuth()) {
+ if (!$this->getAuth()) {
return;
}
/* Using cache while not authenticated isn't possible because,
* although storage is possible, retrieval isn't since there is no
* MD5 sum in the session to use to build the cache IDs. */
- if ($GLOBALS['registry']->getAuth() &&
+ if ($this->getAuth() &&
($id = $this->_getCacheId($name))) {
$result = $GLOBALS['injector']->getInstance('Horde_Cache')->get($id, 86400);
if ($result !== false) {
{
$user = isset($options['user'])
? $options['user']
- : $GLOBALS['registry']->getAuth();
+ : $this->getAuth();
if ($user &&
@is_array($GLOBALS['conf']['auth']['admins']) &&