Home My Page Projects FusionForge
Summary Activity Forums Tracker Lists News SCM Files Mediawiki Hudson/Jenkins

[#846] Change of Mediawiki rights are not saved

Date:
2017-02-02 10:09
Priority:
3
State:
Closed
Submitted by:
Michael Kluge (mkluge)
Assigned to:
Nobody (None)
Target Release:
6.0.5
Found in Version:
6.0.1
Severity:
normal
Resolution:
Fixed
Summary:
Change of Mediawiki rights are not saved

Detailed description
Hi,

we run FusionForge with the Mediawiki plugin. I created an additional role in the project and tried to set the Mediawiki write rights to full rights (create, move, etc.) and then I click save and get a confirmation. But it actually does not save this. The role remains with rights, where it can only change existing sites. I can not see any errors in /var/log/apache and /var/log/fusionforge. How can I debug this?


Regards, Michael
Message  ↓
Date: 2017-07-04 05:54
Sender: Michael Kluge

The issue is back, but only with custom roles. When I look at the output that you suggested, then I can see that the roles are actually edited by the DB requests. For example, I can set different settings for the mediawiki plugin, and the roles are edited in the database. But the roleedit.php does not reflect the modified settings. Also not, if I reload the page. Maybe there is a bug in

common/mediawikiPlugin.class.php ?

Date: 2017-02-27 10:15
Sender: Michael Kluge

Problem is solved in 6.0.5+201702202128-1.

Date: 2017-02-02 14:40
Sender: Franck Villaume

Hi,

this one is not easy to debug unless to dig into the code.

Role permission update is done using prepared sql queries.
File to look into: ~/common/include/RBAC.php
function update($role_name,$data,$check_perms=true,$update_sys=true)

Line 839 & 840 you have:
839 db_prepare ('UPDATE pfo_role_setting SET perm_val=$4 WHERE role_id=$1 AND section_name=$2 AND ref_id=$3',
840 'update_pfo_role_setting');

Then you have this loop:
850 foreach ($data as $sect => &$refs) {
851 foreach ($refs as $refid => $value) {
852 if (!isset($this->perms_array[$sect][$refid])) {
853 // new permission
854 db_execute('insert_into_pfo_role_setting',
855 array($role_id, $sect, $refid, $value));
856 } elseif ($this->perms_array[$sect][$refid] != $value) {
857 // changed permission
858 db_execute('update_pfo_role_setting',
859 array($role_id, $sect, $refid, $value));
860 }
861 }

check line 858 for updating permission.
$value should have the new permission value you set.

$value is from a multi-dimensional array: $data['section']['refid'] = $value
$data is built in the page ~/project/admin/roleedit.php

Echoing $value on line 857 will help you to know which value will be set by the db_prepare query: update_pfo_role_setting
To understand the $value, you have to look in Mediawiki Plugin main class, and look at the hook "role_get"

PS: there is a hook: role_update. No need to look for it. It is not used nor implemented by any plugin.

Field Old Value Date By
status_idOpen2017-02-28 12:20nerville
close_dateNone2017-02-28 12:20nerville
Target ReleaseNone2017-02-28 12:20nerville
ResolutionNone2017-02-28 12:20nerville