Move isAdmin() from horde/Auth to horde/Core
authorMichael M Slusarz <slusarz@curecanti.org>
Tue, 1 Jun 2010 07:05:01 +0000 (01:05 -0600)
committerMichael M Slusarz <slusarz@curecanti.org>
Wed, 2 Jun 2010 03:32:18 +0000 (21:32 -0600)
106 files changed:
agora/editforum.php
agora/forums.php
agora/lib/Agora.php
agora/lib/Block/forums.php
agora/lib/Block/threads.php
agora/lib/Messages.php
agora/moderators.php
agora/owner.php
ansel/gallery.php
ansel/lib/Ansel.php
ansel/lib/Api.php
ansel/lib/Gallery.php
ansel/perms.php
ansel/scripts/all_images_exif_to_tags.php
beatnik/lib/Beatnik.php
beatnik/lib/Driver.php
folks/config/hooks.php.dist
folks/lib/Api.php
folks/lib/Driver.php
folks/lib/Friends/shared.php
folks/perms.php
folks/scripts/mail.php
framework/Auth/lib/Horde/Auth.php
framework/Block/lib/Horde/Block/Collection.php
framework/Core/lib/Horde.php
framework/Core/lib/Horde/ErrorHandler.php
framework/Core/lib/Horde/Registry.php
gollem/lib/Gollem.php
gollem/permissions.php
horde/lib/Api.php
horde/lib/Prefs/Ui.php
horde/services/portal/sidebar.php
horde/services/shares/edit.php
horde/templates/shares/edit.inc
ingo/lib/Application.php
ingo/lib/Storage/Sql.php
jonah/lib/Jonah.php
kronolith/calendars/delete.php
kronolith/calendars/edit.php
kronolith/calendars/index.php
kronolith/delete.php
kronolith/lib/Ajax/Imple/TagActions.php
kronolith/lib/Api.php
kronolith/lib/Application.php
kronolith/lib/Driver/Resource.php
kronolith/lib/Driver/Sql.php
kronolith/lib/Event.php
kronolith/lib/Event/Resource.php
kronolith/lib/Forms/CreateCalendar.php
kronolith/lib/Forms/EditCalendar.php
kronolith/lib/Kronolith.php
kronolith/lib/Resource/Base.php
kronolith/perms.php
kronolith/resources/create.php
kronolith/resources/delete.php
kronolith/resources/edit.php
kronolith/resources/groups/create.php
kronolith/resources/groups/delete.php
kronolith/resources/groups/edit.php
kronolith/resources/groups/index.php
kronolith/resources/index.php
kronolith/templates/chunks/permissions.inc
kronolith/templates/panel.inc
kronolith/templates/perms/perms.inc
luxor/lib/Luxor.php
mnemo/lib/Api.php
nag/lib/Api.php
nag/lib/Application.php
nag/lib/Forms/CreateTaskList.php
nag/lib/Forms/EditTaskList.php
nag/lib/Nag.php
nag/tasklists/delete.php
nag/tasklists/edit.php
nag/tasklists/index.php
news/add.php
news/admin/tabs.php
news/delete.php
news/delete_file.php
news/files.php
news/lib/Categories.php
news/lib/Driver.php
news/lib/Driver/sql.php
news/lib/Forms/Search.php
news/lib/News.php
news/lib/Search.php
news/templates/edit/row.php
operator/lib/Driver.php
operator/lib/Operator.php
shout/lib/Shout.php
turba/lib/Api.php
turba/lib/Application.php
turba/lib/Driver/Sql.php
vilma/lib/Vilma.php
vilma/virtuals/delete.php
vilma/virtuals/edit.php
vilma/virtuals/index.php
whups/admin/index.php
whups/lib/Api.php
whups/lib/Forms/AddComment.php
whups/lib/Forms/Admin/Queue.php
whups/lib/Forms/Admin/Reply.php
whups/lib/Whups.php
whups/ticket/queue.php
wicked/lib/Page.php
wicked/lib/Page/StandardPage.php
wicked/templates/display/standard.inc

index 877a516..80ed3d1 100644 (file)
@@ -23,11 +23,11 @@ $vars = Horde_Variables::getDefaultVariables();
 $vars->set('forum_id', $forum_id);
 
 /* Check permissions */
