[TikiWiki-commits] [Git][tikiwiki/tiki][master] [FIX] perms: Fix perms regression when switching users
"Jonny Bradley \(@jonnybradley\) via TikiWiki-cvs" <[email protected]>
| Newsgroups | gmane.comp.cms.tiki.cvs |
|---|---|
| Message-ID | <68af50bcc675d_2cd732060715@gitlab-sidekiq-low-urgency-cpu-bound-v2-75c5d7f49c-v5z5b.mail> |
Jonny Bradley pushed to branch master at Tiki Wiki CMS Groupware / Tiki
Commits:
0ec7e6dc by Jonny Bradley at 2025-08-27T18:30:46+00:00
[FIX] perms: Fix perms regression when switching users
---
* [FIX] perms: Fix perms regression when switching users part 2 - respect the `$globalize` parameter on activating a permissions context (i.e. don't set the global perm vars unless told to)
* [FIX] perms: Fix perms regression when switching users by restoring the switched to user's perms context
See merge request tikiwiki/tiki!8401
- - - - -
2 changed files:
- lib/core/Perms/Context.php
- modules/mod-func-login_box.php
Changes:
=====================================
lib/core/Perms/Context.php
=====================================
@@ -52,15 +52,18 @@ class Perms_Context
$perms = Perms::getInstance();
$this->previousUser = $user;
$this->previousGroupList = $perms->getGroups();
- $smarty = TikiLib::lib('smarty');
$user = $this->user;
$perms->setGroups($this->groupList);
- $globalperms = Perms::get();
- $globalperms->globalize(self::$permissionList, $smarty, false);
+ if ($globalize) {
+ $smarty = TikiLib::lib('smarty');
+ $globalperms = Perms::get();
- if (is_object($smarty)) {
- $smarty->assign('globalperms', $globalperms);
+ $globalperms->globalize(self::$permissionList, $smarty, false);
+
+ if (is_object($smarty)) {
+ $smarty->assign('globalperms', $globalperms);
+ }
}
}
=====================================
modules/mod-func-login_box.php
=====================================
@@ -130,6 +130,8 @@ function module_login_box($mod_reference, &$module_params)
if (! $permsPrevious->admin) {
$can_switch_user = 'n';
}
+ // restore the current "switched to" user's permissions
+ unset($permsContext);
} else {
$can_switch_user = 'n';
}
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/0ec7e6dc9f7cc2485126491d6af7d2b55a95d00a
--
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/0ec7e6dc9f7cc2485126491d6af7d2b55a95d00a
You're receiving this email because of your account on gitlab.com.
_______________________________________________
TikiWiki-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-cvs