Unverified Commit e8a776be authored by Côme Chilliet's avatar Côme Chilliet
Browse files

:ambulance: fix(acl) Reset pluglist menu cache when (re)loading ACLs

issue #5531
Showing with 25 additions and 8 deletions
+25 -8
<?php <?php
/* /*
This code is part of FusionDirectory (http://www.fusiondirectory.org/) This code is part of FusionDirectory (http://www.fusiondirectory.org/)
Copyright (C) 2003-2010 Cajus Pollmeier Copyright (C) 2003-2010 Cajus Pollmeier
Copyright (C) 2011-2016 FusionDirectory Copyright (C) 2011-2019 FusionDirectory
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
...@@ -33,9 +32,8 @@ ...@@ -33,9 +32,8 @@
*/ */
class pluglist class pluglist
{ {
var $menu = ""; var $menu = '';
var $iconmenu = ""; protected $iconmenu = '';
var $current = "";
/*! /*!
* \brief The plInfo result for all plugin, using class as key. * \brief The plInfo result for all plugin, using class as key.
...@@ -56,8 +54,8 @@ class pluglist ...@@ -56,8 +54,8 @@ class pluglist
/*! /*!
* \brief List plugin indexes of all plugin that the user have acl for * \brief List plugin indexes of all plugin that the user have acl for
*/ */
var $allowed_plugins = []; protected $allowed_plugins = [];
var $silly_cache = []; protected $silly_cache = [];
/*! /*!
* \brief List the plugins * \brief List the plugins
...@@ -506,6 +504,19 @@ class pluglist ...@@ -506,6 +504,19 @@ class pluglist
return isset($this->allowed_plugins[$plug_id]); return isset($this->allowed_plugins[$plug_id]);
} }
/*!
* \brief Resets menu and ACL cache
*
* Called when user ACL rights may have changed
*/
public function resetCache ()
{
$this->menu = '';
$this->iconmenu = '';
$this->silly_cache = [];
$this->allowed_plugins = [];
}
static function pluginInfos ($cname) static function pluginInfos ($cname)
{ {
$plist = session::get('plist'); $plist = session::get('plist');
......
...@@ -129,7 +129,8 @@ class userinfo ...@@ -129,7 +129,8 @@ class userinfo
*/ */
function loadACL () function loadACL ()
{ {
global $config; global $config, $plist;
$this->ACL = []; $this->ACL = [];
$this->groups = []; $this->groups = [];
$this->roles = []; $this->roles = [];
...@@ -330,6 +331,11 @@ class userinfo ...@@ -330,6 +331,11 @@ class userinfo
if (isset($all_acl[$dn])) { if (isset($all_acl[$dn])) {
$this->ACLperPath[$this->dn] = $all_acl[$dn]; $this->ACLperPath[$this->dn] = $all_acl[$dn];
} }
/* Reset plist menu and ACL cache if needed */
if (is_object($plist)) {
$plist->resetCache();
}
} }
/*! /*!
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment