[TikiWiki-commits] [Git][tikiwiki/tiki][28.x] [FIX] perms: Fix perms regression when switching users

"Jonny Bradley \(@jonnybradley\) via TikiWiki-cvs" <[email protected]>
Newsgroups gmane.comp.cms.tiki.cvs
Message-ID <68b02c1890882_2cd7820951fd@gitlab-sidekiq-low-urgency-cpu-bound-v2-5549c745b5-nmwsl.mail>

Jonny Bradley pushed to branch 28.x at Tiki Wiki CMS Groupware / Tiki


Commits:
7512351f by Jonny Bradley at 2025-08-28T10:07:36+00:00
[FIX] perms: Fix perms regression when switching users
---
* [FIX] perms: Fix perms regression when switching users
---
* [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


(cherry picked from commit 0ec7e6dc9f7cc2485126491d6af7d2b55a95d00a)

0131964d [FIX] perms: Fix perms regression when switching users by restoring the...
1b7bef05 [FIX] perms: Fix perms regression when switching users part 2 - respect the...

Co-authored-by: Jonny Bradley <[email protected]>

See merge request tikiwiki/tiki!8436


(cherry picked from commit 61cc8311fffc0a62d6ce2a22af82847b9c3f46dc)

2f513adc [FIX] perms: Fix perms regression when switching users

Co-authored-by: Jonny Bradley <[email protected]>

See merge request tikiwiki/tiki!8437

- - - - -


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
=====================================
@@ -126,6 +126,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/7512351fc15d5fbaba9462f82d00aeabbd7ac01a

-- 
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/7512351fc15d5fbaba9462f82d00aeabbd7ac01a
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.