Dependency Graph

Dependency Graph
related to related to child of child of duplicate of duplicate of

View Issue Details

This bug affects 1 person(s).
 12
IDProjectCategoryView StatusLast Update
18224Bug reportsUser / Groups / Rolespublic2022-09-27 21:44
Reportermhladun Assigned ToDenisChenu  
PrioritynormalSeverityminor 
Status closedResolutionreopened 
Product Version5.3.x 
Fixed in Version5.3.x 
Summary18224: Can't set Survey Permissions for User Group when usercontrolSameGroupPolicy is false
Description

Ideally, when usercontrolSameGroupPolicy is set to false/0, a survey owner can:

  1. go to their Survey Permissions
  2. add a User Group they do not belong to
  3. set survey permissions for the User Group they don't belong to for their specific survey

This isn't the case, but modifying two lines in SurveyPermission.php, by adding the condition,

&& Yii::app()->getConfig('usercontrolSameGroupPolicy') == true

can fix this. The two lines are,

~ line 435
} elseif ($action == "setusergroupsurveysecurity") {
if (!in_array($postusergroupid, getUserGroupList()) / THIS LINE && Yii::app()->getConfig('usercontrolSameGroupPolicy') == true / ) {
throw new CHttpException(403, gT("You do not have permission to this user group."));
}
$postuserid = null;

and

~ 591
if (!$isInArray / THIS LINE && Yii::app()->getConfig('usercontrolSameGroupPolicy') == true / ) {
throw new CHttpException(403, gT("You do not have permission to this user group."));
}

Steps To Reproduce

Steps to reproduce

  1. Set usercontrolSameGroupPolicy = 0 in your database (table = .*settings_global)
  2. Go to a survey's Survey Permissions tab and select a User Group that you, the user, is not a part of.
  3. Add that User Group
  4. Click "Set survey rights" on the next dialogue
  5. Notice the 403 Error being thrown because you are not a part of the User Group you want to set permissions for.
  6. Notice that all users in the User Group you just set can have their permissions changed, so the inability to set survey permissions for a User Group is redundant.

Expected result

  1. No error is throw, and the ability to set survey permissions for an entire User Group appears in a view.

Actual result

  1. from #### Steps to reproduce
  2. from #### Steps to reproduce
TagsNo tags attached.
Bug heat12
Complete LimeSurvey version number (& build) 5.3.20 + 220615
I will donate to the project if issue is resolvedNo
BrowserChrome
Database type & versionPostgresql, EnterpriseDB 10.9.17
Server OS (if known)Windows
Webserver software & version (if known)Apache/2.4.53 (Win64) OpenSSL/1.1.1n
PHP VersionPHP/8.0.19

Relationships

parent of 18297 closedDenisChenu Survey permissions menu does not work 

Activities

mhladun

mhladun

2022-06-30 00:32

reporter  

DenisChenu

DenisChenu

2022-06-30 09:08

developer   ~70620

I think you can create a Pull Request ,
looking at your code : seems needed :)

Maybe something like this

if (App()->getConfig('usercontrolSameGroupPolicy') && !in_array($postusergroupid, getUserGroupList())) {

DenisChenu

DenisChenu

2022-06-30 09:10

developer   ~70621

Alt solution : doing it in https://github.com/LimeSurvey/LimeSurvey/blob/4166d26e155082a42b4476a929086b8fd4abc6fa/application/helpers/common_helper.php#L4135 ?

mhladun

mhladun

2022-06-30 20:42

reporter   ~70644

@DenisChenu sounds good. Should I submit a pull request with the code changes, or does any more discussion need to occur?

DenisChenu

DenisChenu

2022-07-02 09:52

developer   ~70689

Please : submit the pool request , and assign it to me :).

mhladun

mhladun

2022-07-04 20:24

reporter   ~70694

@DenisChenu https://github.com/LimeSurvey/LimeSurvey/pull/2498

guest

guest

2022-07-25 19:30

viewer   ~71129

Fix committed to master branch: http://bugs.limesurvey.org/plugin.php?page=Source/view&id=33681

LimeBot

LimeBot

2022-07-27 11:48

administrator   ~71171

Fixed in Release 5.3.28+220727

ollehar

ollehar

2022-08-01 15:51

administrator   ~71267

Please see https://bugs.limesurvey.org/view.php?id=18297

adelphisurveys

adelphisurveys

2022-08-09 20:17

reporter   ~71392

After updating to version 5.3.30+220808 it seems to work again for now.
Thank you very much for your support.

Related Changesets

LimeSurvey: master 49e2d2fc

2022-07-25 19:30:00

skwzrd


Committer: GitHub Details Diff
Fixed issue 18224: Can't set Survey Permissions for User Group when usercontrolSameGroupPolicy is false

Dev: phpcs
Affected Issues
18224
mod - application/controllers/SurveysGroupsPermissionController.php Diff File
mod - application/controllers/admin/SurveyPermission.php Diff File
mod - application/helpers/common_helper.php Diff File

Issue History

Date Modified Username Field Change
2022-06-30 00:32 mhladun New Issue
2022-06-30 00:32 mhladun File Added: user_group_survey_permissions.png
2022-06-30 09:08 DenisChenu Note Added: 70620
2022-06-30 09:08 DenisChenu Bug heat 0 => 2
2022-06-30 09:10 DenisChenu Note Added: 70621
2022-06-30 20:42 mhladun Note Added: 70644
2022-06-30 20:42 mhladun Bug heat 2 => 4
2022-07-02 01:38 gabrieljenik Assigned To => DenisChenu
2022-07-02 01:38 gabrieljenik Status new => assigned
2022-07-02 09:52 DenisChenu Note Added: 70689
2022-07-04 15:18 DenisChenu Priority none => normal
2022-07-04 20:24 mhladun Note Added: 70694
2022-07-25 19:30 Changeset attached => LimeSurvey master 49e2d2fc
2022-07-25 19:30 guest Note Added: 71129
2022-07-25 19:30 guest Bug heat 4 => 6
2022-07-27 11:48 LimeBot Note Added: 71171
2022-07-27 11:48 LimeBot Status assigned => closed
2022-07-27 11:48 LimeBot Resolution open => fixed
2022-07-27 11:48 LimeBot Bug heat 6 => 8
2022-08-01 15:51 ollehar Status closed => feedback
2022-08-01 15:51 ollehar Resolution fixed => reopened
2022-08-01 15:51 ollehar Relationship added parent of 18297
2022-08-01 15:51 ollehar Note Added: 71267
2022-08-01 15:51 ollehar Bug heat 8 => 10
2022-08-01 18:23 DenisChenu Status feedback => resolved
2022-08-01 18:23 DenisChenu Fixed in Version => 5.3.x
2022-08-09 20:17 adelphisurveys Note Added: 71392
2022-08-09 20:17 adelphisurveys Bug heat 10 => 12
2022-09-27 21:44 c_schmitz Status resolved => closed