-if ($forum_id && !Horde_Auth::isAdmin('agora:admin')) {
+if ($forum_id && !$registry->isAdmin(array('permission' => 'agora:admin'))) {
     $notification->push(sprintf(_("You don't have permissions to edit forum %s"), $registry->get('name', $scope)), 'horde.warning');
     header('Location: ' . Horde::applicationUrl('forums.php', true));
     exit;
-} elseif (!Horde_Auth::isAdmin('agora:admin')) {
+} elseif (!$registry->isAdmin(array('permission' => 'agora:admin'))) {
     $notification->push(sprintf(_("You don't have permissions to create a new forum in %s"), $registry->get('name', $scope)), 'horde.warning');
     header('Location: ' . Horde::applicationUrl('forums.php', true));
     exit;
index 934aaf7..23702f2 100644 (file)
@@ -19,7 +19,7 @@ $scope = Horde_Util::getGet('scope', 'agora');
 $forums = Agora_Messages::singleton($scope);
 
 /* Set up actions */
-if (Horde_Auth::isAdmin()) {
+if ($registry->isAdmin()) {
     $url = Horde::applicationUrl('forums.php');
     foreach ($registry->listApps(array('hidden', 'notoolbar', 'active')) as $app) {
         if ($registry->hasMethod('hasComments', $app) &&
index 4de487e..f3649cd 100644 (file)
@@ -261,7 +261,7 @@ class Agora {
             $menu->add($url, _("_Moderate"), 'moderate.png', $img_dir);
         }
 
-        if (Horde_Auth::isAdmin()) {
+        if ($GLOBALS['registry']->isAdmin()) {
             $menu->add(Horde::applicationUrl('moderators.php'), _("_Moderators"), 'hot.png', $img_dir);
         }
 
index e6b1caa..e6c97a2 100644 (file)
@@ -44,7 +44,7 @@ class Horde_Block_agora_forums extends Horde_Block {
 
         /* Set up the forums object. */
         $forums = array(Agora_Messages::singleton());
-        if (Horde_Auth::isAdmin()) {
+        if ($GLOBALS['registry']->isAdmin()) {
             foreach ($registry->listApps(array('hidden', 'notoolbar', 'active')) as $scope) {
                 if ($registry->hasMethod('hasComments', $scope) &&
                     $registry->callByPackage($scope, 'hasComments') === true) {
index 2c8b168..e07558f 100644 (file)
@@ -40,7 +40,7 @@ class Horde_Block_agora_threads extends Horde_Block {
         $forum_id = array(
             'name' => _("Forum"),
             'type' => 'enum',
-            'values' => $forums->getForums(0, false, 'forum_name', 0, !Horde_Auth::isAdmin()),
+            'values' => $forums->getForums(0, false, 'forum_name', 0, !$GLOBALS['registry']->isAdmin()),
         );
 
         /* Display the last X number of threads. */
index b7c4e2b..ee548f8 100644 (file)
@@ -1110,7 +1110,7 @@ class Agora_Messages {
         $params = array(1);
 
         /* Check permissions */
-        if (Horde_Auth::isAdmin('agora:admin') ||
+        if ($GLOBALS['registry']->isAdmin(array('permission' => 'agora:admin')) ||
             ($GLOBALS['injector']->getInstance('Horde_Perms')->exists('agora:forums:' . $this->_scope) &&
              $GLOBALS['injector']->getInstance('Horde_Perms')->hasPermission('agora:forums:' . $this->_scope, Horde_Auth::getAuth(), Horde_Perms::DELETE))) {
                 $sql .= ' AND scope = ? ';
@@ -1811,14 +1811,14 @@ class Agora_Messages {
                 $url = Agora::setAgoraId($forum_id, null, $edit_url, $forum['scope'], true);
                 $forum['actions'][] = Horde::link($url, _("Post message")) . _("New Post") . '</a>';
 
-                if (Horde_Auth::isAdmin('agora:admin')) {
+                if ($GLOBALS['registry']->isAdmin(array('permission' => 'agora:admin'))) {
                     /* Edit forum button. */
                     $url = Agora::setAgoraId($forum_id, null, $editforum_url, $forum['scope'], true);
                     $forum['actions'][] = Horde::link($url, _("Edit forum")) . _("Edit") . '</a>';
                 }
             }
 
-            if (Horde_Auth::isAdmin('agora:admin')) {
+            if ($GLOBALS['registry']->isAdmin(array('permission' => 'agora:admin'))) {
                 /* Delete forum button. */
                 $url = Agora::setAgoraId($forum_id, null, $delete_url, $forum['scope'], true);
                 $forum['actions'][] = Horde::link($url, _("Delete forum")) . _("Delete") . '</a>';
@@ -2170,7 +2170,7 @@ class Agora_Messages {
     {
         // Allow all admins
         if (($forum_id === null && isset($this->_forum['author']) && $this->_forum['author'] == Horde_Auth::getAuth()) ||
-            Horde_Auth::isAdmin('agora:admin')) {
+            $GLOBALS['registry']->isAdmin(array('permission' => 'agora:admin'))) {
             return true;
         }
 
index f56d9f2..30dce9f 100644 (file)
@@ -14,7 +14,7 @@
 require_once dirname(__FILE__) . '/lib/Application.php';
 Horde_Registry::appInit('agora');
 
-if (!Horde_Auth::isAdmin()) {
+if (!$registry->isAdmin()) {
     header('Location: ' . Horde::applicationUrl('forums.php'));
     exit;
 }
@@ -74,7 +74,7 @@ $form->addVariable(_("Moderator"), 'moderator', 'text', true);
 if ($messages->countForums() > 50) {
     $form->addVariable(_("Forum"), 'forum_id', 'int', true);
 } else {
-    $forums_enum = $messages->getForums(0, false, 'forum_name', 0, !Horde_Auth::isAdmin());
+    $forums_enum = $messages->getForums(0, false, 'forum_name', 0, !$registry->isAdmin());
     $form->addVariable(_("Forum"), 'forum_id', 'enum', true, false, false, array($forums_enum));
 }
 
index 043e0f8..b18ceb1 100644 (file)
@@ -21,7 +21,7 @@ if (!Horde_Auth::isAuthenticated()) {
 
 /* Default to agora and current user if is not an admin. */
 $scope = Horde_Util::getGet('scope', 'agora');
-$owner = Horde_Auth::isAdmin() ? Horde_Util::getGet('owner', Horde_Auth::getAuth()) : Horde_Auth::getAuth();
+$owner = $registry->isAdmin() ? Horde_Util::getGet('owner', Horde_Auth::getAuth()) : Horde_Auth::getAuth();
 
 /* Get the sorting. */
 $sort_by = Agora::getSortBy('threads');
index ad4ab18..768121e 100644 (file)
@@ -120,9 +120,9 @@ case 'modify':
 
 case 'save':
     // Check general permissions.
-    if (!Horde_Auth::isAdmin() &&
-        ($GLOBALS['injector']->getInstance('Horde_Perms')->exists('ansel') &&
-         !$GLOBALS['injector']->getInstance('Horde_Perms')->hasPermission('ansel', Horde_Auth::getAuth(), Horde_Perms::EDIT))) {
+    if (!$registry->isAdmin() &&
+        ($injector->getInstance('Horde_Perms')->exists('ansel') &&
+         !$injector->getInstance('Horde_Perms')->hasPermission('ansel', Horde_Auth::getAuth(), Horde_Perms::EDIT))) {
         $notification->push(_("Access denied editing galleries."), 'horde.error');
         header('Location: ' . Horde::applicationUrl('view.php?view=List', true));
         exit;
@@ -272,8 +272,8 @@ case 'save':
     }
 
     // Clear the OtherGalleries widget cache
-    if ($GLOBALS['conf']['ansel_cache']['usecache']) {
-        $GLOBALS['injector']->getInstance('Horde_Cache')->expire('Ansel_OtherGalleries' . $gallery->get('owner'));
+    if ($conf['ansel_cache']['usecache']) {
+        $injector->getInstance('Horde_Cache')->expire('Ansel_OtherGalleries' . $gallery->get('owner'));
     }
 
     // Return to the last view.
index 7cf0553..3c25fc1 100644 (file)
@@ -591,7 +591,7 @@ class Ansel
         }
 
         /* Let authenticated users create new galleries. */
-        if (Horde_Auth::isAdmin() ||
+        if ($GLOBALS['registry']->isAdmin() ||
             (!$GLOBALS['injector']->getInstance('Horde_Perms')->exists('ansel') && Horde_Auth::getAuth()) ||
             $GLOBALS['injector']->getInstance('Horde_Perms')->hasPermission('ansel', Horde_Auth::getAuth(), Horde_Perms::EDIT)) {
             $menu->add(Horde::applicationUrl(Horde_Util::addParameter('gallery.php', 'actionID', 'add')),
index c7aa554..da35f35 100644 (file)
@@ -436,7 +436,7 @@ class Ansel_Api extends Horde_Registry_Api
      */
     public function createGallery($app = null, $attributes = array(), $perm = null, $parent = null)
     {
-        if (!(Horde_Auth::isAdmin() ||
+        if (!($GLOBALS['registry']->isAdmin() ||
             (!$GLOBALS['injector']->getInstance('Horde_Perms')->exists('ansel') && Horde_Auth::getAuth()) ||
             $GLOBALS['injector']->getInstance('Horde_Perms')->hasPermission('ansel', Horde_Auth::getAuth(), Horde_Perms::EDIT))) {
 
index af87b7f..eb692ac 100644 (file)
@@ -89,7 +89,7 @@ class Ansel_Gallery extends Horde_Share_Object_Sql_Hierarchical
     {
         if (Horde_Auth::getAuth() &&
             (Horde_Auth::getAuth() == $this->data['share_owner'] ||
-             Horde_Auth::isAdmin('ansel:admin'))) {
+             $GLOBALS['registry']->isAdmin(array('permission' => 'ansel:admin')))) {
             return true;
         }
 
@@ -791,7 +791,7 @@ class Ansel_Gallery extends Horde_Share_Object_Sql_Hierarchical
     public function hasPermission($userid, $permission, $creator = null)
     {
         if ($userid == $this->data['share_owner'] ||
-            Horde_Auth::isAdmin('ansel:admin')) {
+            $GLOBALS['registry']->isAdmin(array('permission' => 'ansel:admin'))) {
 
             return true;
         }
@@ -841,7 +841,7 @@ class Ansel_Gallery extends Horde_Share_Object_Sql_Hierarchical
     {
         if (Horde_Auth::getAuth() &&
             (Horde_Auth::getAuth() == $this->get('owner') ||
-             Horde_Auth::isAdmin('ansel:admin'))) {
+             $GLOBALS['registry']->isAdmin(array('permission' => 'ansel:admin')))) {
             return false;
         }
 
index d0a568c..84481ea 100644 (file)
@@ -69,7 +69,7 @@ case 'editforminherit':
         $old_owner = $share->get('owner');
         $new_owner = Horde_Util::getFormData('owner', $old_owner);
         if ($old_owner !== $new_owner && !empty($new_owner)) {
-            if ($old_owner != Horde_Auth::getAuth() && !Horde_Auth::isAdmin()) {
+            if ($old_owner != Horde_Auth::getAuth() && !$registry->isAdmin()) {
                 $notification->push(_("Only the owner or system administrator may change ownership or owner permissions for a share"), 'horde.error');
             } else {
                 $share->set('owner', $new_owner);
index 4451d42..e3b0556 100755 (executable)
@@ -66,7 +66,7 @@ if (!empty($username) && !empty($password)) {
     $cli->fatal(_("You must specify a valid username and password."));
 }
 
-if (!Horde_Auth::isAdmin()) {
+if (!$registry->isAdmin()) {
     $cli->fatal(_("You must login with an administrative account."));
 }
 
index e46d7ac..3bc1610 100644 (file)
@@ -471,7 +471,7 @@ class Beatnik {
      */
     function hasPermission($permname, $permmask = null, $numparents = 0)
     {
-        if (Horde_Auth::isAdmin()) {
+        if ($GLOBALS['registry']->isAdmin()) {
             return true;
         }
 
index 087d986..f7100ce 100644 (file)
@@ -64,7 +64,7 @@ class Beatnik_Driver {
             return array();
         }
 
-        if (!Horde_Auth::isAdmin() &&
+        if (!$GLOBALS['registry']->isAdmin() &&
             !$GLOBALS['injector']->getInstance('Horde_Perms')->hasPermission('beatnik:domains', Horde_Auth::getAuth(), $perms)) {
             foreach ($domains as $id => $domain) {
                 if (!$GLOBALS['injector']->getInstance('Horde_Perms')->hasPermission('beatnik:domains:' . $domain['zonename'], Horde_Auth::getAuth(), $perms)) {
index ec6be97..e682c7b 100644 (file)
@@ -214,8 +214,8 @@ class Folks_Hooks
         switch ($app) {
 
         case 'gollem':
-
-            if (Horde_Auth::isAdmin() || $group->userIsInGroup($user_uid, 1, false)) {
+            if ($GLOBALS['registry']->isAdmin() ||
+                $group->userIsInGroup($user_uid, 1, false)) {
                 $_GET['backend_key'] = 'kjbnzi78';
                 require $GLOBALS['registry']->get('fileroot', 'gollem') .  '/redirect.php';
                 exit;
@@ -226,7 +226,7 @@ class Folks_Hooks
             break;
 
         case 'imp':
-            if (Horde_Auth::isAdmin()
+            if ($GLOBALS['registry']->isAdmin()
                 || $group->userIsInGroup($user_uid, 1, false)
                 || $group->userIsInGroup($user_uid, 2, false)) {
 
index 68de93b..fb13631 100644 (file)
@@ -25,7 +25,7 @@ class Folks_Api extends Horde_Registry_Api
 
     public function __construct()
     {
-        if (!Horde_Auth::isAdmin()) {
+        if (!$GLOBALS['registry']->isAdmin()) {
             $this->disabled = array('removeUser', 'userList');
         }
     }
@@ -299,7 +299,8 @@ class Folks_Api extends Horde_Registry_Api
     {
         if (empty($user)) {
             $user = Horde_Auth::getAuth();
-        } elseif ($user !== Horde_Auth::getAuth() && !Horde_Auth::isAdmin('admin:' . $scope)) {
+        } elseif ($user !== Horde_Auth::getAuth() &&
+                  !$GLOBALS['registry']->isAdmin(array('permission' => 'admin:' . $scope))) {
             return PEAR::raiseError(_("You cannot log activities for other users."));
         }
 
index 4f6808c..24f7415 100644 (file)
@@ -314,7 +314,7 @@ class Folks_Driver {
         }
 
         $profile = $GLOBALS['cache']->get('folksProfile' . $user, $GLOBALS['conf']['cache']['default_lifetime']);
-        if ($profile || (Horde_Auth::isAdmin() && Horde_Util::getGet('debug'))) {
+        if ($profile || ($GLOBALS['registry']->isAdmin() && Horde_Util::getGet('debug'))) {
 
             $profile = unserialize($profile);
 
@@ -452,7 +452,7 @@ class Folks_Driver {
     */
     public function deleteUser($user)
     {
-        if  (!Horde_Auth::isAdmin()) {
+        if (!$GLOBALS['registry']->isAdmin()) {
             return false;
         }
 
index 181f962..69345af 100644 (file)
@@ -81,11 +81,11 @@ class Folks_Friends_shared extends  Folks_Friends_sql {
 
         $GLOBALS['folks_shares'] = $GLOBALS['injector']->getInstance('Horde_Share')->getScope();
         $share = $GLOBALS['folks_shares']->getShareById($group);
-        
+
         // Only owners of a group can delete them
         if (!Horde_Auth::getAuth() ||
             (Horde_Auth::getAuth() != $share->get('owner') &&
-             !Horde_Auth::isAdmin('folks:admin'))) {
+             !$GLOBALS['registry']->isAdmin(array('permission' => 'folks:admin')))) {
             return PEAR::raiseError("You can rename only your own groups.");
         }
 
@@ -117,7 +117,7 @@ class Folks_Friends_shared extends  Folks_Friends_sql {
         // Only owners of a group can delete them
         if (!Horde_Auth::getAuth() ||
             (Horde_Auth::getAuth() != $share->get('owner') &&
-             !Horde_Auth::isAdmin('folks:admin'))) {
+             !$GLOBALS['registry']->isAdmin(array('permission' => 'folks:admin')))) {
             return PEAR::raiseError("You can delete only your own groups.");
         }
 
@@ -172,4 +172,4 @@ class Folks_Friends_shared extends  Folks_Friends_sql {
 
         return $share->getId();
     }
-}
\ No newline at end of file
+}
index 284ca0e..4a7ba0d 100644 (file)
@@ -52,7 +52,7 @@ case 'editform':
         $old_owner = $share->get('owner');
         $new_owner = Horde_Auth::convertUsername(Horde_Util::getFormData('owner', $old_owner), true);
         if ($old_owner !== $new_owner && !empty($new_owner)) {
-            if ($old_owner != Horde_Auth::getAuth() && !Horde_Auth::isAdmin()) {
+            if ($old_owner != Horde_Auth::getAuth() && !$registry->isAdmin()) {
                 $notification->push(_("Only the owner or system administrator may change ownership or owner permissions for a share"), 'horde.error');
             } else {
                 $share->set('owner', $new_owner);
index 49a8091..3291bb9 100644 (file)
@@ -75,7 +75,7 @@ if (!empty($username) && !empty($password)) {
 }
 
 // Only admins can run this operation
-if (!Horde_Auth::isAdmin('folks:admin')) {
+if (!$registry->isAdmin(array('permission' => 'folks:admin'))) {
     $cli->fatal('ADMIN ONLY');
 }
 
index 19a0416..f145be2 100644 (file)
@@ -791,41 +791,6 @@ class Horde_Auth
     }
 
     /**
-     * Is the current user an administrator?
-     *
-     * @param string $permission  Allow users with this permission admin access
-     *                            in the current context.
-     * @param integer $permlevel  The level of permissions to check for.
-     *                            Defaults to Horde_Perms::EDIT.
-     * @param string $user        The user to check. Defaults to
-     *                            self::getAuth().
-     *
-     * @return boolean  Whether or not this is an admin user.
-     */
-    static public function isAdmin($permission = null, $permlevel = null,
-                                   $user = null)
-    {
-        if (is_null($user)) {
-            $user = self::getAuth();
-        }
-
-        if ($user &&
-            @is_array($GLOBALS['conf']['auth']['admins']) &&
-            in_array($user, $GLOBALS['conf']['auth']['admins'])) {
-            return true;
-        }
-
-        if (!is_null($permission)) {
-            if (is_null($permlevel)) {
-                $permlevel = Horde_Perms::EDIT;
-            }
-            return $GLOBALS['injector']->getInstance('Horde_Perms')->hasPermission($permission, $user, $permlevel);
-        }
-
-        return false;
-    }
-
-    /**
      * Runs the pre/post-authenticate hook and parses the result.
      *
      * @param string $userId      The userId who has been authorized.
index 2510c1f..145d8b7 100644 (file)
@@ -141,13 +141,15 @@ class Horde_Block_Collection
     public function getBlock($app, $name, $params = null, $row = null,
                              $col = null)
     {
-        if (($GLOBALS['registry']->get('status', $app) == 'inactive') ||
-            (($GLOBALS['registry']->get('status', $app) == 'admin') &&
-             !Horde_Auth::isAdmin())) {
+        global $registry;
+
+        if (($registry->get('status', $app) == 'inactive') ||
+            (($registry->get('status', $app) == 'admin') &&
+             !$registry->isAdmin())) {
             throw new Horde_Exception(sprintf('%s is not activated.', $GLOBALS['registry']->get('name', $app)));
         }
 
-        $path = $GLOBALS['registry']->get('fileroot', $app) . '/lib/Block/' . $name . '.php';
+        $path = $registry->get('fileroot', $app) . '/lib/Block/' . $name . '.php';
         if (is_readable($path)) {
             include_once $path;
         }
@@ -157,10 +159,10 @@ class Horde_Block_Collection
             throw new Horde_Exception(sprintf('%s not found.', $class));
         }
 
-        $pushed = $GLOBALS['registry']->pushApp($app);
+        $pushed = $registry->pushApp($app);
         $ob = new $class($params, $row, $col);
         if ($pushed) {
-            $GLOBALS['registry']->popApp($app);
+            $registry->popApp($app);
         }
 
         return $ob;
index 9f9c11f..d26906f 100644 (file)
@@ -95,7 +95,7 @@ class Horde
     static public function fatal($error, $file = null, $line = null,
                                  $log = true)
     {
-        $admin = Horde_Auth::isAdmin();
+        $admin = $GLOBALS['registry']->isAdmin();
         $cli = Horde_Cli::runningFromCLI();
 
         $errortext = '<h1>' . _("A fatal error has occurred") . '</h1>';
index c706694..ff0ec13 100644 (file)
@@ -180,7 +180,7 @@ class Horde_ErrorHandler
      */
     public static function dump($errors)
     {
-        if (!Horde_Auth::isAdmin()) {
+        if (!$GLOBALS['registry']->isAdmin()) {
             return;
         }
 
index cd6267d..ac48f7f 100644 (file)
@@ -182,7 +182,7 @@ class Horde_Registry
         try {
             $GLOBALS['registry']->pushApp($app, array('check_perms' => ($args['authentication'] != 'none'), 'logintasks' => !$args['nologintasks']));
 
-            if ($args['admin'] && !Horde_Auth::isAdmin()) {
+            if ($args['admin'] && !$GLOBALS['registry']->isAdmin()) {
                 throw new Horde_Exception('Not an admin');
             }
         } catch (Horde_Exception $e) {
@@ -481,7 +481,7 @@ class Horde_Registry
 
             if (($app['status'] != 'inactive') &&
                 isset($app['provides']) &&
-                (($app['status'] != 'admin') || Horde_Auth::isAdmin())) {
+                (($app['status'] != 'admin') || $this->isAdmin())) {
                 if (is_array($app['provides'])) {
                     foreach ($app['provides'] as $interface) {
                         $this->_cache['interfaces'][$interface] = $appName;
@@ -531,7 +531,7 @@ class Horde_Registry
 
         /* Generate api/type cache. */
         $status = array('active', 'notoolbar', 'hidden');
-        if (Horde_Auth::isAdmin()) {
+        if ($this->isAdmin()) {
             $status[] = 'admin';
         }
 
@@ -1065,7 +1065,7 @@ class Horde_Registry
         /* Bail out if application is not present or inactive. */
         if (!isset($this->applications[$app]) ||
             $this->applications[$app]['status'] == 'inactive' ||
-            ($this->applications[$app]['status'] == 'admin' && !Horde_Auth::isAdmin())) {
+            ($this->applications[$app]['status'] == 'admin' && !$this->isAdmin())) {
             throw new Horde_Exception($app . ' is not activated.', self::NOT_ACTIVE);
         }
 
@@ -1224,7 +1224,7 @@ class Horde_Registry
 
         /* Otherwise, allow access for admins, for apps that do not have any
          * explicit permissions, or for apps that allow the given permission. */
-        return Horde_Auth::isAdmin() ||
+        return $this->isAdmin() ||
             ($GLOBALS['injector']->getInstance('Horde_Perms')->exists($app)
              ? $GLOBALS['injector']->getInstance('Horde_Perms')->hasPermission($app, Horde_Auth::getAuth(), $perms)
              : (bool)Horde_Auth::getAuth());
@@ -1588,4 +1588,36 @@ class Horde_Registry
         }
     }
 
+    /**
+     * Is a user an administrator?
+     *
+     * @param array $options  Options:
+     * <pre>
+     * 'permission' - (string) Allow users with this permission admin access
+     *                in the current context.
+     * @param integer $permlevel  The level of permissions to check for.
+     *                            Defaults to Horde_Perms::EDIT.
+     * </pre>
+     * @param string $user        The user to check. Defaults to
+     *                            self::getAuth().
+     *
+     * @return boolean  Whether or not this is an admin user.
+     */
+    public function isAdmin(array $options = array())
+    {
+        $user = isset($options['user'])
+            ? $options['user']
+            : Horde_Auth::getAuth();
+
+        if ($user &&
+            @is_array($GLOBALS['conf']['auth']['admins']) &&
+            in_array($user, $GLOBALS['conf']['auth']['admins'])) {
+            return true;
+        }
+
+        return isset($options['permission'])
+            ? $GLOBALS['injector']->getInstance('Horde_Perms')->hasPermission($options['permission'], $user, isset($options['permlevel']) ? $options['permlevel'] : Horde_Perms::EDIT)
+            : false;
+    }
+
 }
index 501b085..b586c2b 100644 (file)
@@ -679,7 +679,7 @@ class Gollem
 
         if (!empty($_SESSION['gollem'])) {
             $backend_key = $_SESSION['gollem']['backend_key'];
-            if (Horde_Auth::isAdmin()) {
+            if ($GLOBALS['registry']->isAdmin()) {
                 $menu->add(Horde_Util::addParameter(Horde::applicationUrl('permissions.php'), 'backend', $backend_key), _("_Permissions"), 'perms.png', Horde_Themes::img(null, 'horde'));
             }
 
index e1b9193..7943822 100644 (file)
@@ -9,11 +9,7 @@
  */
 
 require_once dirname(__FILE__) . '/lib/Application.php';
-Horde_Registry::appInit('gollem');
-
-if (!Horde_Auth::isAdmin()) {
-    Horde_Auth::authenticateFailure('gollem', $e);
-}
+Horde_Registry::appInit('gollem', array('admin' => true));
 
 if (!Gollem::getBackends('all')) {
     $title = _("Gollem Backend Permissions Administration");
index 5b04762..2d44c67 100644 (file)
@@ -200,7 +200,8 @@ class Horde_Api extends Horde_Registry_Api
      */
     public function removeUserData($user)
     {
-        if (!Horde_Auth::isAdmin() && $user != Horde_Auth::getAuth()) {
+        if (!$GLOBALS['registry']->isAdmin() &&
+            $user != Horde_Auth::getAuth()) {
             return PEAR::raiseError(_("You are not allowed to remove user data."));
         }
 
@@ -267,7 +268,7 @@ class Horde_Api extends Horde_Registry_Api
      */
     public function removeUserDataFromAllApplications($user)
     {
-        if (!Auth::isAdmin() && $user != Auth::getAuth()) {
+        if (!$GLOBALS['registry']->isAdmin() && $user != Auth::getAuth()) {
             return PEAR::raiseError(_("You are not allowed to remove user data."));
         }
 
@@ -311,7 +312,7 @@ class Horde_Api extends Horde_Registry_Api
      */
     public function addGroup($name, $parent = null)
     {
-        if (!Horde_Auth::isAdmin()) {
+        if (!$GLOBALS['registry']->isAdmin()) {
             return PEAR::raiseError(_("You are not allowed to add groups."));
         }
 
@@ -340,7 +341,7 @@ class Horde_Api extends Horde_Registry_Api
      */
     public function removeGroup($name)
     {
-        if (!Horde_Auth::isAdmin()) {
+        if (!$GLOBALS['registry']->isAdmin()) {
             return PEAR::raiseError(_("You are not allowed to delete groups."));
         }
 
@@ -366,7 +367,7 @@ class Horde_Api extends Horde_Registry_Api
      */
     public function addUserToGroup($name, $user)
     {
-        if (!Horde_Auth::isAdmin()) {
+        if (!$GLOBALS['registry']->isAdmin()) {
             return PEAR::raiseError(_("You are not allowed to change groups."));
         }
 
@@ -392,7 +393,7 @@ class Horde_Api extends Horde_Registry_Api
      */
     public function addUsersToGroup($name, $users)
     {
-        if (!Horde_Auth::isAdmin()) {
+        if (!$GLOBALS['registry']->isAdmin()) {
             return PEAR::raiseError(_("You are not allowed to change groups."));
         }
 
@@ -422,7 +423,7 @@ class Horde_Api extends Horde_Registry_Api
      */
     public function removeUserFromGroup($name, $user)
     {
-        if (!Horde_Auth::isAdmin()) {
+        if (!$GLOBALS['registry']->isAdmin()) {
             return PEAR::raiseError(_("You are not allowed to change groups."));
         }
 
@@ -448,7 +449,7 @@ class Horde_Api extends Horde_Registry_Api
      */
     public function removeUsersFromGroup($name, $users)
     {
-        if (!Horde_Auth::isAdmin()) {
+        if (!$GLOBALS['registry']->isAdmin()) {
             return PEAR::raiseError(_("You are not allowed to change groups."));
         }
 
@@ -481,7 +482,7 @@ class Horde_Api extends Horde_Registry_Api
      */
     public function listUsersOfGroup($name)
     {
-        if (!Horde_Auth::isAdmin()) {
+        if (!$GLOBALS['registry']->isAdmin()) {
             return PEAR::raiseError(_("You are not allowed to list users of groups."));
         }
 
@@ -508,7 +509,7 @@ class Horde_Api extends Horde_Registry_Api
      */
     public function addShare($scope, $shareName, $shareTitle, $userName)
     {
-        if (!Horde_Auth::isAdmin()) {
+        if (!$GLOBALS['registry']->isAdmin()) {
             return PEAR::raiseError(_("You are not allowed to add shares."));
         }
 
@@ -536,7 +537,7 @@ class Horde_Api extends Horde_Registry_Api
      */
     public function removeShare($scope, $shareName)
     {
-        if (!Horde_Auth::isAdmin()) {
+        if (!$GLOBALS['registry']->isAdmin()) {
             return PEAR::raiseError(_("You are not allowed to delete shares."));
         }
 
@@ -564,7 +565,7 @@ class Horde_Api extends Horde_Registry_Api
      */
     public function listSharesOfOwner($scope, $userName)
     {
-        if (!Horde_Auth::isAdmin()) {
+        if (!$GLOBALS['registry']->isAdmin()) {
             return PEAR::raiseError(_("You are not allowed to list shares."));
         }
 
@@ -589,9 +590,9 @@ class Horde_Api extends Horde_Registry_Api
      * @param array $permissions  A list of permissions (show, read, edit, delete).
      */
     public function addUserPermissions($scope, $shareName, $userName,
-        $permissions)
+                                       $permissions)
     {
-        if (!Horde_Auth::isAdmin()) {
+        if (!$GLOBALS['registry']->isAdmin()) {
             return PEAR::raiseError(_("You are not allowed to change shares."));
         }
 
@@ -626,9 +627,9 @@ class Horde_Api extends Horde_Registry_Api
      * @param array $permissions  A list of permissions (show, read, edit, delete).
      */
     public function addGroupPermissions($scope, $shareName, $groupName,
-        $permissions)
+                                        $permissions)
     {
-        if (!Horde_Auth::isAdmin()) {
+        if (!$GLOBALS['registry']->isAdmin()) {
             return PEAR::raiseError(_("You are not allowed to change shares."));
         }
 
@@ -668,7 +669,7 @@ class Horde_Api extends Horde_Registry_Api
      */
     public function removeUserPermissions($scope, $shareName, $userName)
     {
-        if (!Horde_Auth::isAdmin()) {
+        if (!$GLOBALS['registry']->isAdmin()) {
             return PEAR::raiseError(_("You are not allowed to change shares."));
         }
 
@@ -695,7 +696,7 @@ class Horde_Api extends Horde_Registry_Api
      */
     public function removeGroupPermissions($scope, $shareName, $groupName)
     {
-        if (!Horde_Auth::isAdmin()) {
+        if (!$GLOBALS['registry']->isAdmin()) {
             return PEAR::raiseError(_("You are not allowed to change shares."));
         }
 
@@ -729,7 +730,7 @@ class Horde_Api extends Horde_Registry_Api
      */
     public function listUserPermissions($scope, $shareName, $userName)
     {
-        if (!Horde_Auth::isAdmin()) {
+        if (!$GLOBALS['registry']->isAdmin()) {
             return PEAR::raiseError(_("You are not allowed to list share permissions."));
         }
 
@@ -770,7 +771,7 @@ class Horde_Api extends Horde_Registry_Api
      */
     public function listGroupPermissions($scope, $shareName, $groupName)
     {
-        if (!Horde_Auth::isAdmin()) {
+        if (!$GLOBALS['registry']->isAdmin()) {
             return PEAR::raiseError(_("You are not allowed to list share permissions."));
         }
 
@@ -811,7 +812,7 @@ class Horde_Api extends Horde_Registry_Api
      */
     public function listUsersOfShare($scope, $shareName, $permissions)
     {
-        if (!Horde_Auth::isAdmin()) {
+        if (!$GLOBALS['registry']->isAdmin()) {
             return PEAR::raiseError(_("You are not allowed to list users of shares."));
         }
 
@@ -844,7 +845,7 @@ class Horde_Api extends Horde_Registry_Api
      */
     public function listGroupsOfShare($scope, $shareName, $permissions)
     {
-        if (!Horde_Auth::isAdmin()) {
+        if (!$GLOBALS['registry']->isAdmin()) {
             return PEAR::raiseError(_("You are not allowed to list groups of shares."));
         }
 
index 5629bec..61ffd6d 100644 (file)
@@ -29,7 +29,7 @@ class Horde_Prefs_Ui
                 foreach ($apps as $a) {
                     $perms = $GLOBALS['injector']->getInstance('Horde_Perms');
                     if (file_exists($registry->get('fileroot', $a)) &&
-                        (($perms->exists($a) && ($perms->hasPermission($a, Horde_Auth::getAuth(), Horde_Perms::READ) || Horde_Auth::isAdmin())) ||
+                        (($perms->exists($a) && ($perms->hasPermission($a, Horde_Auth::getAuth(), Horde_Perms::READ) || $registry->isAdmin())) ||
                          !$perms->exists($a))) {
                         $out[$a] = $registry->get('name', $a);
                     }
index a1d034c..ca16446 100644 (file)
@@ -34,7 +34,7 @@ function canSee($app, $params, &$hasChildren)
     // Initialize variables we'll keep using in successive calls on
     // the first call.
     if (is_null($isAdmin)) {
-        $isAdmin = Horde_Auth::isAdmin();
+        $isAdmin = $registry->isAdmin();
         $user = Horde_Auth::getAuth();
     }
 
@@ -114,7 +114,7 @@ function buildMenu()
     }
 
     // Add the administration menu if the user is an admin.
-    if (Horde_Auth::isAdmin()) {
+    if ($registry->isAdmin()) {
         $menu['administration'] = array('name' => _("Administration"),
                                         'icon' => (string)Horde_Themes::img('administration.png'),
                                         'status' => 'heading');
@@ -157,7 +157,7 @@ function buildMenu()
              * application, and if the application is active.
              * Administrators always see all applications. */
             try {
-                if ((Horde_Auth::isAdmin() && $params['status'] != 'inactive') ||
+                if (($registry->isAdmin() && $params['status'] != 'inactive') ||
                     ($registry->hasPermission($application) &&
                      ($params['status'] == 'active'))) {
                     $prefs_apps[$application] = _($params['name']);
index 95499b7..e3b9133 100644 (file)
@@ -58,7 +58,7 @@ case 'edit':
 
     if (!Horde_Auth::getAuth() ||
               (isset($share) &&
-               !Horde_Auth::isAdmin() &&
+               !$registry->isAdmin() &&
                Horde_Auth::getAuth() != $share->get('owner'))) {
         exit('permission denied');
     }
@@ -73,7 +73,7 @@ case 'editform':
 
     if (!empty($share)) {
         if (!Horde_Auth::getAuth() ||
-            (!Horde_Auth::isAdmin() &&
+            (!$registry->isAdmin() &&
              Horde_Auth::getAuth() != $share->get('owner'))) {
             exit('permission denied');
         }
@@ -84,7 +84,7 @@ case 'editform':
         $new_owner_backend = Horde_Util::getFormData('owner_select', Horde_Util::getFormData('owner_input', $old_owner));
         $new_owner = Horde_Auth::convertUsername($new_owner_backend, true);
         if ($old_owner !== $new_owner && !empty($new_owner)) {
-            if ($old_owner != Horde_Auth::getAuth() && !Horde_Auth::isAdmin()) {
+            if ($old_owner != Horde_Auth::getAuth() && !$registry->isAdmin()) {
                 $notification->push(_("Only the owner or system administrator may change ownership or owner permissions for a share"), 'horde.error');
             } elseif ($auth->hasCapability('list') && !$auth->exists($new_owner_backend)) {
                 $notification->push(sprintf(_("The user \"%s\" does not exist."), $new_owner_backend), 'horde.error');
@@ -94,7 +94,7 @@ case 'editform':
             }
         }
 
-        if (Horde_Auth::isAdmin() ||
+        if ($registry->isAdmin() ||
             !empty($GLOBALS['conf']['share']['world'])) {
             // Process default permissions.
             if (Horde_Util::getFormData('default_show')) {
index df6a9d3..772b14b 100644 (file)
@@ -50,7 +50,7 @@ if (isset($userperms[$owner])) {
   </td>
 </tr>
 
-<?php if (Horde_Auth::isAdmin() || !empty($GLOBALS['conf']['share']['world'])): ?>
+<?php if ($GLOBALS['registry']->isAdmin() || !empty($GLOBALS['conf']['share']['world'])): ?>
 <!-- Spacer -->
 <tr><td>&nbsp;</td></tr>
 
index 826919e..ffc3f09 100644 (file)
@@ -161,7 +161,7 @@ class Ingo_Application extends Horde_Registry_Application
      */
     public function removeUserData($user)
     {
-        if (!Horde_Auth::isAdmin() &&
+        if (!$GLOBALS['registry']->isAdmin() &&
             ($user != Horde_Auth::getAuth())) {
             throw new Horde_Auth_Exception(_("You are not allowed to remove user data."));
         }
index 4ef3e4b..e52aef0 100644 (file)
@@ -391,7 +391,8 @@ class Ingo_Storage_Sql extends Ingo_Storage
      */
     public function removeUserData($user)
     {
-        if (!Horde_Auth::isAdmin() && $user != Horde_Auth::getAuth()) {
+        if (!$GLOBALS['registry']->isAdmin() &&
+            $user != Horde_Auth::getAuth()) {
             throw new Ingo_Exception(_("Permission Denied"));
         }
 
index 8503147..06b039e 100644 (file)
@@ -117,7 +117,7 @@ class Jonah {
      */
     function checkPermissions($filter, $permission = Horde_Perms::READ, $in = null)
     {
-        if (Horde_Auth::isAdmin('jonah:admin', $permission)) {
+        if ($GLOBALS['registry']->isAdmin(array('permission' => 'jonah:admin', 'permlevel' =>  $permission))) {
             if (empty($in)) {
                 // Calls with no $in parameter are checking whether this user
                 // has permission.  Since this user is an admin, they always
index e69b7a3..281cf89 100644 (file)
@@ -34,7 +34,7 @@ try {
     exit;
 }
 if ($calendar->get('owner') != Horde_Auth::getAuth() &&
-    (!is_null($calendar->get('owner')) || !Horde_Auth::isAdmin())) {
+    (!is_null($calendar->get('owner')) || !$registry->isAdmin())) {
     $notification->push(_("You are not allowed to delete this calendar."), 'horde.error');
     header('Location: ' . Horde::applicationUrl('calendars/', true));
     exit;
index b165eb5..c77947b 100644 (file)
@@ -28,7 +28,7 @@ try {
     exit;
 }
 if ($calendar->get('owner') != Horde_Auth::getAuth() &&
-    (!is_null($calendar->get('owner')) || !Horde_Auth::isAdmin())) {
+    (!is_null($calendar->get('owner')) || !$registry->isAdmin())) {
     $notification->push(_("You are not allowed to change this calendar."), 'horde.error');
     header('Location: ' . Horde::applicationUrl('calendars/', true));
     exit;
index 020ce6c..81f323d 100644 (file)
@@ -51,7 +51,7 @@ foreach ($my_calendars as $calendar) {
     $calendars[$calendar->getName()] = $calendar;
     $sorted_calendars[$calendar->getName()] = $calendar->get('name');
 }
-if (Horde_Auth::isAdmin()) {
+if ($registry->isAdmin()) {
     $system_calendars = $kronolith_shares->listSystemShares();
     foreach ($system_calendars as $calendar) {
         $calendars[$calendar->getName()] = $calendar;
index 0202aa4..1306149 100644 (file)
@@ -37,7 +37,7 @@ if ($eventID = Horde_Util::getFormData('eventID')) {
             $have_perms = true;
         }
     } else {
-        if (!Horde_Auth::isAdmin()) {
+        if (!$registry->isAdmin()) {
             $notification->push(_("You do not have permission to delete this event."), 'horde.warning');
         } else {
             $have_perms = true;
index b6bac14..af263f6 100644 (file)
@@ -43,8 +43,6 @@ class Kronolith_Ajax_Imple_TagActions extends Horde_Ajax_Imple_Base
      */
     public function handle($args, $post)
     {
-        global $ansel_storage;
-
         $request = $args['action'];
         $content = array('id' => $post['resource'], 'type' => $post['type']);
         $tags = rawurldecode($post['tags']);
@@ -60,7 +58,9 @@ class Kronolith_Ajax_Imple_TagActions extends Horde_Ajax_Imple_Base
 
         // $owner is null for system-owned shares, so an admin has perms,
         // otherwise, make sure the resource owner is the current user
-        $perm = empty($owner) ? Horde_Auth::isAdmin() : $owner == Horde_Auth::getAuth();
+        $perm = empty($owner)
+            ? $GLOBALS['registry']->isAdmin()
+            : $owner == Horde_Auth::getAuth();
 
         if ($perm) {
             $tagger = Kronolith::getTagger();
index 12b3d01..a83fdd2 100644 (file)
@@ -841,7 +841,7 @@ class Kronolith_Api extends Horde_Registry_Api
         $events = $kronolith_driver->getByUID($uid, null, true);
 
         $event = null;
-        if (Horde_Auth::isAdmin()) {
+        if ($GLOBALS['registry']->isAdmin()) {
             $event = $events[0];
         }
 
@@ -849,7 +849,7 @@ class Kronolith_Api extends Horde_Registry_Api
         if (empty($event)) {
             $ownerCalendars = Kronolith::listCalendars(true, Horde_Perms::DELETE);
             foreach ($events as $ev) {
-                if (Horde_Auth::isAdmin() || isset($ownerCalendars[$ev->calendar])) {
+                if ($GLOBALS['registry']->isAdmin() || isset($ownerCalendars[$ev->calendar])) {
                     $event = $ev;
                     break;
                 }
@@ -1136,7 +1136,7 @@ class Kronolith_Api extends Horde_Registry_Api
         require_once 'Horde/Group.php';
 
         $current_user = Horde_Auth::getAuth();
-        if ((empty($user) || $user != $current_user) && !Horde_Auth::isAdmin()) {
+        if ((empty($user) || $user != $current_user) && !$GLOBALS['registry']->isAdmin()) {
             throw new Horde_Exception_PermissionDenied();
         }
 
index 9b19b77..1934be5 100644 (file)
@@ -430,7 +430,8 @@ class Kronolith_Application extends Horde_Registry_Application
      */
     public function removeUserData($user)
     {
-        if (!Horde_Auth::isAdmin() && $user != Horde_Auth::getAuth()) {
+        if (!$GLOBALS['registry']->isAdmin() &&
+            $user != Horde_Auth::getAuth()) {
             throw new Kronolith_Exception(_("You are not allowed to remove user data."));
         }
 
index 16b9aec..47d8013 100644 (file)
@@ -166,7 +166,7 @@ class Kronolith_Driver_Resource extends Kronolith_Driver_Sql
     public function listResources($perms = Horde_Perms::READ, $filter = array())
     {
         if (($perms & (Horde_Perms::EDIT | Horde_Perms::DELETE)) &&
-            !Horde_Auth::isAdmin()) {
+            !$GLOBALS['registry']->isAdmin()) {
             return array();
         }
 
index 2b547ec..1e95205 100644 (file)
@@ -979,7 +979,7 @@ class Kronolith_Driver_Sql extends Kronolith_Driver
     {
         throw new Kronolith_Exception('to be refactored');
 
-        if (!Horde_Auth::isAdmin()) {
+        if (!$GLOBALS['registry']->isAdmin()) {
             throw new Horde_Exception_PermissionDenied();
         }
 
index 8b002f8..2d68ace 100644 (file)
@@ -1753,10 +1753,10 @@ abstract class Kronolith_Event
         $end = $this->end->format($twentyFour ? 'G:i' : 'g:ia');
 
         // We explicitly allow admin access here for the alarms notifications.
-        if (!Horde_Auth::isAdmin() && $this->private &&
+        if (!$GLOBALS['registry']->isAdmin() && $this->private &&
             $this->creator != $user) {
             return _("busy");
-        } elseif (Horde_Auth::isAdmin() || $this->hasPermission(Horde_Perms::READ, $user)) {
+        } elseif ($GLOBALS['registry']->isAdmin() || $this->hasPermission(Horde_Perms::READ, $user)) {
             return strlen($this->title) ? $this->title : _("[Unnamed event]");
         } else {
             return _("busy");
index f42944a..bc059c7 100644 (file)
@@ -209,11 +209,7 @@ class Kronolith_Event_Resource extends Kronolith_Event
      */
     public function hasPermission($permission, $user = null)
     {
-        if (Horde_Auth::isAdmin()) {
-            return true;
-        }
-
-        return false;
+        return $GLOBALS['registry']->isAdmin();
     }
 
 }
index b95e7fd..c9ae419 100755 (executable)
@@ -25,7 +25,7 @@ class Kronolith_CreateCalendarForm extends Horde_Form
         $this->addVariable(_("Color"), 'color', 'colorpicker', false);
         $this->addVariable(_("Description"), 'description', 'longtext', false, false, null, array(4, 60));
         $this->addVariable(_("Tags"), 'tags', 'text', false);
-        if (Horde_Auth::isAdmin()) {
+        if ($GLOBALS['registry']->isAdmin()) {
             $this->addVariable(_("System Calendar"), 'system', 'boolean', false, false, _("System calendars don't have an owner. Only administrators can change the calendar settings and permissions."));
         }
 
index 8c525a4..5dff62d 100644 (file)
@@ -32,7 +32,7 @@ class Kronolith_EditCalendarForm extends Horde_Form
         $this->addVariable(_("Color"), 'color', 'colorpicker', false);
         $this->addVariable(_("Description"), 'description', 'longtext', false, false, null, array(4, 60));
         $this->addVariable(_("Tags"), 'tags', 'text', false);
-        if (Horde_Auth::isAdmin()) {
+        if ($GLOBALS['registry']->isAdmin()) {
             $this->addVariable(_("System Calendar"), 'system', 'boolean', false, false, _("System calendars don't have an owner. Only administrators can change the calendar settings and permissions."));
         }
 
index 982937f..81559fc 100644 (file)
@@ -1528,7 +1528,7 @@ class Kronolith
     {
         if (!Horde_Auth::getAuth() ||
             ($calendar->get('owner') != Horde_Auth::getAuth() &&
-             (!is_null($calendar->get('owner')) || !Horde_Auth::isAdmin()))) {
+             (!is_null($calendar->get('owner')) || !$GLOBALS['registry']->isAdmin()))) {
             throw new Kronolith_Exception(_("You are not allowed to change this calendar."));
         }
 
@@ -1563,7 +1563,7 @@ class Kronolith
 
         if (!Horde_Auth::getAuth() ||
             ($calendar->get('owner') != Horde_Auth::getAuth() &&
-             (!is_null($calendar->get('owner')) || !Horde_Auth::isAdmin()))) {
+             (!is_null($calendar->get('owner')) || !$GLOBALS['registry']->isAdmin()))) {
             throw new Kronolith_Exception(_("You are not allowed to delete this calendar."));
         }
 
@@ -1613,7 +1613,7 @@ class Kronolith
         $new_owner_backend = Horde_Util::getFormData('owner_select', Horde_Util::getFormData('owner_input', $old_owner));
         $new_owner = Horde_Auth::convertUsername($new_owner_backend, true);
         if ($old_owner !== $new_owner && !empty($new_owner)) {
-            if ($old_owner != Horde_Auth::getAuth() && !Horde_Auth::isAdmin()) {
+            if ($old_owner != Horde_Auth::getAuth() && !$GLOBALS['registry']->isAdmin()) {
                 $errors[] = _("Only the owner or system administrator may change ownership or owner permissions for a share");
             } elseif ($auth->hasCapability('list') && !$auth->exists($new_owner_backend)) {
                 $errors[] = sprintf(_("The user \"%s\" does not exist."), $new_owner_backend);
@@ -1640,7 +1640,7 @@ class Kronolith
             }
         }
 
-        if (Horde_Auth::isAdmin() ||
+        if ($GLOBALS['registry']->isAdmin() ||
             !empty($GLOBALS['conf']['share']['world'])) {
             // Process default permissions.
             if (Horde_Util::getFormData('default_show')) {
index e8ff47a..5e66c3d 100644 (file)
@@ -93,11 +93,7 @@ abstract class Kronolith_Resource_Base
      */
     public function hasPermission($user, $permission = Horde_Perms::READ, $restrict = null)
     {
-        if (Horde_Auth::isAdmin()) {
-            return true;
-        }
-
-        return false;
+        return $GLOBALS['registry']->isAdmin();
     }
 
     /**
@@ -219,4 +215,4 @@ abstract class Kronolith_Resource_Base
      */
     abstract public function getResponseType();
 
-}
\ No newline at end of file
+}
index f1b99ca..187e65e 100644 (file)
@@ -44,7 +44,7 @@ case 'edit':
 
     if (!Horde_Auth::getAuth() ||
         (isset($share) &&
-         !Horde_Auth::isAdmin() &&
+         !$registry->isAdmin() &&
          Horde_Auth::getAuth() != $share->get('owner'))) {
         exit('permission denied');
     }
@@ -54,7 +54,7 @@ case 'editform':
     try {
         $share = $shares->getShareById(Horde_Util::getFormData('cid'));
         if (!Horde_Auth::getAuth() ||
-            (!Horde_Auth::isAdmin() &&
+            (!$registry->isAdmin() &&
              Horde_Auth::getAuth() != $share->get('owner'))) {
             exit('permission denied');
         }
index 4067c55..557775e 100644 (file)
 require_once dirname(__FILE__) . '/../lib/Application.php';
 Horde_Registry::appInit('kronolith');
 
-require_once KRONOLITH_BASE . '/lib/Forms/CreateResource.php';
-
 // Exit if this isn't an authenticated, administrative user
-if (!Horde_Auth::isAdmin()) {
+if (!$registry->isAdmin()) {
     header('Location: ' . Horde::applicationUrl($prefs->getValue('defaultview') . '.php', true));
     exit;
 }
 
+require_once KRONOLITH_BASE . '/lib/Forms/CreateResource.php';
+
 $vars = Horde_Variables::getDefaultVariables();
 $form = new Kronolith_CreateResourceForm($vars);
 
index c2015c3..ddef5c2 100644 (file)
@@ -14,7 +14,7 @@ Horde_Registry::appInit('kronolith');
 require_once KRONOLITH_BASE . '/lib/Forms/DeleteResource.php';
 
 // Exit if this isn't an authenticated administrative user.
-if (!Horde_Auth::isAdmin()) {
+if (!$registry->isAdmin()) {
     header('Location: ' . Horde::applicationUrl($prefs->getValue('defaultview') . '.php', true));
     exit;
 }
index 41d271e..c465a91 100644 (file)
@@ -14,7 +14,7 @@ Horde_Registry::appInit('kronolith');
 require_once KRONOLITH_BASE . '/lib/Forms/EditResource.php';
 
 // Exit if this isn't an authenticated administrative user.
-if (!Horde_Auth::isAdmin()) {
+if (!$registry->isAdmin()) {
     header('Location: ' . Horde::applicationUrl($prefs->getValue('defaultview') . '.php', true));
     exit;
 }
index 063fe23..05b3652 100644 (file)
@@ -14,7 +14,7 @@ Horde_Registry::appInit('kronolith');
 require_once KRONOLITH_BASE . '/lib/Forms/CreateResourceGroup.php';
 
 // Exit if this isn't an authenticated, administrative user
-if (!Horde_Auth::isAdmin()) {
+if (!$registry->isAdmin()) {
     header('Location: ' . Horde::applicationUrl($prefs->getValue('defaultview') . '.php', true));
     exit;
 }
index d2e3f6d..1003c40 100644 (file)
@@ -14,7 +14,7 @@ Horde_Registry::appInit('kronolith');
 require_once KRONOLITH_BASE . '/lib/Forms/DeleteResourceGroup.php';
 
 // Exit if this isn't an authenticated administrative user.
-if (!Horde_Auth::isAdmin()) {
+if (!$registry->isAdmin()) {
     header('Location: ' . Horde::applicationUrl($prefs->getValue('defaultview') . '.php', true));
     exit;
 }
index 161164f..9c2bf75 100644 (file)
@@ -14,7 +14,7 @@ Horde_Registry::appInit('kronolith');
 require_once KRONOLITH_BASE . '/lib/Forms/EditResourceGroup.php';
 
 // Exit if this isn't an authenticated administrative user.
-if (!Horde_Auth::isAdmin()) {
+if (!$registry->isAdmin()) {
     header('Location: ' . Horde::applicationUrl($prefs->getValue('defaultview') . '.php', true));
     exit;
 }
index 22a68e4..4005031 100644 (file)
@@ -40,7 +40,7 @@ function performAction(action, rid)
 <h1 class="header">
  <?php echo _("Resources") ?>
 </h1>
-<?php if ($isAdmin = Horde_Auth::isAdmin()): ?>
+<?php if ($isAdmin = $registry->isAdmin()): ?>
  <form method="get" action="create.php">
   <?php echo Horde_Util::formInput() ?>
   <input type="submit" class="button" value="<?php echo _("Create a new Resource Group") ?>" />
index 6afc017..42ddd1b 100644 (file)
@@ -39,7 +39,7 @@ function performAction(action, rid)
 <h1 class="header">
  <?php echo _("Resources") ?>
 </h1>
-<?php if ($isAdmin = Horde_Auth::isAdmin()): ?>
+<?php if ($isAdmin = $registry->isAdmin()): ?>
  <form method="get" action="create.php">
   <?php echo Horde_Util::formInput() ?>
   <input type="submit" class="button" value="<?php echo _("Create a new Resource") ?>" />
index a208833..ff28fdd 100644 (file)
@@ -93,7 +93,7 @@ if (count($groups) > 1) {
       </thead>
 
       <tbody>
-      <?php if (Horde_Auth::isAdmin() || !empty($GLOBALS['conf']['share']['world'])): ?>
+      <?php if ($GLOBALS['registry']->isAdmin() || !empty($GLOBALS['conf']['share']['world'])): ?>
       <!-- Default Permissions -->
       <tr>
         <td><?php echo _("All Authenticated Users") ?></td>
index 0762f78..4023f29 100644 (file)
@@ -68,7 +68,7 @@ $tagger = Kronolith::getTagger();
 <?php if (Horde_Auth::getAuth()): ?>
  <p>
   <a href="<?php echo Horde::applicationUrl('calendars/') ?>"><?php echo _("[Manage Calendars]") ?></a><br />
-  <a href="<?php echo Horde::applicationUrl('resources/')?>"><?php echo (Horde_Auth::isAdmin() ? _("[Manage Resource Calendars]") : _("[Resource Calendars]"))?></a>
+  <a href="<?php echo Horde::applicationUrl('resources/')?>"><?php echo ($GLOBALS['registry']->isAdmin() ? _("[Manage Resource Calendars]") : _("[Resource Calendars]"))?></a>
  </p>
 <?php endif; ?>
 
index c663746..ffc7ea4 100644 (file)
@@ -40,7 +40,7 @@
   </td>
 </tr>
 
-<?php if (Horde_Auth::isAdmin() || !empty($GLOBALS['conf']['share']['world'])): ?>
+<?php if ($GLOBALS['registry']->isAdmin() || !empty($GLOBALS['conf']['share']['world'])): ?>
 <!-- Spacer -->
 <tr><td colspan="7">&nbsp;</td></tr>
 
index 91110f3..1c6e912 100644 (file)
@@ -286,7 +286,7 @@ class Luxor
     {
         global $source;
 
-        if (Horde_Auth::isAdmin()) {
+        if ($GLOBALS['registry']->isAdmin()) {
             return false;
         }
 
index b428f82..0ae0208 100644 (file)
@@ -27,7 +27,7 @@ class Mnemo_Api extends Horde_Registry_Api {
      */
     public function removeUserData($user)
     {
-        if (!Horde_Auth::isAdmin() && $user != Horde_Auth::getAuth()) {
+        if (!$GLOBALS['registry']->isAdmin() && $user != Horde_Auth::getAuth()) {
             return PEAR::raiseError(_("You are not allowed to remove user data."));
         }
 
@@ -373,7 +373,7 @@ class Mnemo_Api extends Horde_Registry_Api {
             return $memo;
         }
 
-        if (!Horde_Auth::isAdmin() &&
+        if (!$GLOBALS['registry']->isAdmin() &&
             !array_key_exists($memo['memolist_id'],
                               Mnemo::listNotepads(false, Horde_Perms::DELETE))) {
             return PEAR::raiseError(_("Permission Denied"));
@@ -440,4 +440,4 @@ class Mnemo_Api extends Horde_Registry_Api {
             return PEAR::raiseError(sprintf(_("Unsupported Content-Type: %s"),$contentType));
         }
     }
-}
\ No newline at end of file
+}
index 0d25b83..7cba2b9 100644 (file)
@@ -861,7 +861,7 @@ class Nag_Api extends Horde_Registry_Api
                         !empty($task->private),
                         Horde_Auth::getAuth(),
                         isset($task->assignee) ? $task->assignee : null);
-            
+
             /* array index 0 is id, 1 is uid */
             return $results[1];
         }
@@ -876,7 +876,7 @@ class Nag_Api extends Horde_Registry_Api
      */
     public function addTask($task)
     {
-        if (!Horde_Auth::isAdmin() &&
+        if (!$GLOBALS['registry']->isAdmin() &&
             !array_key_exists($task['tasklist'],
                               Nag::listTasklists(false, Horde_Perms::EDIT))) {
             return PEAR::raiseError(_("Permission Denied"));
@@ -1103,7 +1103,7 @@ class Nag_Api extends Horde_Registry_Api
             return $task;
         }
 
-        if (!Horde_Auth::isAdmin() &&
+        if (!$GLOBALS['registry']->isAdmin() &&
             !array_key_exists($task->tasklist,
                               Nag::listTasklists(false, Horde_Perms::DELETE))) {
             return PEAR::raiseError(_("Permission Denied"));
@@ -1120,7 +1120,7 @@ class Nag_Api extends Horde_Registry_Api
      */
     public function deleteTask($tasklist, $id)
     {
-        if (!Horde_Auth::isAdmin() &&
+        if (!$GLOBALS['registry']->isAdmin() &&
             !array_key_exists($tasklist,
                               Nag::listTasklists(false, Horde_Perms::DELETE))) {
             return PEAR::raiseError(_("Permission Denied"));
@@ -1240,7 +1240,7 @@ class Nag_Api extends Horde_Registry_Api
      */
     public function updateTask($tasklist, $id, $task)
     {
-        if (!Horde_Auth::isAdmin() &&
+        if (!$GLOBALS['registry']->isAdmin() &&
             !array_key_exists($tasklist,
                               Nag::listTasklists(false, Horde_Perms::EDIT))) {
             return PEAR::raiseError(_("Permission Denied"));
@@ -1372,7 +1372,8 @@ class Nag_Api extends Horde_Registry_Api
     {
         require_once 'Horde/Group.php';
 
-        if ((empty($user) || $user != Horde_Auth::getAuth()) && !Horde_Auth::isAdmin()) {
+        if ((empty($user) || $user != Horde_Auth::getAuth()) &&
+            !$GLOBALS['registry']->isAdmin()) {
             return PEAR::raiseError(_("Permission Denied"));
         }
 
index aed9603..6248879 100644 (file)
@@ -234,7 +234,7 @@ class Nag_Application extends Horde_Registry_Application
      */
     public function removeUserData($user)
     {
-        if (!Horde_Auth::isAdmin() && $user != Horde_Auth::getAuth()) {
+        if (!$GLOBALS['registry']->isAdmin() && $user != Horde_Auth::getAuth()) {
             return PEAR::raiseError(_("You are not allowed to remove user data."));
         }
 
index 2f3302c..ccdeb98 100644 (file)
@@ -30,7 +30,7 @@ class Nag_CreateTaskListForm extends Horde_Form {
         $this->addVariable(_("Name"), 'name', 'text', true);
         $this->addVariable(_("Color"), 'color', 'colorpicker', false);
         $this->addVariable(_("Description"), 'description', 'longtext', false, false, null, array(4, 60));
-        if (Horde_Auth::isAdmin()) {
+        if ($GLOBALS['registry']->isAdmin()) {
             $this->addVariable(_("System Task List"), 'system', 'boolean', false, false, _("System task lists don't have an owner. Only administrators can change the task list settings and permissions."));
         }
 
index a4b88d0..c7499da 100644 (file)
@@ -36,7 +36,7 @@ class Nag_EditTaskListForm extends Horde_Form {
         $this->addHidden('', 't', 'text', true);
         $this->addVariable(_("Task List Name"), 'name', 'text', true);
         $this->addVariable(_("Task List Description"), 'description', 'longtext', false, false, null, array(4, 60));
-        if (Horde_Auth::isAdmin()) {
+        if ($GLOBALS['registry']->isAdmin()) {
             $this->addVariable(_("System Task List"), 'system', 'boolean', false, false, _("System task lists don't have an owner. Only administrators can change the task list settings and permissions."));
         }
 
index ece4d2b..51899b1 100644 (file)
@@ -469,7 +469,7 @@ class Nag
     {
         if (!Horde_Auth::getAuth() ||
             ($tasklist->get('owner') != Horde_Auth::getAuth() &&
-             (!is_null($tasklist->get('owner')) || !Horde_Auth::isAdmin()))) {
+             (!is_null($tasklist->get('owner')) || !$GLOBALS['registry']->isAdmin()))) {
             return PEAR::raiseError(_("You are not allowed to change this task list."));
         }
 
@@ -496,7 +496,7 @@ class Nag
 
         if (!Horde_Auth::getAuth() ||
             ($tasklist->get('owner') != Horde_Auth::getAuth() &&
-             (!is_null($tasklist->get('owner')) || !Horde_Auth::isAdmin()))) {
+             (!is_null($tasklist->get('owner')) || !$GLOBALS['registry']->isAdmin()))) {
             return PEAR::raiseError(_("You are not allowed to delete this task list."));
         }
 
index b3ccb0e..df83ef7 100644 (file)
@@ -32,7 +32,7 @@ try {
     exit;
 }
 if ($tasklist->get('owner') != Horde_Auth::getAuth() &&
-    (!is_null($tasklist->get('owner')) || !Horde_Auth::isAdmin())) {
+    (!is_null($tasklist->get('owner')) || !$GLOBALS['registry']->isAdmin())) {
     $notification->push(_("You are not allowed to delete this task list."), 'horde.error');
     header('Location: ' . Horde::applicationUrl('tasklists/', true));
     exit;
index dd264ef..4c7e375 100644 (file)
@@ -26,7 +26,7 @@ try {
     exit;
 }
 if ($tasklist->get('owner') != Horde_Auth::getAuth() &&
-    (!is_null($tasklist->get('owner')) || !Horde_Auth::isAdmin())) {
+    (!is_null($tasklist->get('owner')) || !$GLOBALS['registry']->isAdmin())) {
     $notification->push(_("You are not allowed to change this task list."), 'horde.error');
     header('Location: ' . Horde::applicationUrl('tasklists/', true));
     exit;
index 2e2b098..3574baf 100644 (file)
@@ -47,7 +47,7 @@ $sorted_tasklists = array();
 foreach ($tasklists as $tasklist) {
     $sorted_tasklists[$tasklist->getName()] = $tasklist->get('name');
 }
-if (Horde_Auth::isAdmin()) {
+if ($registry->isAdmin()) {
     $system_tasklists = $nag_shares->listSystemShares();
     foreach ($system_tasklists as $tasklist) {
         $tasklists[$tasklist->getName()] = $tasklist;
index 11fd755..7863721 100644 (file)
@@ -215,8 +215,7 @@ if ($conf['attributes']['attachments']) {
     }
 }
 
-if (Horde_Auth::isAdmin('news:admin')) {
-
+if ($registry->isAdmin(array('permission' => 'news:admin'))) {
     $form->setSection('admin', _("Admin"), '', true);
     $form->addVariable(_("News administrator options"), 'content', 'header', false);
 
index 895be18..53bcc48 100644 (file)
@@ -11,7 +11,7 @@
  */
 
 /* Only admin should be using this. */
-if (!Horde_Auth::isAdmin('news:admin')) {
+if (!$registry->isAdmin(array('permission' => 'news:admin'))) {
     $notification->push(_("You are not authorised for this action."), 'horde.warning');
     Horde_Auth::authenticateFailure('news');
 }
index 30e8974..ff03684 100644 (file)
@@ -15,7 +15,7 @@
 
 require_once dirname(__FILE__) . '/lib/base.php';
 
-if (!Horde_Auth::isAdmin('news:admin')) {
+if (!$registry->isAdmin(array('permission' => 'news:admin'))) {
     $notification->push(_("Only admin can delete a news."));
     header('Location: ' . Horde::applicationUrl('edit.php'));
     exit;
index cc686b7..4078fcd 100644 (file)
@@ -15,7 +15,7 @@
 
 require_once dirname(__FILE__) . '/lib/base.php';
 
-if (!Horde_Auth::isAdmin('news:admin')) {
+if (!$registry->isAdmin(array('permission' => 'news:admin'))) {
     $notification->push(_("Only admin can delete a news."));
     header('Location: ' . Horde::applicationUrl('edit.php'));
     exit;
index a169d9a..b340353 100644 (file)
@@ -27,10 +27,9 @@ $file_size = Horde_Util::getFormData('file_size');
 /* Run through action handlers. */
 switch ($actionID) {
 case 'download_file':
-
     $data = News::getFile($file_id);
     if ($data instanceof PEAR_Error) {
-        if (Horde_Auth::isAdmin('news:admin')) {
+        if ($registry->isAdmin(array('permission' => 'news:admin'))) {
             throw new Horde_Exception_Prior($data);
         } else {
             header('HTTP/1.0 404 Not Found');
@@ -47,7 +46,7 @@ case 'view_file':
 
     $data = News::getFile($file_id);
     if ($data instanceof PEAR_Error) {
-        if (Horde_Auth::isAdmin('news:admin')) {
+        if ($registry->isAdmin(array('permission' => 'news:admin'))) {
             throw new Horde_Exception_Prior($data);
         } else {
             header('HTTP/1.0 404 Not Found');
@@ -105,7 +104,7 @@ break;
 case 'download_zip':
     $data = News::getFile($file_id);
     if ($data instanceof PEAR_Error) {
-        if (Horde_Auth::isAdmin('news:admin')) {
+        if ($registry->isAdmin(array('permission' => 'news:admin'))) {
             throw new Horde_Exception_Prior($data);
         } else {
             header('HTTP/1.0 404 Not Found');
index 799a18b..270ce00 100644 (file)
@@ -240,7 +240,7 @@ class News_Categories {
         $cats = $this->getCategories();
         $perms = $GLOBALS['injector']->getInstance('Horde_Perms');
 
-        if (Horde_Auth::isAdmin('news:admin') ||
+        if ($GLOBALS['registry']->isAdmin(array('permission' => 'news:admin')) ||
             $perms->hasPermission('news', Horde_Auth::getAuth(), $perm)) {
             return $cats;
         }
index 2385cfd..bd27be0 100644 (file)
@@ -55,7 +55,7 @@ class News_Driver {
     public function get($id)
     {
         // Admins bypass the cache (can read nonpublished and locked news)
-        if (!Horde_Auth::isAdmin('news:admin')) {
+        if (!$GLOBALS['registry']->isAdmin(array('permission' => 'news:admin'))) {
             $key = 'news_'  . News::getLang() . '_' . $id;
             $data = $GLOBALS['cache']->get($key, $GLOBALS['conf']['cache']['default_lifetime']);
             if ($data) {
@@ -68,7 +68,7 @@ class News_Driver {
             return $data;
         }
 
-        if (!Horde_Auth::isAdmin('news:admin')) {
+        if (!$GLOBALS['registry']->isAdmin(array('permission' => 'news:admin'))) {
             $GLOBALS['cache']->set($key, serialize($data));
         }
 
index 4d0de1a..cef316f 100644 (file)
@@ -71,7 +71,7 @@ class News_Driver_sql extends News_Driver {
                 ' WHERE n.id = ? AND n.id=l.id AND l.lang = ?';
 
         /** TODO Allow for now to allow static linked news, but not shown in list
-        if (!Horde_Auth::isAdmin('news:admin')) {
+        if (!$registry->isAdmin(array('permission' => 'news:admin'))) {
             $query .= ' AND n.status = ' . News::CONFIRMED;
         }
         */
index 09f9786..85059a1 100644 (file)
@@ -49,7 +49,7 @@ class News_Search extends Horde_Form {
         $this->addVariable(_("Unpublish"), 'unpublish', 'datetime', false, false, false, $GLOBALS['news']->datetimeParams());
         $this->addVariable(_("User"), 'user', 'text', false, false, false);
 
-        if (Horde_Auth::isAdmin()) {
+        if ($GLOBALS['registry']->isAdmin()) {
             $this->addVariable(_("Editor"), 'editor', 'text', false, false, false);
         }
 
index e643734..a4a88fc 100644 (file)
@@ -191,7 +191,7 @@ class News {
             return '';
         }
 
-        if (Horde_Auth::isAdmin('news:admin')) {
+        if ($GLOBALS['registry']->isAdmin(array('permission' => 'news:admin'))) {
             $delete_img = Horde::img('delete.png', _("Delete"), ' style="width: 16px height: 16px"');
             $delete_url = Horde::applicationUrl('delete_file.php');
         }
@@ -211,7 +211,7 @@ class News {
             $html .= Horde::link(Horde_Util::addParameter($view_url, 'actionID', 'download_file'), sprintf(_("Dowload %s"), $file['file_name'])) . $dowload_img . '</a> ' . "\n";
             $html .= Horde::link(Horde_Util::addParameter($view_url, 'actionID', 'view_file'), sprintf(_("Preview %s"), $file['file_name']), '', '_file_view');
             $html .= Horde::img(Horde_Mime_Viewer::getIcon($file['file_type']), $file['file_name'], 'width="16" height="16"', '') . ' ';
-            if (Horde_Auth::isAdmin('news:admin')) {
+            if ($GLOBALS['registry']->isAdmin(array('permission' => 'news:admin'))) {
                 $html .= Horde::link(Horde_Util::addParameter($delete_url, $file), sprintf(_("Delete %s"), $file['file_name'])) . $delete_img . '</a> ' . "\n";
             }
             $html .= $file['file_name'] . '</a> ' . "\n";
@@ -458,7 +458,7 @@ class News {
             $menu->add(Horde::applicationUrl('cloud.php'), _("Tag cloud"), 'colorpicker.png', $img_dir);
         }
 
-        if (Horde_Auth::isAdmin('news:admin')) {
+        if ($GLOBALS['registry']->isAdmin(array('permission' => 'news:admin'))) {
             $menu->add(Horde::applicationUrl('edit.php'), _("Editorship"), 'config.png', $img_dir);
             $menu->add(Horde::applicationUrl('admin/categories/index.php'), _("Administration"), 'administration.png', $img_dir);
         }
index 1c483d4..969d247 100644 (file)
@@ -52,10 +52,9 @@ class News_Search extends Horde_Form {
         $this->addVariable(_("Unpublish"), 'unpublish', 'datetime', false, false, false, News::datetimeParams());
         $this->addVariable(_("User"), 'user', 'text', false, false, false);
 
-        if (Horde_Auth::isAdmin()) {
+        if ($GLOBALS['registry']->isAdmin()) {
             $this->addVariable(_("Editor"), 'editor', 'text', false, false, false);
         }
-
     }
 
     /**
index 4885213..3b21102 100644 (file)
@@ -10,7 +10,7 @@ echo Horde::link(Horde_Util::addParameter($browse_url, 'id', $row['id']), _("Inf
      Horde::img('devel.png', _("Info"), '', $img_dir). '</a>  &nbsp;';
 
 /* admins options */
-if (Horde_Auth::isAdmin() || isset($allowed_cats[$row['category1']]) || isset($allowed_cats[$row['category2']])) {
+if ($registry->isAdmin() || isset($allowed_cats[$row['category1']]) || isset($allowed_cats[$row['category2']])) {
 
     if ($row['status'] == News::CONFIRMED) {
         $url = Horde_Util::addParameter($browse_url, array('page' => $page, 'actionID' => 'deactivate', 'id' =>  $row['id']));
index 5aee870..e6e9b0e 100644 (file)
@@ -45,7 +45,7 @@ class Operator_Driver {
         }
 
         $perms = $GLOBALS['injector']->getInstance('Horde_Perms');
-        if (Horde_Auth::isAdmin() ||
+        if ($GLOBALS['registry']->isAdmin() ||
             $perms->hasPermission('operator:accountcodes',
                                               Horde_Auth::getAuth(),
                                               Horde_Perms::READ) ||
@@ -82,7 +82,7 @@ class Operator_Driver {
             $permentry = 'operator:accountcodes:' . $accountcode;
         }
         $perms = $GLOBALS['injector']->getInstance('Horde_Perms');
-        if (Horde_Auth::isAdmin() ||
+        if ($GLOBALS['registry']->isAdmin() ||
             $perms->hasPermission('operator:accountcodes',
                                               Horde_Auth::getAuth(),
                                               Horde_Perms::READ) ||
index 70b1706..6c6b37c 100644 (file)
@@ -101,7 +101,7 @@ class Operator {
         $keys = $values = $operator->driver->getAccountCodes();
         $perms = $GLOBALS['injector']->getInstance('Horde_Perms');
 
-        if (Horde_Auth::isAdmin() ||
+        if ($GLOBALS['registry']->isAdmin() ||
             $perms->hasPermission('operator:accountcodes',
                                              Horde_Auth::getAuth(),
                                              Horde_Perms::READ)) {
@@ -134,7 +134,7 @@ class Operator {
                     $permitem = 'operator:accountcodes:' . $accountcode;
                 }
 
-                if (Horde_Auth::isAdmin() ||
+                if ($GLOBALS['registry']->isAdmin() ||
                     $perms->hasPermission($permitem, Horde_Auth::getAuth(), Horde_Perms::SHOW)) {
                     $accountcodes[$accountcode] = $values[$index];
                 }
index e9d6ab1..97f34c2 100644 (file)
@@ -45,7 +45,7 @@ class Shout
         $menu->add(Horde::applicationUrl('conferences.php'), _("Conferences"), "conference.png");
 
         /* Administration. */
-        if (Horde_Auth::isAdmin('shout:admin')) {
+        if ($GLOBALS['registry']->isAdmin(array('permission' => 'shout:admin'))) {
             $menu->add(Horde::applicationUrl('admin.php'), _("_Admin"), 'admin.png');
         }
 
@@ -72,7 +72,9 @@ class Shout
      */
     static public function checkRights($permname, $permmask = null, $numparents = 0)
     {
-        if (Horde_Auth::isAdmin()) { return true; }
+        if ($GLOBALS['registry']->isAdmin()) {
+            return true;
+        }
 
         if ($permmask === null) {
             $permmask = Horde_Perms::SHOW | Horde_Perms::READ;
index 7c56b29..56848b5 100644 (file)
@@ -976,7 +976,8 @@ class Turba_Api extends Horde_Registry_Api
                 throw new Horde_Exception(sprintf(_("Connection failed: %s"), $driver->getMessage()));
             }
 
-            if (!Horde_Auth::isAdmin() && !$driver->hasPermission(Horde_Perms::DELETE)) {
+            if (!$GLOBALS['registry']->isAdmin() &&
+                !$driver->hasPermission(Horde_Perms::DELETE)) {
                 continue;
             }
 
index 05f7f0a..d6103a3 100644 (file)
@@ -379,7 +379,8 @@ class Turba_Application extends Horde_Registry_Application
      */
     public function removeUserData($user)
     {
-        if (!Horde_Auth::isAdmin() && $user != Horde_Auth::getAuth()) {
+        if (!$GLOBALS['registry']->isAdmin() &&
+            $user != Horde_Auth::getAuth()) {
             return PEAR::raiseError(_("You are not allowed to remove user data."));
         }
 
index 6f14256..b05ae78 100644 (file)
@@ -543,7 +543,7 @@ class Turba_Driver_Sql extends Turba_Driver
     function removeUserData($user)
     {
         // Make sure we are being called by an admin.
-        if (!Horde_Auth::isAdmin()) {
+        if (!$GLOBALS['registry']->isAdmin()) {
             return PEAR::raiseError(_("Permission denied"));
         }
 
index 328de45..3d6f5a3 100644 (file)
@@ -25,7 +25,7 @@ class Vilma {
     function hasPermission($domain, $permmask = null)
     {
         // FIXME Should this really be the case?  Superadmin is more granular
-        if (Horde_Auth::isAdmin()) {
+        if ($GLOBALS['registry']->isAdmin()) {
             return true;
         }
 
index 0634ff5..a1a9fa5 100644 (file)
@@ -13,7 +13,7 @@ require_once VILMA_BASE . '/lib/base.php';
 require_once 'Horde/Form.php';
 
 /* Only admin should be using this. */
-if (!Horde_Auth::isAdmin()) {
+if (!$registry->isAdmin()) {
     Horde_Auth::authenticateFailure('vilma', $e);
 }
 
index 5495081..a022969 100644 (file)
@@ -14,7 +14,7 @@ require_once 'Horde/Form.php';
 require_once 'Horde/Form/Action.php';
 
 /* Only admin should be using this. */
-if (!Horde_Auth::isAdmin() && !Vilma::isDomainAdmin()) {
+if (!$registry->isAdmin() && !Vilma::isDomainAdmin()) {
     Horde_Auth::authenticateFailure('vilma', $e);
 }
 
index a3b635b..11fccc8 100644 (file)
@@ -12,7 +12,7 @@
 require_once VILMA_BASE . '/lib/base.php';
 
 /* Only admin should be using this. */
-if (!Horde_Auth::isAdmin() && !Vilma::isDomainAdmin()) {
+if (!$registry->isAdmin() && !Vilma::isDomainAdmin()) {
     Horde_Auth::authenticateFailure('vilma', $e);
 }
 
index 4c4390b..4d6391f 100644 (file)
@@ -11,7 +11,7 @@
 require_once dirname(__FILE__) . '/../lib/Application.php';
 Horde_Registry::appInit('whups');
 
-if (!Horde_Auth::isAdmin('whups:admin')) {
+if (!$registry->isAdmin(array('permission' => 'whups:admin'))) {
     Horde_Auth::authenticateFailure('whups', $e);
 }
 
index 1bb90f6..9794617 100644 (file)
@@ -78,7 +78,7 @@ class Whups_Api extends Horde_Registry_Api
      */
     public function addQueue($name)
     {
-        if (Horde_Auth::isAdmin('whups:admin')) {
+        if ($GLOBALS['registry']->isAdmin(array('permission' => 'whups:admin'))) {
             return $GLOBALS['whups_driver']->addQueue($name, '');
         } else {
             return PEAR::raiseError('You must be an administrator to perform this action.');
index e4bcb43..76ba7c7 100644 (file)
@@ -23,7 +23,7 @@ class AddCommentForm extends Horde_Form {
         $this->addVariable(_("Watch this ticket"), 'add_watch', 'boolean', false);
 
         /* Group restrictions. */
-        if (Horde_Auth::isAdmin('whups:admin') ||
+        if ($GLOBALS['registry']->isAdmin(array('permission' => 'whups:admin')) ||
             $GLOBALS['injector']->getInstance('Horde_Perms')->hasPermission('whups:hiddenComments', Horde_Auth::getAuth(), Horde_Perms::EDIT)) {
             $groups = &Group::singleton();
             $mygroups = $groups->getGroupMemberships(Horde_Auth::getAuth());
index 77256c2..b950cb5 100644 (file)
@@ -137,7 +137,7 @@ class EditQueueStep2Form extends Horde_Form {
                            array($userlink));
 
         /* Permissions link. */
-        if (Horde_Auth::isAdmin('whups:admin', Horde_Perms::EDIT)) {
+        if ($GLOBALS['registry']->isAdmin(array('permission' => 'whups:admin', 'permlevel' => Horde_Perms::EDIT))) {
             $permslink = array(
                 'text' => _("Edit the permissions on this queue"),
                 'url' => Horde_Util::addParameter(Horde_Util::addParameter(Horde::url($GLOBALS['registry']->get('webroot', 'horde') . '/admin/perms/edit.php'), 'category', "whups:queues:$queue"), 'autocreate', '1'));
index b130490..4ce0263 100644 (file)
@@ -74,7 +74,7 @@ class EditReplyStep2Form extends Horde_Form {
         $ptext->setDefault($info['reply_text']);
 
         /* Permissions link. */
-        if (Horde_Auth::isAdmin('whups:admin', Horde_Perms::EDIT)) {
+        if ($GLOBALS['registry']->isAdmin(array('permission' => 'whups:admin', 'permlevel' => Horde_Perms::EDIT))) {
             $permslink = array(
                 'text' => _("Edit the permissions on this form reply"),
                 'url' => Horde_Util::addParameter(Horde_Util::addParameter(Horde::url($GLOBALS['registry']->get('webroot', 'horde') . '/admin/perms/edit.php'), 'category', "whups:replies:$reply"), 'autocreate', '1'));
index 15b5250..0f5aa89 100644 (file)
@@ -345,11 +345,12 @@ class Whups {
         if ($permission == 'update' ||
             $permission == 'assign' ||
             $permission == 'requester') {
-            $admin = Horde_Auth::isAdmin('whups:admin', Horde_Perms::EDIT, $user);
+            $admin_perm = Horde_Perms::EDIT;
         } else {
-            $admin = Horde_Auth::isAdmin('whups:admin', $permission, $user);
+            $admin_perm = Horde_Perms::EDIT;
         }
 
+        $admin = $GLOBALS['registry']->isAdmin(array('permission' => 'whups:admin', 'permlevel' => $admin_perm, 'user' => $user));
         $perms = $GLOBALS['injector']->getInstance('Horde_Perms');
 
         switch ($filter) {
@@ -417,7 +418,7 @@ class Whups {
             $user = Horde_Auth::getAuth();
         }
 
-        $admin = Horde_Auth::isAdmin('whups:admin', $permission, $user);
+        $admin = $GLOBALS['registry']->isAdmin(array('permission' => 'whups:admin', 'permlevel' => $permission, 'user' => $user));
         $perms = $GLOBALS['injector']->getInstance('Horde_Perms');
         $out = array();
 
@@ -768,7 +769,7 @@ class Whups {
         $menu->add(Horde::applicationUrl('reports.php'), _("_Reports"), 'reports.png');
 
         /* Administration. */
-        if (Horde_Auth::isAdmin('whups:admin')) {
+        if ($GLOBALS['registry']->isAdmin(array('permission' => 'whups:admin'))) {
             $menu->add(Horde::applicationUrl('admin/'), _("_Admin"), 'admin.png');
         }
 
index 08e9963..ceaf835 100644 (file)
@@ -31,7 +31,7 @@ class SetQueueStep1Form extends Horde_Form {
         $this->addVariable(_("Comment"), 'newcomment', 'longtext', false);
 
         /* Group restrictions. */
-        if (Horde_Auth::isAdmin('whups:admin', Horde_Perms::EDIT) ||
+        if ($GLOBALS['registry']->isAdmin(array('permission' => 'whups:admin', 'permlevel' => Horde_Perms::EDIT)) ||
             $GLOBALS['injector']->getInstance('Horde_Perms')->hasPermission('whups:hiddenComments',
                                              Horde_Auth::getAuth(), Horde_Perms::EDIT)) {
             $groups = &Group::singleton();
index 51f0836..d9052e5 100644 (file)
@@ -109,7 +109,7 @@ class Page {
                 return false;
             }
 
-            if (Horde_Auth::isAdmin()) {
+            if ($GLOBALS['registry']->isAdmin()) {
                 return true;
             }
 
@@ -128,7 +128,7 @@ class Page {
                 return false;
             }
 
-            if (Horde_Auth::isAdmin()) {
+            if ($GLOBALS['registry']->isAdmin()) {
                 return true;
             }
 
@@ -142,7 +142,7 @@ class Page {
                 return false;
             }
 
-            if (Horde_Auth::isAdmin()) {
+            if ($GLOBALS['registry']->isAdmin()) {
                 return true;
             }
 
@@ -153,7 +153,7 @@ class Page {
 
         // All other modes require READ permissions.
         default:
-            if (Horde_Auth::isAdmin()) {
+            if ($GLOBALS['registry']->isAdmin()) {
                 return true;
             }
 
index 444bb16..2ccfe87 100644 (file)
@@ -138,7 +138,7 @@ class StandardPage extends Page {
             if ($GLOBALS['browser']->isRobot()) {
                 return false;
             }
-            if (Horde_Auth::isAdmin()) {
+            if ($GLOBALS['registry']->isAdmin()) {
                 return true;
             }
             if (($this->getPermissions() & Horde_Perms::EDIT) == 0) {
@@ -147,7 +147,7 @@ class StandardPage extends Page {
             break;
 
         case WICKED_MODE_UNLOCKING:
-            if (Horde_Auth::isAdmin()) {
+            if ($GLOBALS['registry']->isAdmin()) {
                 return true;
             }
             if ($this->_lock) {
index 2113539..fabc4ae 100644 (file)
@@ -88,7 +88,7 @@ if ($this->allows(WICKED_MODE_HISTORY)) {
                        'widget', '', '', _("Hi_story"));
 }
 
-if (Horde_Auth::isAdmin()) {
+if ($registry->isAdmin()) {
     separator();
     $permsurl = Horde::url($GLOBALS['registry']->get('webroot', 'horde') . '/admin/perms/edit.php');
     $permsurl = Horde_Util::addParameter(