$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;
$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) &&
$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);
}
/* 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) {
$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. */
$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 = ? ';
$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>';
{
// 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;
}
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;
}
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));
}
/* 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');
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;
}
// 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.
}
/* 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')),
*/
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))) {
{
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;
}
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;
}
{
if (Horde_Auth::getAuth() &&
(Horde_Auth::getAuth() == $this->get('owner') ||
- Horde_Auth::isAdmin('ansel:admin'))) {
+ $GLOBALS['registry']->isAdmin(array('permission' => 'ansel:admin')))) {
return false;
}
$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);
$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."));
}
*/
function hasPermission($permname, $permmask = null, $numparents = 0)
{
- if (Horde_Auth::isAdmin()) {
+ if ($GLOBALS['registry']->isAdmin()) {
return true;
}
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)) {
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;
break;
case 'imp':
- if (Horde_Auth::isAdmin()
+ if ($GLOBALS['registry']->isAdmin()
|| $group->userIsInGroup($user_uid, 1, false)
|| $group->userIsInGroup($user_uid, 2, false)) {
public function __construct()
{
- if (!Horde_Auth::isAdmin()) {
+ if (!$GLOBALS['registry']->isAdmin()) {
$this->disabled = array('removeUser', 'userList');
}
}
{
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."));
}
}
$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);
*/
public function deleteUser($user)
{
- if (!Horde_Auth::isAdmin()) {
+ if (!$GLOBALS['registry']->isAdmin()) {
return false;
}
$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.");
}
// 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.");
}
return $share->getId();
}
-}
\ No newline at end of file
+}
$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);
}
// Only admins can run this operation
-if (!Horde_Auth::isAdmin('folks:admin')) {
+if (!$registry->isAdmin(array('permission' => 'folks:admin'))) {
$cli->fatal('ADMIN ONLY');
}
}
/**
- * 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.
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;
}
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;
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>';
*/
public static function dump($errors)
{
- if (!Horde_Auth::isAdmin()) {
+ if (!$GLOBALS['registry']->isAdmin()) {
return;
}
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) {
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;
/* Generate api/type cache. */
$status = array('active', 'notoolbar', 'hidden');
- if (Horde_Auth::isAdmin()) {
+ if ($this->isAdmin()) {
$status[] = 'admin';
}
/* 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);
}
/* 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());
}
}
+ /**
+ * 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;
+ }
+
}
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'));
}
*/
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");
*/
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."));
}
*/
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."));
}
*/
public function addGroup($name, $parent = null)
{
- if (!Horde_Auth::isAdmin()) {
+ if (!$GLOBALS['registry']->isAdmin()) {
return PEAR::raiseError(_("You are not allowed to add groups."));
}
*/
public function removeGroup($name)
{
- if (!Horde_Auth::isAdmin()) {
+ if (!$GLOBALS['registry']->isAdmin()) {
return PEAR::raiseError(_("You are not allowed to delete groups."));
}
*/
public function addUserToGroup($name, $user)
{
- if (!Horde_Auth::isAdmin()) {
+ if (!$GLOBALS['registry']->isAdmin()) {
return PEAR::raiseError(_("You are not allowed to change groups."));
}
*/
public function addUsersToGroup($name, $users)
{
- if (!Horde_Auth::isAdmin()) {
+ if (!$GLOBALS['registry']->isAdmin()) {
return PEAR::raiseError(_("You are not allowed to change groups."));
}
*/
public function removeUserFromGroup($name, $user)
{
- if (!Horde_Auth::isAdmin()) {
+ if (!$GLOBALS['registry']->isAdmin()) {
return PEAR::raiseError(_("You are not allowed to change groups."));
}
*/
public function removeUsersFromGroup($name, $users)
{
- if (!Horde_Auth::isAdmin()) {
+ if (!$GLOBALS['registry']->isAdmin()) {
return PEAR::raiseError(_("You are not allowed to change groups."));
}
*/
public function listUsersOfGroup($name)
{
- if (!Horde_Auth::isAdmin()) {
+ if (!$GLOBALS['registry']->isAdmin()) {
return PEAR::raiseError(_("You are not allowed to list users of groups."));
}
*/
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."));
}
*/
public function removeShare($scope, $shareName)
{
- if (!Horde_Auth::isAdmin()) {
+ if (!$GLOBALS['registry']->isAdmin()) {
return PEAR::raiseError(_("You are not allowed to delete shares."));
}
*/
public function listSharesOfOwner($scope, $userName)
{
- if (!Horde_Auth::isAdmin()) {
+ if (!$GLOBALS['registry']->isAdmin()) {
return PEAR::raiseError(_("You are not allowed to list shares."));
}
* @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."));
}
* @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."));
}
*/
public function removeUserPermissions($scope, $shareName, $userName)
{
- if (!Horde_Auth::isAdmin()) {
+ if (!$GLOBALS['registry']->isAdmin()) {
return PEAR::raiseError(_("You are not allowed to change shares."));
}
*/
public function removeGroupPermissions($scope, $shareName, $groupName)
{
- if (!Horde_Auth::isAdmin()) {
+ if (!$GLOBALS['registry']->isAdmin()) {
return PEAR::raiseError(_("You are not allowed to change shares."));
}
*/
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."));
}
*/
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."));
}
*/
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."));
}
*/
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."));
}
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);
}
// 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();
}
}
// 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');
* 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']);
if (!Horde_Auth::getAuth() ||
(isset($share) &&
- !Horde_Auth::isAdmin() &&
+ !$registry->isAdmin() &&
Horde_Auth::getAuth() != $share->get('owner'))) {
exit('permission denied');
}
if (!empty($share)) {
if (!Horde_Auth::getAuth() ||
- (!Horde_Auth::isAdmin() &&
+ (!$registry->isAdmin() &&
Horde_Auth::getAuth() != $share->get('owner'))) {
exit('permission denied');
}
$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');
}
}
- if (Horde_Auth::isAdmin() ||
+ if ($registry->isAdmin() ||
!empty($GLOBALS['conf']['share']['world'])) {
// Process default permissions.
if (Horde_Util::getFormData('default_show')) {
</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> </td></tr>
*/
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."));
}
*/
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"));
}
*/
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
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;
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;
$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;
$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;
*/
public function handle($args, $post)
{
- global $ansel_storage;
-
$request = $args['action'];
$content = array('id' => $post['resource'], 'type' => $post['type']);
$tags = rawurldecode($post['tags']);
// $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();
$events = $kronolith_driver->getByUID($uid, null, true);
$event = null;
- if (Horde_Auth::isAdmin()) {
+ if ($GLOBALS['registry']->isAdmin()) {
$event = $events[0];
}
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;
}
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();
}
*/
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."));
}
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();
}
{
throw new Kronolith_Exception('to be refactored');
- if (!Horde_Auth::isAdmin()) {
+ if (!$GLOBALS['registry']->isAdmin()) {
throw new Horde_Exception_PermissionDenied();
}
$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");
*/
public function hasPermission($permission, $user = null)
{
- if (Horde_Auth::isAdmin()) {
- return true;
- }
-
- return false;
+ return $GLOBALS['registry']->isAdmin();
}
}
$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."));
}
$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."));
}
{
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."));
}
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."));
}
$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);
}
}
- if (Horde_Auth::isAdmin() ||
+ if ($GLOBALS['registry']->isAdmin() ||
!empty($GLOBALS['conf']['share']['world'])) {
// Process default permissions.
if (Horde_Util::getFormData('default_show')) {
*/
public function hasPermission($user, $permission = Horde_Perms::READ, $restrict = null)
{
- if (Horde_Auth::isAdmin()) {
- return true;
- }
-
- return false;
+ return $GLOBALS['registry']->isAdmin();
}
/**
*/
abstract public function getResponseType();
-}
\ No newline at end of file
+}
if (!Horde_Auth::getAuth() ||
(isset($share) &&
- !Horde_Auth::isAdmin() &&
+ !$registry->isAdmin() &&
Horde_Auth::getAuth() != $share->get('owner'))) {
exit('permission denied');
}
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');
}
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);
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;
}
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;
}
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;
}
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;
}
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;
}
<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") ?>" />
<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") ?>" />
</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>
<?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; ?>
</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"> </td></tr>
{
global $source;
- if (Horde_Auth::isAdmin()) {
+ if ($GLOBALS['registry']->isAdmin()) {
return false;
}
*/
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."));
}
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"));
return PEAR::raiseError(sprintf(_("Unsupported Content-Type: %s"),$contentType));
}
}
-}
\ No newline at end of file
+}
!empty($task->private),
Horde_Auth::getAuth(),
isset($task->assignee) ? $task->assignee : null);
-
+
/* array index 0 is id, 1 is uid */
return $results[1];
}
*/
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"));
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"));
*/
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"));
*/
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"));
{
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"));
}
*/
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."));
}
$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."));
}
$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."));
}
{
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."));
}
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."));
}
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;
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;
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;
}
}
-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);
*/
/* 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');
}
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;
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;
/* 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');
$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');
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');
$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;
}
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) {
return $data;
}
- if (!Horde_Auth::isAdmin('news:admin')) {
+ if (!$GLOBALS['registry']->isAdmin(array('permission' => 'news:admin'))) {
$GLOBALS['cache']->set($key, serialize($data));
}
' 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;
}
*/
$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);
}
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');
}
$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";
$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);
}
$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);
}
-
}
/**
Horde::img('devel.png', _("Info"), '', $img_dir). '</a> ';
/* 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']));
}
$perms = $GLOBALS['injector']->getInstance('Horde_Perms');
- if (Horde_Auth::isAdmin() ||
+ if ($GLOBALS['registry']->isAdmin() ||
$perms->hasPermission('operator:accountcodes',
Horde_Auth::getAuth(),
Horde_Perms::READ) ||
$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) ||
$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)) {
$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];
}
$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');
}
*/
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;
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;
}
*/
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."));
}
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"));
}
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;
}
require_once 'Horde/Form.php';
/* Only admin should be using this. */
-if (!Horde_Auth::isAdmin()) {
+if (!$registry->isAdmin()) {
Horde_Auth::authenticateFailure('vilma', $e);
}
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);
}
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);
}
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);
}
*/
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.');
$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());
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'));
$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'));
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) {
$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();
$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');
}
$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();
return false;
}
- if (Horde_Auth::isAdmin()) {
+ if ($GLOBALS['registry']->isAdmin()) {
return true;
}
return false;
}
- if (Horde_Auth::isAdmin()) {
+ if ($GLOBALS['registry']->isAdmin()) {
return true;
}
return false;
}
- if (Horde_Auth::isAdmin()) {
+ if ($GLOBALS['registry']->isAdmin()) {
return true;
}
// All other modes require READ permissions.
default:
- if (Horde_Auth::isAdmin()) {
+ if ($GLOBALS['registry']->isAdmin()) {
return true;
}
if ($GLOBALS['browser']->isRobot()) {
return false;
}
- if (Horde_Auth::isAdmin()) {
+ if ($GLOBALS['registry']->isAdmin()) {
return true;
}
if (($this->getPermissions() & Horde_Perms::EDIT) == 0) {
break;
case WICKED_MODE_UNLOCKING:
- if (Horde_Auth::isAdmin()) {
+ if ($GLOBALS['registry']->isAdmin()) {
return true;
}
if ($this->_lock) {
'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(