[#645] Error in function "setPluginUse" in "Group.class.php" file



Detailed description

In the file "Group.class.php", there is the function "setPluginUse()": https://fusionforge.org/plugins/scmgit/cgi-bin/gitweb.cgi?p=fusionforge/fusionforge.git;a=blob_plain;f=src/common/include/Group.class.php;hb=HEAD

In this function, the last line is : $this->normalizeAllRoles

But this code can never be reached, because returns are before this line. Because of that, when we activate a plugin, the existing roles aren't updated.(example : we activate a Mediawiki plugin, and we cannot chose the mediawiki rights corresponding to the fusionforge role.)

The correct code is :

function setPluginUse($pluginname, $val=true) { if ($val == $this->usesPlugin($pluginname)) { // State is already good, returning return true; } $res = dbqueryparams('SELECT pluginid FROM plugins WHERE pluginname=$1', array($pluginname)); $rows = dbnumrows($res); if ($rows == 0) { // Error: no plugin by that name return false; } $pluginid = dbresult($res,0,'pluginid'); // Invalidate cache unset($this->pluginsdata); if ($val) { $res = dbqueryparams('INSERT INTO groupplugin (groupid, pluginid) VALUES ($1, $2)', array($this->getID(), $pluginid)); } else { $res = dbqueryparams('DELETE FROM groupplugin WHERE groupid=$1 AND pluginid=$2', array($this->getID(), $plugin_id)); } $this->normalizeAllRoles () ; return $res; }

General Information
Submitted by:
Matthieu DURAND
Date Submitted: 2014-03-18 17:08
Last Modified by: Nobody
Last Modified: 2017-11-02 20:00
Date Closed: 2014-03-20 10:30
Permalink: https://fusionforge.org/tracker/a_follow.php/645
Internal Fields
Data Type: Bugs
Assigned to: Franck Villaume (nerville)
State: Closed
Priority: 3
Extra Fields
Target Release:
Found in Version:
Follow-up tabs
Message  ↓
Date: 2014-03-20 10:30
Sender: Franck Villaume

thank for your feedback. Fix in Branch53. commit : cd751e55bad794ae0a143a3b2843d55280c513aa

No attached documents

No related commits.

Field Old Value Date By
status_idOpen2014-03-20 10:30
Franck Villaume
close_dateNone2014-03-20 10:30
Franck Villaume
assigned_tonone2014-03-20 10:30
Franck Villaume
Severitynormal2014-03-20 10:30
Franck Villaume
ResolutionNone2014-03-20 10:30
Franck Villaume

No relations found.