Commit e8a776be authored by Côme Chilliet's avatar Côme Chilliet

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

issue #5531
parent ec9bb549
<?php
/*
This code is part of FusionDirectory (http://www.fusiondirectory.org/)
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
it under the terms of the GNU General Public License as published by
......@@ -33,9 +32,8 @@
*/
class pluglist
{
var $menu = "";
var $iconmenu = "";
var $current = "";
var $menu = '';
protected $iconmenu = '';
/*!
* \brief The plInfo result for all plugin, using class as key.
......@@ -56,8 +54,8 @@ class pluglist
/*!
* \brief List plugin indexes of all plugin that the user have acl for
*/
var $allowed_plugins = [];
var $silly_cache = [];
protected $allowed_plugins = [];
protected $silly_cache = [];
/*!
* \brief List the plugins
......@@ -506,6 +504,19 @@ class pluglist
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)
{
$plist = session::get('plist');
......
......@@ -129,7 +129,8 @@ class userinfo
*/
function loadACL ()
{
global $config;
global $config, $plist;
$this->ACL = [];
$this->groups = [];
$this->roles = [];
......@@ -330,6 +331,11 @@ class userinfo
if (isset($all_acl[$dn])) {
$this->ACLperPath[$this->dn] = $all_acl[$dn];
}
/* Reset plist menu and ACL cache if needed */
if (is_object($plist)) {
$plist->resetCache();
}
}
/*!
......
Markdown is supported
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