/* Check permissions */
if (Horde_Auth::isAdmin('agora:admin') ||
- ($GLOBALS['perms']->exists('agora:forums:' . $this->_scope) &&
- $GLOBALS['perms']->hasPermission('agora:forums:' . $this->_scope, Horde_Auth::getAuth(), Horde_Perms::DELETE))) {
+ ($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 = ? ';
$params[] = $this->_scope;
} else {
public function getBanned()
{
$perm_name = 'agora:forums:' . $this->_scope . ':' . $this->_forum_id;
- if (!$GLOBALS['perms']->exists($perm_name)) {
+ if (!$GLOBALS['injector']->getInstance('Horde_Perms')->exists($perm_name)) {
return array();
}
- $forum_perm = $GLOBALS['perms']->getPermission($perm_name);
+ $forum_perm = $GLOBALS['injector']->getInstance('Horde_Perms')->getPermission($perm_name);
if (!($forum_perm instanceof Horde_Perms_Permission)) {
return $forum_perm;
}
*/
public function updateBan($user, $forum_id = null, $action = 'add')
{
- global $perms;
-
if ($forum_id == null) {
$forum_id = $this->_forum_id;
}
+ $perms = $GLOBALS['injector']->getInstance('Horde_Perms');
$perm_name = 'agora:forums:' . $this->_scope . ':' . $forum_id;
if (!$perms->exists($perm_name)) {
- $forum_perm = &$perms->newPermission($perm_name);
+ $forum_perm = $perms->newPermission($perm_name);
$perms->addPermission($forum_perm);
} else {
$forum_perm = $perms->getPermission($perm_name);
*/
public function updateModerator($moderator, $forum_id = null, $action = 'add')
{
- global $perms;
-
if ($forum_id == null) {
$forum_id = $this->_forum_id;
}
/* Update permissions*/
$perm_name = 'agora:forums:' . $this->_scope . ':' . $forum_id;
+ $perms = $GLOBALS['injector']->getInstance('Horde_Perms');
if (!$perms->exists($perm_name)) {
- $forum_perm = &$perms->newPermission($perm_name);
+ $forum_perm = $perms->newPermission($perm_name);
$perms->addPermission($forum_perm);
} else {
$forum_perm = $perms->getPermission($perm_name);
*/
public function hasPermission($perm = Horde_Perms::READ, $forum_id = null, $scope = null)
{
- global $perms;
-
// Allow all admins
if (($forum_id === null && isset($this->_forum['author']) && $this->_forum['author'] == Horde_Auth::getAuth()) ||
Horde_Auth::isAdmin('agora:admin')) {
$scope = $this->_scope;
}
+ $perms = $GLOBALS['injector']->getInstance('Horde_Perms');
if (!$perms->exists('agora:forums:' . $scope) &&
!$perms->exists('agora:forums:' . $scope . ':' . $forum_id)) {
return ($perm & Horde_Perms::DELETE) ? false : true;
case 'save':
// Check general permissions.
if (!Horde_Auth::isAdmin() &&
- ($GLOBALS['perms']->exists('ansel') &&
- !$GLOBALS['perms']->hasPermission('ansel', Horde_Auth::getAuth(), Horde_Perms::EDIT))) {
+ ($GLOBALS['injector']->getInstance('Horde_Perms')->exists('ansel') &&
+ !$GLOBALS['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;
/* Let authenticated users create new galleries. */
if (Horde_Auth::isAdmin() ||
- (!$GLOBALS['perms']->exists('ansel') && Horde_Auth::getAuth()) ||
- $GLOBALS['perms']->hasPermission('ansel', Horde_Auth::getAuth(), Horde_Perms::EDIT)) {
+ (!$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')),
_("_New Gallery"), 'add.png', null, null, null,
(basename($_SERVER['PHP_SELF']) == 'gallery.php' &&
public function removeImage($app = null, $gallery_id, $image_id)
{
/* Check global Ansel permissions */
- if (!($GLOBALS['perms']->getPermissions('ansel'))) {
+ if (!$GLOBALS['injector']->getInstance('Horde_Perms')->getPermissions('ansel')) {
return PEAR::raiseError(_("Access denied deleting galleries."));
}
public function createGallery($app = null, $attributes = array(), $perm = null, $parent = null)
{
if (!(Horde_Auth::isAdmin() ||
- (!$GLOBALS['perms']->exists('ansel') && Horde_Auth::getAuth()) ||
- $GLOBALS['perms']->hasPermission('ansel', Horde_Auth::getAuth(), Horde_Perms::EDIT))) {
+ (!$GLOBALS['injector']->getInstance('Horde_Perms')->exists('ansel') && Horde_Auth::getAuth()) ||
+ $GLOBALS['injector']->getInstance('Horde_Perms')->hasPermission('ansel', Horde_Auth::getAuth(), Horde_Perms::EDIT))) {
return PEAR::raiseError(_("Access denied creating new galleries."));
}
public function removeGallery($app = null, $gallery_id)
{
/* Check global Ansel permissions */
- if (!($GLOBALS['perms']->getPermissions('ansel'))) {
+ if (!$GLOBALS['injector']->getInstance('Horde_Perms')->getPermissions('ansel')) {
return PEAR::raiseError(_("Access denied deleting galleries."));
}
}
- return $GLOBALS['perms']->hasPermission($this->getPermission(),
- $userid, $permission, $creator);
+ return $GLOBALS['injector']->getInstance('Horde_Perms')->hasPermission($this->getPermission(), $userid, $permission, $creator);
}
/**
{
$name = $GLOBALS['registry']->getApp() . ':admin';
- if ($GLOBALS['perms']->exists($name)) {
+ if ($GLOBALS['injector']->getInstance('Horde_Perms')->exists($name)) {
return array();
}
- $permission = $GLOBALS['perms']->getPermission($name);
+ $permission = $GLOBALS['injector']->getInstance('Horde_Perms')->getPermission($name);
return $permission->getUserPermissions(PERM_DELETE);
}
*/
function hasPermission($permission, $filter = null, $perm = null)
{
- global $perms;
-
$userId = Horde_Auth::getAuth();
$admin = ($userId == 'admin') ? true : false;
+ $perms = $GLOBALS['injector']->getInstance('Horde_Perms');
if ($admin || !$perms->exists('babel:' . $permission)) {
return true;
$user = 0;
$superadmin = 0;
- $superadmin = $GLOBALS['perms']->hasPermission('beatnik:domains', Horde_Auth::getAuth(), $permmask);
+ $superadmin = $GLOBALS['injector']->getInstance('Horde_Perms')->hasPermission('beatnik:domains', Horde_Auth::getAuth(), $permmask);
while ($numparents >= 0) {
- $tmpuser = $GLOBALS['perms']->hasPermission($permname, Horde_Auth::getAuth(), $permmask);
+ $tmpuser = $GLOBALS['injector']->getInstance('Horde_Perms')->hasPermission($permname, Horde_Auth::getAuth(), $permmask);
$user = $user | $tmpuser;
if ($numparents > 0) {
}
if (!Horde_Auth::isAdmin() &&
- !$GLOBALS['perms']->hasPermission('beatnik:domains', Horde_Auth::getAuth(), $perms)) {
+ !$GLOBALS['injector']->getInstance('Horde_Perms')->hasPermission('beatnik:domains', Horde_Auth::getAuth(), $perms)) {
foreach ($domains as $id => $domain) {
- if (!$GLOBALS['perms']->hasPermission('beatnik:domains:' . $domain['zonename'], Horde_Auth::getAuth(), $perms)) {
+ if (!$GLOBALS['injector']->getInstance('Horde_Perms')->hasPermission('beatnik:domains:' . $domain['zonename'], Horde_Auth::getAuth(), $perms)) {
unset($domains[$id]);
}
}
*/
static public function checkPerms($key)
{
- return (!$GLOBALS['perms']->exists('chora:sourceroots:' . $key) ||
- $GLOBALS['perms']->hasPermission('chora:sourceroots:' . $key, Horde_Auth::getAuth(), Horde_Perms::READ | Horde_Perms::SHOW));
+ return (!$GLOBALS['injector']->getInstance('Horde_Perms')->exists('chora:sourceroots:' . $key) ||
+ $GLOBALS['injector']->getInstance('Horde_Perms')->hasPermission('chora:sourceroots:' . $key, Horde_Auth::getAuth(), Horde_Perms::READ | Horde_Perms::SHOW));
}
/**
*/
private function _getAdmins()
{
- if (!$GLOBALS['perms']->exists('folks:admin')) {
+ if (!$GLOBALS['injector']->getInstance('Horde_Perms')->exists('folks:admin')) {
return array();
}
- $permission = $GLOBALS['perms']->getPermission('folks:admin');
+ $permission = $GLOBALS['injector']->getInstance('Horde_Perms')->getPermission('folks:admin');
return array_merge($permission->getUserPermissions(PERM_DELETE),
$GLOBALS['conf']['auth']['admins']);
{
$name = $GLOBALS['registry']->getApp() . ':admin';
- if ($GLOBALS['perms']->exists($name)) {
- $permission = $GLOBALS['perms']->getPermission($name);
+ if ($GLOBALS['injector']->getInstance('Horde_Perms')->exists($name)) {
+ $permission = $GLOBALS['injector']->getInstance('Horde_Perms')->getPermission($name);
if ($permission instanceof PEAR_Error) {
return $permission;
} else {
if (is_null($permlevel)) {
$permlevel = Horde_Perms::EDIT;
}
- return $GLOBALS['perms']->hasPermission($permission, $user, $permlevel);
+ return $GLOBALS['injector']->getInstance('Horde_Perms')->hasPermission($permission, $user, $permlevel);
}
return false;
*/
static public function hasPermission($permission)
{
- global $perms;
+ $perms = $GLOBALS['injector']->getInstance('Horde_Perms');
if (!$perms->exists('horde:' . $permission)) {
return true;
throw new Horde_Exception(_("This system is currently deactivated."));
}
- /* Create the global permissions object. */
- $GLOBALS['perms'] = $injector->getInstance('Horde_Perms');
-
/* Initialize notification object. Always attach status listener by
* default. */
$GLOBALS['notification'] = Horde_Notification::singleton();
/* 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() ||
- !$GLOBALS['perms']->exists($app) ||
- $GLOBALS['perms']->hasPermission($app, Horde_Auth::getAuth(), $perms);
+ !$GLOBALS['injector']->getInstance('Horde_Perms')->exists($app) ||
+ $GLOBALS['injector']->getInstance('Horde_Perms')->hasPermission($app, Horde_Auth::getAuth(), $perms);
}
/**
static public function generateHeader($app, $prefGroups = null,
$group = null, $chunk = false)
{
- global $notification, $perms, $prefs, $registry;
+ global $notification, $prefs, $registry;
$title = _("User Options");
if ($group == 'identities' && !$prefs->isLocked('default_identity')) {
}
$perm = $share->getPermission();
- return $GLOBALS['perms']->getPermissions($perm, $user);
+ return $GLOBALS['injector']->getInstance('Horde_Perms')->getPermissions($perm, $user);
}
/**
return true;
}
- return $GLOBALS['perms']->hasPermission($this->getPermission(),
- $userid, $permission, $creator);
+ return $GLOBALS['injector']->getInstance('Horde_Perms')->hasPermission($this->getPermission(), $userid, $permission, $creator);
}
/**
return true;
}
- return $GLOBALS['perms']->hasPermission($this->getPermission(),
- $userid, $permission, $creator);
+ return $GLOBALS['injector']->getInstance('Horde_Perms')->hasPermission($this->getPermission(), $userid, $permission, $creator);
}
/**
$test->prepareNewFolder($world['storage'], 'Contacts', 'contact', true);
require_once dirname(__FILE__) . '/../Share.php';
-
+
$shares = Horde_Share::singleton('kronolith', 'kolab');
-class Perms_mock
+class Perms_mock
{
function &newPermission($name) {
$perms = array(
switch ($filter) {
case 'backend':
$backendTag = 'gollem:backends:' . $backend;
- return (!$GLOBALS['perms']->exists($backendTag) ||
- $GLOBALS['perms']->hasPermission($backendTag, $userID, $permission));
+ return (!$GLOBALS['injector']->getInstance('Horde_Perms')->exists($backendTag) ||
+ $GLOBALS['injector']->getInstance('Horde_Perms')->hasPermission($backendTag, $userID, $permission));
}
return false;
if ($perms != 'all') {
foreach (array_keys($backends) as $key) {
- $exists = $GLOBALS['perms']->exists('gollem:backends:' . $key);
+ $exists = $GLOBALS['injector']->getInstance('Horde_Perms')->exists('gollem:backends:' . $key);
/* Don't list if the perms don't exist for this backend and we
* want backends with perms only OR if the perms exist for
* this backend and we only want backends which have none. */
$key = Horde_Util::getFormData('backend', Gollem::getPreferredBackend());
$app = $registry->getApp();
$backendTag = $app . ':backends:' . $key;
+$perms = $GLOBALS['injector']->getInstance('Horde_Perms');
+
if ($perms->exists($backendTag)) {
$permission = $perms->getPermission($backendTag);
$perm_id = $perms->getPermissionId($permission);
} else {
- $permission =& $perms->newPermission($backendTag);
+ $permission = $perms->newPermission($backendTag);
$result = $perms->addPermission($permission, $app);
if ($result instanceof PEAR_Error) {
$notification->push(sprintf(_("Unable to create backend permission: %s"), $result->getMessage()), 'horde.error');
/* Set up the form variables. */
$vars = Horde_Variables::getDefaultVariables();
+$perms = $GLOBALS['injector']->getInstance('Horde_Perms');
$perm_id = $vars->get('perm_id');
try {
if ($ui->validateAddForm($info)) {
if ($info['perm_id'] == Horde_Perms::ROOT) {
- $child = &$perms->newPermission($info['child']);
+ $child = $perms->newPermission($info['child']);
$result = $perms->addPermission($child);
} else {
- $pOb = &$perms->getPermissionById($info['perm_id']);
+ $pOb = $perms->getPermissionById($info['perm_id']);
$name = $pOb->getName() . ':' . str_replace(':', '.', $info['child']);
- $child = &$perms->newPermission($name);
+ $child = $perms->newPermission($name);
$result = $perms->addPermission($child);
}
if (is_a($result, 'PEAR_Error')) {
/* Set up the form variables. */
$vars = Horde_Variables::getDefaultVariables();
+$perms = $GLOBALS['injector']->getInstance('Horde_Perms');
$perm_id = $vars->get('perm_id');
$category = $vars->get('category');
-$permission = &$perms->getPermissionById($perm_id);
+$permission = $perms->getPermissionById($perm_id);
/* If the permission fetched is an error return to permissions list. */
if (is_a($permission, 'PEAR_Error')) {
Horde_Registry::appInit('horde', array('admin' => true));
/* Set up the form variables. */
-$vars = &Horde_Variables::getDefaultVariables();
+$vars = Horde_Variables::getDefaultVariables();
+$perms = $GLOBALS['injector']->getInstance('Horde_Perms');
$perm_id = $vars->get('perm_id');
$category = $vars->get('category');
/* See if we need to (and are supposed to) autocreate the permission. */
if ($category !== null) {
- $permission = &$perms->getPermission($category);
+ $permission = $perms->getPermission($category);
if (is_a($permission, 'PEAR_Error') && Horde_Util::getFormData('autocreate')) {
/* Check to see if the permission we are copying from exists before we
}
$parent = $vars->get('parent');
- $permission = &$perms->newPermission($category);
+ $permission = $perms->newPermission($category);
$result = $perms->addPermission($permission, $parent);
if (!is_a($result, 'PEAR_Error')) {
$form = 'edit.inc';
if ($copyFrom) {
/* We have autocreated the permission and we have been told to
* copy an existing permission for the defaults. */
- $copyFromObj = &$perms->getPermission($copyFrom);
+ $copyFromObj = $perms->getPermission($copyFrom);
$permission->addGuestPermission($copyFromObj->getGuestPermissions(), false);
$permission->addDefaultPermission($copyFromObj->getDefaultPermissions(), false);
$permission->addCreatorPermission($copyFromObj->getCreatorPermissions(), false);
}
$vars->set('perm_id', $perm_id);
} else {
- $permission = &$perms->getPermissionById($perm_id);
+ $permission = $perms->getPermissionById($perm_id);
}
/* If the permission fetched is an error return to the permissions list. */
// }
// // Update the ACLS
-// $perms = $share->getPermission();
-// $users = $perms->getUserPermissions();
+// $perms = $GLOBALS['share']->getPermission();
+// $users = $GLOBALS['injector']->getInstance('Horde_Perms')->getUserPermissions();
// foreach ($users as $user => $perm) {
// $acl = Net_IMSP_Utils::permsToACL($perm);
// $result = Net_IMSP_Utils::setACL($_SESSION['imsp_config'], $bookName, $user, $acl);
return PEAR::raiseError(_("You are not allowed to remove user data."));
}
- global $conf, $perms;
+ global $conf;
/* Error flag */
$haveError = false;
}
/* Remove the user from all application permissions */
+ $perms = $GLOBALS['injector']->getInstance('Horde_Perms');
$tree = $perms->getTree();
if (is_a($tree, 'PEAR_Error')) {
Horde::logMessage($tree, __FILE__, __LINE__, PEAR_LOG_ERR);
$out['initial_application_options'] = array();
$apps = $GLOBALS['registry']->listApps(array('active'));
foreach ($apps as $a) {
+ $perms = $GLOBALS['injector']->getInstance('Horde_Perms');
if (file_exists($GLOBALS['registry']->get('fileroot', $a)) &&
- (($GLOBALS['perms']->exists($a) && ($GLOBALS['perms']->hasPermission($a, Horde_Auth::getAuth(), Horde_Perms::READ) || Horde_Auth::isAdmin())) ||
- !$GLOBALS['perms']->exists($a))) {
+ (($perms->exists($a) && ($perms->hasPermission($a, Horde_Auth::getAuth(), Horde_Perms::READ) || Horde_Auth::isAdmin())) ||
+ !$perms->exists($a))) {
$out['initial_application_options'][$a] = $GLOBALS['registry']->get('name', $a);
}
}
$a_template->set('go', _("Go"));
}
-$a_template->set('create_folder', !empty($GLOBALS['conf']['hooks']['permsdenied']) || ($GLOBALS['perms']->hasAppPermission('create_folders') && $GLOBALS['perms']->hasAppPermission('max_folders')));
+$a_template->set('create_folder', !empty($GLOBALS['conf']['hooks']['permsdenied']) || ($GLOBALS['injector']->getInstance('Horde_Perms')->hasAppPermission('create_folders') && $GLOBALS['injector']->getInstance('Horde_Perms')->hasAppPermission('max_folders')));
if ($prefs->getValue('subscribe')) {
$a_template->set('subscribe', true);
$subToggleText = ($showAll) ? _("Hide Unsubscribed") : _("Show Unsubscribed");
return;
}
- $timelimit = $GLOBALS['perms']->hasAppPermission('max_timelimit');
+ $timelimit = $GLOBALS['injector']->getInstance('Horde_Perms')->hasAppPermission('max_timelimit');
if ($timelimit !== true) {
if ($conf['sentmail']['driver'] == 'none') {
Horde::logMessage('The permission for the maximum number of recipients per time period has been enabled, but no backend for the sent-mail logging has been configured for IMP.', __FILE__, __LINE__, PEAR_LOG_ERR);
/* Count recipients if necessary. We need to split email groups
* because the group members count as separate recipients. */
if ($exceed) {
- $max_recipients = $GLOBALS['perms']->hasAppPermission('max_recipients');
+ $max_recipients = $GLOBALS['injector']->getInstance('Horde_Perms')->hasAppPermission('max_recipients');
if ($max_recipients !== true) {
$num_recipients = 0;
foreach ($addrlist as $recipient) {
global $conf, $notification;
/* Check permissions. */
- if (!$GLOBALS['perms']->hasAppPermission('create_folders')) {
+ if (!$GLOBALS['injector']->getInstance('Horde_Perms')->hasAppPermission('create_folders')) {
try {
$message = Horde::callHook('perms_denied', array('imp:create_folders'));
} catch (Horde_Exception_HookNotSet $e) {
}
$notification->push($message, 'horde.error', array('content.raw'));
return false;
- } elseif (!$GLOBALS['perms']->hasAppPermission('max_folders')) {
+ } elseif (!$GLOBALS['injector']->getInstance('Horde_Perms')->hasAppPermission('max_folders')) {
try {
$message = Horde::callHook('perms_denied', array('imp:max_folders'));
} catch (Horde_Exception_HookNotSet $e) {
- $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d folders."), $GLOBALS['perms']->hasAppPermission('max_folders', array('opts' => array('value' => true)))), ENT_COMPAT, Horde_Nls::getCharset());
+ $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d folders."), $GLOBALS['injector']->getInstance('Horde_Perms')->hasAppPermission('max_folders', array('opts' => array('value' => true)))), ENT_COMPAT, Horde_Nls::getCharset());
}
$notification->push($message, 'horde.error', array('content.raw'));
return false;
if (!empty($options['new_folder']) &&
(!empty($GLOBALS['conf']['hooks']['permsdenied']) ||
- ($GLOBALS['perms']->hasAppPermission('create_folders') &&
- $GLOBALS['perms']->hasAppPermission('max_folders')))) {
+ ($GLOBALS['injector']->getInstance('Horde_Perms')->hasAppPermission('create_folders') &&
+ $GLOBALS['injector']->getInstance('Horde_Perms')->hasAppPermission('max_folders')))) {
$text .= "<option value=\"\" disabled=\"disabled\">- - - - - - - -</option>\n" .
'<option value="*new*">' . _("New Folder") . "</option>\n" .
"<option value=\"\" disabled=\"disabled\">- - - - - - - -</option>\n";
$edit_allowed = Ingo::hasSharePermission(Horde_Perms::EDIT);
$delete_allowed = Ingo::hasSharePermission(Horde_Perms::DELETE);
+/* Permissions. */
+$perms = $GLOBALS['injector']->getInstance('Horde_Perms');
+
/* Perform requested actions. */
switch ($vars->actionID) {
case 'rule_down':
break;
case 'rule_copy':
- if (!$GLOBALS['perms']->hasAppPermission('allow_rules')) {
+ if (!$perms->hasAppPermission('allow_rules')) {
try {
$message = Horde::callHook('perms_denied', array('ingo:allow_rules'));
} catch (Horde_Exception_HookNotSet $e) {
}
$notification->push($message, 'horde.error', array('content.raw'));
break 2;
- } elseif ($GLOBALS['perms']->hasAppPermission('max_rules') !== true &&
- $GLOBALS['perms']->hasAppPermission('max_rules') <= count($filters->getFilterList())) {
+ } elseif ($perms->hasAppPermission('max_rules') !== true &&
+ $perms->hasAppPermission('max_rules') <= count($filters->getFilterList())) {
try {
$message = Horde::callHook('perms_denied', array('ingo:max_rules'));
} catch (Horde_Exception_HookNotSet $e) {
- $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d rules."), $GLOBALS['perms']->hasAppPermission('max_rules')), ENT_COMPAT, Horde_Nls::getCharset());
+ $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d rules."), $perms->hasAppPermission('max_rules')), ENT_COMPAT, Horde_Nls::getCharset());
}
$notification->push($message, 'horde.error', array('content.raw'));
break 2;
/* Create copy link. */
if (!is_null($copyurl) &&
(!empty($conf['hooks']['permsdenied']) ||
- $GLOBALS['perms']->hasAppPermission('max_rules') === true ||
- $GLOBALS['perms']->hasAppPermission('max_rules') > count($filter_list))) {
+ $perms->hasAppPermission('max_rules') === true ||
+ $perms->hasAppPermission('max_rules') > count($filter_list))) {
$entry['copylink'] = Horde::link($copyurl, sprintf(_("Copy %s"), $name));
$entry['copyimg'] = Horde::img('copy.png', sprintf(_("Copy %s"), $name));
} else {
$actions = $ingo_script->availableActions();
$createrule = (!empty($actions) &&
(!empty($conf['hooks']['permsdenied']) ||
- ($GLOBALS['perms']->hasAppPermission('allow_rules') &&
- ($GLOBALS['perms']->hasAppPermission('max_rules') === true ||
- $GLOBALS['perms']->hasAppPermission('max_rules') > count($filter_list)))));
+ ($perms->hasAppPermission('allow_rules') &&
+ ($perms->hasAppPermission('max_rules') === true ||
+ $perms->hasAppPermission('max_rules') > count($filter_list)))));
$canapply = $ingo_script->canApply();
require INGO_TEMPLATES . '/filters/footer.inc';
if ($on_demand && $edit_allowed) {
Horde_Registry::appInit('ingo');
/* Check rule permissions. */
-if (!$GLOBALS['perms']->hasAppPermission('allow_rules')) {
+$perms = $GLOBALS['injector']->getInstance('Horde_Perms');
+if (!$perms->hasAppPermission('allow_rules')) {
try {
$message = Horde::callHook('perms_denied', array('ingo:allow_rules'));
} catch (Horde_Exception_HookNotSet $e) {
/* Save the rule. */
if ($vars->actionID == 'rule_save' && $valid) {
if (!isset($vars->edit)) {
- if ($GLOBALS['perms']->hasAppPermission('max_rules') !== true &&
- $GLOBALS['perms']->hasAppPermission('max_rules') <= count($filters->getFilterList())) {
+ if ($perms->hasAppPermission('max_rules') !== true &&
+ $perms->hasAppPermission('max_rules') <= count($filters->getFilterList())) {
header('Location: ' . Horde::applicationUrl('filters.php', true));
exit;
}
exit;
}
if (!isset($vars->edit)) {
- if ($GLOBALS['perms']->hasAppPermission('max_rules') !== true &&
- $GLOBALS['perms']->hasAppPermission('max_rules') <= count($filters->getFilterList())) {
+ if ($perms->hasAppPermission('max_rules') !== true &&
+ $perms->hasAppPermission('max_rules') <= count($filters->getFilterList())) {
try {
$message = Horde::callHook('perms_denied', array('ingo:max_rules'));
} catch (Horde_Exception_HookNotSet $e) {
- $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d rules."), $GLOBALS['perms']->hasAppPermission('max_rules')), ENT_COMPAT, Horde_Nls::getCharset());
+ $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d rules."), $perms->hasAppPermission('max_rules')), ENT_COMPAT, Horde_Nls::getCharset());
}
$notification->push($message, 'horde.error', array('content.raw'));
header('Location: ' . Horde::applicationUrl('filters.php', true));
} elseif ($user == Horde_Auth::getAuth() &&
!$share->hasPermission(Horde_Auth::getAuth(), Horde_Perms::EDIT, Horde_Auth::getAuth())) {
$notification->push(sprintf(_("You do not have permission to add events to %s."), $share->get('name')), 'horde.warning');
- } elseif ($GLOBALS['perms']->hasAppPermission('max_events') === true ||
- $GLOBALS['perms']->hasAppPermission('max_events') > Kronolith::countEvents()) {
+ } elseif ($GLOBALS['injector']->getInstance('Horde_Perms')->hasAppPermission('max_events') === true ||
+ $GLOBALS['injector']->getInstance('Horde_Perms')->hasAppPermission('max_events') > Kronolith::countEvents()) {
$event = Kronolith::getDriver(null, $calendar_id)->getEvent();
$event->readForm();
try {
Horde_Data::IMPORT_MAPPED => array($registry->get('templates', 'horde') . '/data/csvmap.inc'),
Horde_Data::IMPORT_DATETIME => array($registry->get('templates', 'horde') . '/data/datemap.inc')
);
-if ($GLOBALS['perms']->hasAppPermission('max_events') !== true &&
- $GLOBALS['perms']->hasAppPermission('max_events') <= Kronolith::countEvents()) {
+
+$perms = $GLOBALS['injector']->getInstance('Horde_Perms');
+if ($perms->hasAppPermission('max_events') !== true &&
+ $perms->hasAppPermission('max_events') <= Kronolith::countEvents()) {
try {
$message = Horde::callHook('perms_denied', array('kronolith:max_events'));
} catch (Horde_Exception_HookNotSet $e) {
- $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d events."), $GLOBALS['perms']->hasAppPermission('max_events')), ENT_COMPAT, Horde_Nls::getCharset());
+ $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d events."), $perms->hasAppPermission('max_events')), ENT_COMPAT, Horde_Nls::getCharset());
}
$notification->push($message, 'horde.warning', array('content.raw'));
$templates[Horde_Data::IMPORT_FILE] = array(KRONOLITH_TEMPLATES . '/data/export.inc');
if (is_array($next_step)) {
$events = array();
$error = false;
- $max_events = $GLOBALS['perms']->hasAppPermission('max_events');
+ $max_events = $perms->hasAppPermission('max_events');
if ($max_events !== true) {
$num_events = Kronolith::countEvents();
}
try {
$message = Horde::callHook('perms_denied', array('kronolith:max_events'));
} catch (Horde_Exception_HookNotSet $e) {
- $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d events."), $GLOBALS['perms']->hasAppPermission('max_events')), ENT_COMPAT, Horde_Nls::getCharset());
+ $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d events."), $perms->hasAppPermission('max_events')), ENT_COMPAT, Horde_Nls::getCharset());
}
$notification->push($message, 'horde.error', array('content.raw'));
break;
function _check_max()
{
- if ($GLOBALS['perms']->hasAppPermission('max_events') !== true &&
- $GLOBALS['perms']->hasAppPermission('max_events') <= Kronolith::countEvents()) {
+ $perms = $GLOBALS['injector']->getInstance('Horde_Perms');
+ if ($perms->hasAppPermission('max_events') !== true &&
+ $perms->hasAppPermission('max_events') <= Kronolith::countEvents()) {
try {
$message = Horde::callHook('perms_denied', array('kronolith:max_events'));
} catch (Horde_Exception_HookNotSet $e) {
- $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d events."), $GLOBALS['perms']->hasAppPermission('max_events')), ENT_COMPAT, Horde_Nls::getCharset());
+ $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d events."), $perms->hasAppPermission('max_events')), ENT_COMPAT, Horde_Nls::getCharset());
}
$GLOBALS['notification']->push($message, 'horde.error', array('content.raw'));
return false;
$menu->add(Horde::applicationUrl($prefs->getValue('defaultview') . '.php'), _("_Today"), 'today.png', null, null, null, '__noselection');
if (self::getDefaultCalendar(Horde_Perms::EDIT) &&
(!empty($conf['hooks']['permsdenied']) ||
- $GLOBALS['perms']->hasAppPermission('max_events') === true ||
- $GLOBALS['perms']->hasAppPermission('max_events') > self::countEvents())) {
+ $GLOBALS['injector']->getInstance('Horde_Perms')->hasAppPermission('max_events') === true ||
+ $GLOBALS['injector']->getInstance('Horde_Perms')->hasAppPermission('max_events') > self::countEvents())) {
$menu->add(Horde::applicationUrl('new.php')->add('url', Horde::selfUrl(true, false, true)), _("_New Event"), 'new.png');
}
if ($browser->hasFeature('dom')) {
$first_row = true;
$addLinks = Kronolith::getDefaultCalendar(Horde_Perms::EDIT) &&
(!empty($GLOBALS['conf']['hooks']['permsdenied']) ||
- $GLOBALS['perms']->hasAppPermission('max_events') === true ||
- $GLOBALS['perms']->hasAppPermission('max_events') > Kronolith::countEvents());
+ $GLOBALS['injector']->getInstance('Horde_Perms')->hasAppPermission('max_events') === true ||
+ $GLOBALS['injector']->getInstance('Horde_Perms')->hasAppPermission('max_events') > Kronolith::countEvents());
$showLocation = Kronolith::viewShowLocation();
$showTime = Kronolith::viewShowTime();
$buttons = array();
if (!$this->event->hasPermission(Horde_Perms::EDIT) &&
(!empty($GLOBALS['conf']['hooks']['permsdenied']) ||
- $GLOBALS['perms']->hasAppPermission('max_events') === true ||
- $GLOBALS['perms']->hasAppPermission('max_events') > Kronolith::countEvents())) {
+ $GLOBALS['injector']->getInstance('Horde_Perms')->hasAppPermission('max_events') === true ||
+ $GLOBALS['injector']->getInstance('Horde_Perms')->hasAppPermission('max_events') > Kronolith::countEvents())) {
$buttons[] = '<input type="submit" class="button" name="saveAsNew" value="' . _("Save As New") . '" />';
} else {
if ($this->event->hasPermission(Horde_Perms::EDIT)) {
if ($this->event->initialized) {
if (!$this->event->recurs() &&
(!empty($conf['hooks']['permsdenied']) ||
- $GLOBALS['perms']->hasAppPermission('max_events') === true ||
- $GLOBALS['perms']->hasAppPermission('max_events') > Kronolith::countEvents())) {
+ $GLOBALS['injector']->getInstance('Horde_Perms')->hasAppPermission('max_events') === true ||
+ $GLOBALS['injector']->getInstance('Horde_Perms')->hasAppPermission('max_events') > Kronolith::countEvents())) {
$buttons[] = '<input type="submit" class="button" name="saveAsNew" value="' . _("Save As New") . '" />';
}
}
$twentyFour = $prefs->getValue('twentyFour');
$addLinks = Kronolith::getDefaultCalendar(Horde_Perms::EDIT) &&
(!empty($GLOBALS['conf']['hooks']['permsdenied']) ||
- $GLOBALS['perms']->hasAppPermission('max_events') === true ||
- $GLOBALS['perms']->hasAppPermission('max_events') > Kronolith::countEvents());
+ $GLOBALS['injector']->getInstance('Horde_Perms')->hasAppPermission('max_events') === true ||
+ $GLOBALS['injector']->getInstance('Horde_Perms')->hasAppPermission('max_events') > Kronolith::countEvents());
if ($sidebyside) {
require KRONOLITH_TEMPLATES . '/month/head_side_by_side.inc';
$url = Horde::applicationUrl($prefs->getValue('defaultview') . '.php', true)
->add(array('month' => Horde_Util::getFormData('month'),
'year' => Horde_Util::getFormData('year')));
-if ($GLOBALS['perms']->hasAppPermission('max_events') !== true &&
- $GLOBALS['perms']->hasAppPermission('max_events') <= Kronolith::countEvents()) {
+
+$perms = $GLOBALS['injector']->getInstance('Horde_Perms');
+if ($perms->hasAppPermission('max_events') !== true &&
+ $perms->hasAppPermission('max_events') <= Kronolith::countEvents()) {
try {
$message = Horde::callHook('perms_denied', array('kronolith:max_events'));
} catch (Horde_Exception_HookNotSet $e) {
- $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d events."), $GLOBALS['perms']->hasAppPermission('max_events')), ENT_COMPAT, Horde_Nls::getCharset());
+ $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d events."), $perms->hasAppPermission('max_events')), ENT_COMPAT, Horde_Nls::getCharset());
}
$notification->push($message, 'horde.error', array('content.raw'));
header('Location: ' . $url);
<table class="striped" cellspacing="0">
<?php if ($event->recurs() &&
(!empty($conf['hooks']['permsdenied']) ||
- $GLOBALS['perms']->hasAppPermission('max_events') === true ||
- $GLOBALS['perms']->hasAppPermission('max_events') > Kronolith::countEvents())): ?>
+ $GLOBALS['injector']->getInstance('Horde_Perms')->hasAppPermission('max_events') === true ||
+ $GLOBALS['injector']->getInstance('Horde_Perms')->hasAppPermission('max_events') > Kronolith::countEvents())): ?>
<!-- recurrence editing -->
<tr>
<td></td>
<?php
if (Kronolith::getDefaultCalendar(Horde_Perms::EDIT) &&
(!empty($conf['hooks']['permsdenied']) ||
- $GLOBALS['perms']->hasAppPermission('max_events') === true ||
- $GLOBALS['perms']->hasAppPermission('max_events') > Kronolith::countEvents())) {
+ $GLOBALS['injector']->getInstance('Horde_Perms')->hasAppPermission('max_events') === true ||
+ $GLOBALS['injector']->getInstance('Horde_Perms')->hasAppPermission('max_events') > Kronolith::countEvents())) {
echo Horde::applicationUrl('new.php')
->add(array('date' => $day->dateString(),
'url' => $this->link(0, true)))
Horde_Data::IMPORT_MAPPED => array($registry->get('templates', 'horde') . '/data/csvmap.inc'),
Horde_Data::IMPORT_DATETIME => array($registry->get('templates', 'horde') . '/data/datemap.inc')
);
-if ($GLOBALS['perms']->hasAppPermission('max_tasks') !== true &&
- $GLOBALS['perms']->hasAppPermission('max_tasks') <= Nag::countTasks()) {
+
+$perms = $GLOBALS['injector']->getInstance('Horde_Perms');
+if ($perms->hasAppPermission('max_tasks') !== true &&
+ $perms->hasAppPermission('max_tasks') <= Nag::countTasks()) {
try {
$message = Horde::callHook('perms_denied', array('nag:max_tasks'));
} catch (Horde_Exception_HookNotSet $e) {
- $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d tasks."), $GLOBALS['perms']->hasAppPermission('max_tasks')), ENT_COMPAT, Horde_Nls::getCharset());
+ $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d tasks."), $perms->hasAppPermission('max_tasks')), ENT_COMPAT, Horde_Nls::getCharset());
}
$notification->push($message, 'horde.warning', array('content.raw'));
$templates[Horde_Data::IMPORT_FILE] = array(NAG_TEMPLATES . '/data/export.inc');
/* Create a Nag storage instance. */
$storage = Nag_Driver::singleton($_SESSION['import_data']['target']);
- $max_tasks = $GLOBALS['perms']->hasAppPermission('max_tasks');
+ $max_tasks = $perms->hasAppPermission('max_tasks');
$num_tasks = Nag::countTasks();
$result = null;
foreach ($next_step as $row) {
try {
$message = Horde::callHook('perms_denied', array('nag:max_tasks'));
} catch (Horde_Exception_HookNotSet $e) {
- $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d tasks."), $GLOBALS['perms']->hasAppPermission('max_tasks')), ENT_COMPAT, Horde_Nls::getCharset());
+ $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d tasks."), $perms->hasAppPermission('max_tasks')), ENT_COMPAT, Horde_Nls::getCharset());
}
$notification->push($message, 'horde.error', array('content.raw'));
break;
$menu->add(Horde::applicationUrl('list.php'), _("_List Tasks"), 'nag.png', null, null, null, basename($_SERVER['PHP_SELF']) == 'index.php' ? 'current' : null);
if (Nag::getDefaultTasklist(Horde_Perms::EDIT) &&
(!empty($conf['hooks']['permsdenied']) ||
- $GLOBALS['perms']->hasAppPermission('max_tasks') === true ||
- $GLOBALS['perms']->hasAppPermission('max_tasks') > Nag::countTasks())) {
+ $GLOBALS['injector']->getInstance('Horde_Perms')->hasAppPermission('max_tasks') === true ||
+ $GLOBALS['injector']->getInstance('Horde_Perms')->hasAppPermission('max_tasks') > Nag::countTasks())) {
$menu->add(Horde::applicationUrl(Horde_Util::addParameter('task.php', 'actionID', 'add_task')), _("_New Task"), 'add.png', null, null, null, Horde_Util::getFormData('task') ? '__noselection' : null);
if ($GLOBALS['browser']->hasFeature('dom')) {
$menu->add('', _("_Quick Add"), 'add.png', null, null, 'Nag.quickAddPanel.show(); $(\'quickText\').focus(); return false;', Horde_Util::getFormData('task') ? 'quickAdd __noselection' : 'quickAdd');
switch ($actionID) {
case 'add_task':
/* Check permissions. */
- if ($GLOBALS['perms']->hasAppPermission('max_tasks') !== true &&
- $GLOBALS['perms']->hasAppPermission('max_tasks') <= Nag::countTasks()) {
+ $perms = $GLOBALS['injector']->getInstance('Horde_Perms');
+ if ($perms->hasAppPermission('max_tasks') !== true &&
+ $perms->hasAppPermission('max_tasks') <= Nag::countTasks()) {
try {
$message = Horde::callHook('perms_denied', array('nag:max_tasks'));
} catch (Horde_Exception_HookNotSet $e) {
- $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d tasks."), $GLOBALS['perms']->hasAppPermission('max_tasks')), ENT_COMPAT, Horde_Nls::getCharset());
+ $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d tasks."), $perms->hasAppPermission('max_tasks')), ENT_COMPAT, Horde_Nls::getCharset());
}
$notification->push($message, 'horde.error', array('content.raw'));
header('Location: ' . Horde::applicationUrl('list.php', true));
$info['tasklist_id']);
} else {
/* Check permissions. */
- if ($GLOBALS['perms']->hasAppPermission('max_tasks') !== true &&
- $GLOBALS['perms']->hasAppPermission('max_tasks') <= Nag::countTasks()) {
+ $perms = $GLOBALS['injector']->getInstance('Horde_Perms');
+ if ($perms->hasAppPermission('max_tasks') !== true &&
+ $perms->hasAppPermission('max_tasks') <= Nag::countTasks()) {
header('Location: ' . Horde::applicationUrl('list.php', true));
exit;
}
public function getAllowed($perm = Horde_Perms::SHOW)
{
$cats = $this->getCategories();
+ $perms = $GLOBALS['injector']->getInstance('Horde_Perms');
+
if (Horde_Auth::isAdmin('news:admin') ||
- $GLOBALS['perms']->hasPermission('news', Horde_Auth::getAuth(), $perm)) {
+ $perms->hasPermission('news', Horde_Auth::getAuth(), $perm)) {
return $cats;
}
foreach ($cats as $key => $value) {
// user has access?
- if (!$GLOBALS['perms']->hasPermission('news:categories', Horde_Auth::getAuth(), $perm) && // master
- !$GLOBALS['perms']->hasPermission('news:categories:' . $key, Horde_Auth::getAuth(), $perm) && // child
- !$GLOBALS['perms']->hasPermission('news:categories:' . $this->_nodes[$key]['category_parentid'], Horde_Auth::getAuth(), $perm) // father
+ if (!$perms->hasPermission('news:categories', Horde_Auth::getAuth(), $perm) && // master
+ !$perms->hasPermission('news:categories:' . $key, Horde_Auth::getAuth(), $perm) && // child
+ !$perms->hasPermission('news:categories:' . $this->_nodes[$key]['category_parentid'], Horde_Auth::getAuth(), $perm) // father
) {
unset($cats[$key]);
}
} else {
$permentry = 'operator:accountcodes:' . $accountcode;
}
+
if (Horde_Auth::isAdmin() ||
- $GLOBALS['perms']->hasPermission('operator:accountcodes',
+ $perms = $GLOBALS['injector']->getInstance('Horde_Perms');
+ $perms->hasPermission('operator:accountcodes',
Horde_Auth::getAuth(),
Horde_Perms::READ) ||
- $GLOBALS['perms']->hasPermission($permentry, Horde_Auth::getAuth(),
+ $perms->hasPermission($permentry, Horde_Auth::getAuth(),
Horde_Perms::READ)) {
return $this->_getRecords($start, $end, $accountcode, $dcontext,
$rowstart, $rowlimit);
$permentry = 'operator:accountcodes:' . $accountcode;
}
if (Horde_Auth::isAdmin() ||
- $GLOBALS['perms']->hasPermission('operator:accountcodes',
+ $perms = $GLOBALS['injector']->getInstance('Horde_Perms');
+ $perms->hasPermission('operator:accountcodes',
Horde_Auth::getAuth(),
Horde_Perms::READ) ||
- $GLOBALS['perms']->hasPermission($permentry, Horde_Auth::getAuth(),
+ $perms->hasPermission($permentry, Horde_Auth::getAuth(),
Horde_Perms::READ)) {
return $this->_getMonthlyCallStats($start, $end, $accountcode,
$dcontext);
// Set up arrays for filtering
$keys = $values = $operator->driver->getAccountCodes();
+ $perms = $GLOBALS['injector']->getInstance('Horde_Perms');
if (Horde_Auth::isAdmin() ||
- $GLOBALS['perms']->hasPermission('operator:accountcodes',
+ $perms->hasPermission('operator:accountcodes',
Horde_Auth::getAuth(),
Horde_Perms::READ)) {
$permfilter = false;
}
if (!$permfilter ||
- $GLOBALS['perms']->hasPermission('operator:accountcodes:%',
+ $perms->hasPermission('operator:accountcodes:%',
Horde_Auth::getAuth(),
Horde_Perms::READ)) {
}
if (Horde_Auth::isAdmin() ||
- $GLOBALS['perms']->hasPermission($permitem,
- Horde_Auth::getAuth(),
- Horde_Perms::SHOW)) {
+ $perms->hasPermission($permitem, Horde_Auth::getAuth(), Horde_Perms::SHOW)) {
$accountcodes[$accountcode] = $values[$index];
}
}
$user = 0;
$superadmin = 0;
- $superadmin = $GLOBALS['perms']->hasPermission('shout:superadmin',
+ $perms = $GLOBALS['injector']->getInstance('Horde_Perms');
+ $superadmin = $perms->hasPermission('shout:superadmin',
Horde_Auth::getAuth(), $permmask);
while ($numparents >= 0) {
- $tmpuser = $GLOBALS['perms']->hasPermission($permname,
+ $tmpuser = $perms->hasPermission($permname,
Horde_Auth::getAuth(), $permmask);
$user = $user | $tmpuser;
*/
function hasPermission($perm)
{
- if (!$GLOBALS['perms']->exists('turba:sources:' . $this->name)) {
- // Assume we have permissions if they're not
- // explicitly set.
- return true;
- } else {
- return $GLOBALS['perms']->hasPermission('turba:sources:' . $this->name,
- Horde_Auth::getAuth(),
- $perm);
- }
+ $perms = $GLOBALS['injector']->getInstance('Horde_Perms');
+ return $perms->exists('turba:sources:' . $this->name)
+ ? $perms->hasPermission('turba:sources:' . $this->name, Horde_Auth::getAuth(), $perm)
+ // Assume we have permissions if they're not explicitly set.
+ : true;
}
/**
*/
function getExtendedPermission($addressBook, $permission)
{
- global $perms;
-
// We want to check the base source as extended permissions
// are enforced per backend, not per share.
$key = $addressBook->name . ':' . $permission;
- if (!$GLOBALS['perms']->exists('turba:sources:' . $key)) {
+ $perms = $GLOBALS['injector']->getInstance('Horde_Perms');
+ if (!$perms->exists('turba:sources:' . $key)) {
return true;
}
- $allowed = $GLOBALS['perms']->getPermissions('turba:sources:' . $key);
+ $allowed = $perms->getPermissions('turba:sources:' . $key);
if (is_array($allowed)) {
switch ($permission) {
case 'max_contacts':
$user = 0;
$superadmin = 0;
- $superadmin = $GLOBALS['perms']->hasPermission('vilma:domains',
- Horde_Auth::getAuth(), $permmask);
+ $perms = $GLOBALS['injector']->getInstance('Horde_Perms');
+ $superadmin = $perms->hasPermission('vilma:domains',
+ Horde_Auth::getAuth(), $permmask);
- $user = $GLOBALS['perms']->hasPermission($permname, Horde_Auth::getAuth(),
- $permmask);
+ $user = $perms->hasPermission($permname, Horde_Auth::getAuth(), $permmask);
return ($superadmin | $user);
}
if (!is_a($result, 'PEAR_Error')) {
$notification->push(_("The queue has been modified."),
'horde.success');
+ $perms = $GLOBALS['injector']->getInstance('Horde_Perms');
if (!$perms->exists('whups:queues:' . $vars->get('queue') . ':update')) {
- $p = &$perms->newPermission('whups:queues:'
+ $p = $perms->newPermission('whups:queues:'
. $vars->get('queue') . ':update');
$perms->addPermission($p);
}
if (!$perms->exists('whups:queues:' . $vars->get('queue') . ':assign')) {
- $p = &$perms->newPermission('whups:queues:'
+ $p = $perms->newPermission('whups:queues:'
. $vars->get('queue') . ':assign');
$perms->addPermission($p);
}
*/
function deleteQueue($queueId)
{
- $perm = &$GLOBALS['perms']->getPermission("whups:queues:$queueId");
+ $perms = $GLOBALS['injector']->getInstance('Horde_Perms');
+ $perm = $perms->getPermission("whups:queues:$queueId");
if (is_a($perm, 'PEAR_Error')) {
return;
}
- return $GLOBALS['perms']->removePermission($perm, true);
+ return $perms->removePermission($perm, true);
}
/**
*/
function deleteReply($reply)
{
- $perm = &$GLOBALS['perms']->getPermission("whups:replies:$reply");
+ $perms = $GLOBALS['injector']->getInstance('Horde_Perms');
+ $perm = $perms->getPermission("whups:replies:$reply");
if (is_a($perm, 'PEAR_Error')) {
return;
}
- return $GLOBALS['perms']->removePermission($perm, true);
+ return $perms->removePermission($perm, true);
}
/**
/* Group restrictions. */
if (Horde_Auth::isAdmin('whups:admin') ||
- $GLOBALS['perms']->hasPermission('whups:hiddenComments', Horde_Auth::getAuth(), Horde_Perms::EDIT)) {
+ $GLOBALS['injector']->getInstance('Horde_Perms')->hasPermission('whups:hiddenComments', Horde_Auth::getAuth(), Horde_Perms::EDIT)) {
$groups = &Group::singleton();
$mygroups = $groups->getGroupMemberships(Horde_Auth::getAuth());
if ($mygroups) {
function addCommentPerms($commentId, $group)
{
if (!empty($group)) {
- $perm = &$GLOBALS['perms']->newPermission('whups:comments:'
- . $commentId);
+ $perms = $GLOBALS['injector']->getInstance('Horde_Perms');
+ $perm = $perms->newPermission('whups:comments:' . $commentId);
$perm->addGroupPermission($group, Horde_Perms::READ, false);
- return $GLOBALS['perms']->addPermission($perm);
+ return $perms->addPermission($perm);
}
}
*/
function hasPermission($in, $filter, $permission, $user = null)
{
- global $perms;
-
if (is_null($user)) {
$user = Horde_Auth::getAuth();
}
$admin = Horde_Auth::isAdmin('whups:admin', $permission, $user);
}
+ $perms = $GLOBALS['injector']->getInstance('Horde_Perms');
+
switch ($filter) {
case 'queue':
if ($admin) {
function permissionsFilter($in, $filter, $permission = Horde_Perms::READ,
$user = null, $creator = null)
{
- global $perms;
-
if (is_null($user)) {
$user = Horde_Auth::getAuth();
}
$admin = Horde_Auth::isAdmin('whups:admin', $permission, $user);
+ $perms = $GLOBALS['injector']->getInstance('Horde_Perms');
$out = array();
switch ($filter) {
$private = false;
foreach ($history[$tid]['changes'] as $change) {
if (!empty($change['private'])) {
- if (!$GLOBALS['perms']->hasPermission('whups:comments:' . $change['value'], Horde_Auth::getAuth(), Horde_Perms::READ)) {
+ if (!$GLOBALS['injector']->getInstance('Horde_Perms')->hasPermission('whups:comments:' . $change['value'], Horde_Auth::getAuth(), Horde_Perms::READ)) {
$private = true;
break;
}
/* Group restrictions. */
if (Horde_Auth::isAdmin('whups:admin', Horde_Perms::EDIT) ||
- $GLOBALS['perms']->hasPermission('whups:hiddenComments',
+ $GLOBALS['injector']->getInstance('Horde_Perms')->hasPermission('whups:hiddenComments',
Horde_Auth::getAuth(), Horde_Perms::EDIT)) {
$groups = &Group::singleton();
$mygroups = $groups->getGroupMemberships(Horde_Auth::getAuth());
// the reply.
foreach ($history[$tid]['changes'] as $change) {
if (!empty($change['private'])) {
- $permission = $GLOBALS['perms']->getPermission('whups:comments:' . $change['value']);
+ $permission = $GLOBALS['injector']->getInstance('Horde_Perms')->getPermission('whups:comments:' . $change['value']);
if (!is_a($permission, 'PEAR_Error')) {
$group_id = array_shift(array_keys($permission->getGroupPermissions()));
$vars->set('group', $group_id);
*/
function getPermissions($pageName = null)
{
- global $perms, $wicked;
+ global $wicked;
if (is_null($pageName)) {
$pageName = $this->pageName();
$pageId = $wicked->getPageId($pageName);
$permName = 'wicked:pages:' . $pageId;
+ $perms = $GLOBALS['injector']->getInstance('Horde_Perms');
+
if ($pageId !== false && $perms->exists($permName)) {
return $perms->getPermissions($permName);
} elseif ($perms->exists('wicked:pages')) {
return true;
}
- global $perms;
$permName = 'wicked:pages';
+ $perms = $GLOBALS['injector']->getInstance('Horde_Perms');
+
if ($perms->exists($permName)) {
return $perms->getPermissions($permName) & Horde_Perms::EDIT;
} else {
return;
}
- global $wicked, $notification, $perms;
+ global $wicked, $notification;
$page = $wicked->retrieveByName($pagename);
// Make sure 'wicked' permission exists. Set reasonable defaults if
// necessary.
+ $perms = $GLOBALS['injector']->getInstance('Horde_Perms');
if (!$perms->exists('wicked')) {
- $perm = &$perms->newPermission('wicked');
+ $perm = $perms->newPermission('wicked');
$perm->addGuestPermission(Horde_Perms::SHOW | Horde_Perms::READ, false);
$perm->addDefaultPermission(Horde_Perms::SHOW | Horde_Perms::READ | Horde_Perms::EDIT | Horde_Perms::DELETE, false);
$perms->addPermission($perm);
// Make sure 'wicked:pages' exists. Copy from 'wicked' if it does not
// exist.
if (!$perms->exists('wicked:pages')) {
- $perm = &$perms->newPermission('wicked:pages');
- $copyFrom = &$perms->getPermission('wicked');
+ $perm = $perms->newPermission('wicked:pages');
+ $copyFrom = $perms->getPermission('wicked');
$perm->addGuestPermission($copyFrom->getGuestPermissions(), false);
$perm->addDefaultPermission($copyFrom->getDefaultPermissions(), false);
$perm->addCreatorPermission($copyFrom->getCreatorPermissions(), false);