View Issue Details

This bug affects 1 person(s).
 10
IDProjectCategoryView StatusLast Update
17717Bug reportsUser / Groups / Rolespublic2021-12-01 09:28
Reportervitautss Assigned Togalads  
PrioritynoneSeverityminor 
Status closedResolutionfixed 
Product Version5.x 
Summary17717: Saving survey group permissions fails with error 500 when auditlog plugin is active
Description

It is not possible to save survey group permissions.

NOTE: AuditLog is activated

Steps To Reproduce

Steps to reproduce

Create survey group.
Create user with no permissions on survey groups.
Open survey group permissions page.
Add user to survey group.
Go to "Set the permission for this user" immediately after this or open user permissions from groups list.
Check some permissions and try to save.

Expected result

Permission changes are saved,

Actual result

Error 500 and permission changes not saved.

Additional Information

AuditLog plugin is active

TagsNo tags attached.
Attached Files
2021-11-11_18-19.png (59,830 bytes)   
2021-11-11_18-19.png (59,830 bytes)   
Bug heat10
Complete LimeSurvey version number (& build) 5.1.15+211011
I will donate to the project if issue is resolvedNo
Browser
Database type & versionMySQL 8.0
Server OS (if known)
Webserver software & version (if known)
PHP Version7.4

Users monitoring this issue

There are no users monitoring this issue.

Activities

DenisChenu

DenisChenu

2021-11-11 19:04

developer   ~67258

I can not reproduce on 5.2.1
Can you try to update ?
And activate debug mode manual.limesurvey.org/Debug_mode

vitautss

vitautss

2021-11-11 19:36

reporter   ~67261

Last edited: 2021-11-12 09:39

5.2.1 still has this problem.
In what format better to post debug output? Simple copy/paste below.
I have PR to fix this - https://github.com/LimeSurvey/LimeSurvey/pull/2141

Error

Class 'survey' not found

/var/www/survey/application/models/Permission.php(103)

091 public static function getEntityBasePermissions($sEntityName)
092 {
093 / @todo : check $sEntityName implement PermissionInterface /
094 $defaults = array(
095 'create' => true,
096 'read' => true,
097 'update' => true,
098 'delete' => true,
099 'import' => true,
100 'export' => true,
101 );
102
103 $aPermissions = $sEntityName::getPermissionData();
104 uasort($aPermissions, array(CLASS, "comparePermissionTitle"));
105 foreach ($aPermissions as &$permission) {
106 $permission = array_merge($defaults, $permission);
107 }
108 return $aPermissions;
109 }
110
111 /*
112
Return minimal permission name (for read value)
113 @param string $sEntityName must be an existing object child of LSActiveRecord
114
@return null|string
115 */

Stack Trace
#0

/var/www/survey/application/models/Permission.php(214): Permission::getEntityBasePermissions("survey")

209 return $aBasePermissions;
210 }
211 if ($sEntityName == 'global') {
212 $aBasePermissions = Permission::model()->getGlobalBasePermissions();
213 } else {
214 $aBasePermissions = Permission::model()->getEntityBasePermissions($sEntityName);
215 }
216
217 foreach ($aBasePermissions as $sPermission => &$aPermissionDetail) {
218 $oCurrentPermissions = Permission::model()->findByAttributes(array(
219 'uid' => $iUserID,

#1

/var/www/survey/application/libraries/PluginManager/LimesurveyApi.php(385): Permission::getPermissions("11", null, "survey")

380 @param ?string $sEntityName
381
@return ?array Returns null if the user does not exist anymore for some reason (should not really happen)
382 */
383 public function getPermissionSet($iUserID, $iEntityID = null, $sEntityName = null)
384 {
385 return \Permission::model()->getPermissions($iUserID, $iEntityID, $sEntityName);
386 }
387
388 /*
389
Retrieves Participant data
390 * @param int $iParticipantID The Participant ID

#2

/var/www/survey/application/core/plugins/AuditLog/AuditLog.php(200): LimeSurvey\PluginManager\LimesurveyApi->getPermissionSet("11", null, "survey")

195 $event = $this->getEvent();
196 $aNewPermissions = $event->get('aNewPermissions');
197 $iSurveyID = $event->get('iSurveyID');
198 $iUserID = $event->get('iUserID');
199 $oCurrentUser = $this->api->getCurrentUser();
200 $oOldPermission = $this->api->getPermissionSet($iUserID, $iSurveyID, 'survey');
201 $sAction = 'update'; // Permissions are in general only updated (either you have a permission or you don't)
202
203 if (count(array_diff_assoc_recursive($aNewPermissions, $oOldPermission))) {
204 $oAutoLog = $this->api->newModel($this, 'log');
205 $oAutoLog->uid = $oCurrentUser->uid;

#3
unknown(0): AuditLog->beforePermissionSetSave()
#4
+
/var/www/survey/application/libraries/PluginManager/PluginManager.php(265): call_user_func(array(AuditLog, "beforePermissionSetSave"))
#5
+
/var/www/survey/application/models/services/PermissionManager.php(154): LimeSurvey\PluginManager\PluginManager->dispatchEvent(LimeSurvey\PluginManager\PluginEvent)
#6
+
/var/www/survey/application/controllers/SurveysGroupsPermissionController.php(389): LimeSurvey\Models\Services\PermissionManager->setPermissions("11")
#7
unknown(0): SurveysGroupsPermissionController->actionSave("4")
#8
+
/var/www/survey/framework/web/actions/CAction.php(115): ReflectionMethod->invokeArgs(SurveysGroupsPermissionController, array("4"))
#9
+
/var/www/survey/framework/web/actions/CInlineAction.php(47): CAction->runWithParamsInternal(SurveysGroupsPermissionController, ReflectionMethod, array("id" => "4"))
#10
+
/var/www/survey/framework/web/CController.php(308): CInlineAction->runWithParams(array("id" => "4"))
#11
+
/var/www/survey/framework/web/filters/CFilterChain.php(134): CController->runAction(CInlineAction)
#12
+
/var/www/survey/framework/web/CController.php(291): CFilterChain->run()
#13
+
/var/www/survey/framework/web/CController.php(265): CController->runActionWithFilters(CInlineAction, array("postOnly + DeleteUser"))
#14
+
/var/www/survey/application/controllers/LSBaseController.php(160): CController->run("save")
#15
+
/var/www/survey/framework/web/CWebApplication.php(282): LSBaseController->run("save")
#16
+
/var/www/survey/framework/web/CWebApplication.php(141): CWebApplication->runController("surveysGroupsPermission/save")
#17
+
/var/www/survey/framework/base/CApplication.php(185): CWebApplication->processRequest()
#18
+
/var/www/survey/index.php(192): CApplication->run()
2021-11-11 20:32:15 Apache Yii Framework/1.1.24-dev

vitautss

vitautss

2021-11-11 20:00

reporter   ~67262

Last edited: 2021-11-12 09:39

Well, my fauilt, forgot to mention AuditLog plugin is enabled. Problem is in this plugin code, see my PR.

DenisChenu

DenisChenu

2021-11-12 08:00

developer   ~67263

Last edited: 2021-11-12 09:39

Thank you !

Else

Method getPermissionSet() expects camelcase entity name.

Maybe more another potential issues there ?

galads

galads

2021-11-12 09:24

reporter   ~67264

Last edited: 2021-11-12 09:39

@vitautss , thank you for reporting this issue. Can you edit the report to include it is caused by the audit log plugin? Also include the link to your PR here as a comment and we will test and update accordingly.

galads

galads

2021-11-12 09:39

reporter   ~67266

Last edited: 2021-11-12 09:39

https://github.com/LimeSurvey/LimeSurvey/pull/2141

vitautss

vitautss

2021-11-12 10:06

reporter   ~67269

@galads How can I update report? Can't find edit option.

galads

galads

2021-11-12 10:09

reporter   ~67270

@vitautss , I have already edited the report. Thanks.

guest

guest

2021-11-13 20:55

viewer   ~67282

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

c_schmitz

c_schmitz

2021-12-01 09:28

administrator   ~67629

New version released

Related Changesets

LimeSurvey: master f1c836a9

2021-11-13 20:55:24

vitautss


Committer: GitHub Details Diff
Fixed issue 17717: Saving survey group permissions fails with error if auditlog plugin is active (#2141)

Dev Method getPermissionSet() expects camelcase entity name.
Affected Issues
17717
mod - application/core/plugins/AuditLog/AuditLog.php Diff File

Issue History

Date Modified Username Field Change
2021-11-11 17:30 vitautss New Issue
2021-11-11 17:30 vitautss File Added: 2021-11-11_18-19.png
2021-11-11 19:04 DenisChenu Note Added: 67258
2021-11-11 19:04 DenisChenu Bug heat 0 => 2
2021-11-11 19:36 vitautss Note Added: 67261
2021-11-11 19:36 vitautss Bug heat 2 => 4
2021-11-11 20:00 vitautss Note Added: 67262
2021-11-12 08:00 DenisChenu Note Added: 67263
2021-11-12 09:24 galads Note Added: 67264
2021-11-12 09:24 galads Bug heat 4 => 6
2021-11-12 09:25 galads Assigned To => galads
2021-11-12 09:25 galads Status new => acknowledged
2021-11-12 09:39 galads Note Added: 67266
2021-11-12 09:39 galads Zoho Project Synchronization => |Yes|
2021-11-12 09:40 galads Status acknowledged => ready for testing
2021-11-12 10:06 vitautss Note Added: 67269
2021-11-12 10:08 galads Summary Saving survey group permissions fails with error 500 => Saving survey group permissions fails with error 500 when auditlog plugin is active
2021-11-12 10:08 galads Description Updated
2021-11-12 10:08 galads Additional Information Updated
2021-11-12 10:08 galads Zoho Project Synchronization Yes => |Yes|
2021-11-12 10:09 galads Note Added: 67270
2021-11-13 20:55 vitautss Changeset attached => LimeSurvey master f1c836a9
2021-11-13 20:55 guest Note Added: 67282
2021-11-13 20:55 guest Bug heat 6 => 8
2021-11-13 20:56 c_schmitz Status ready for testing => resolved
2021-11-13 20:56 c_schmitz Resolution open => fixed
2021-12-01 09:28 c_schmitz Note Added: 67629
2021-12-01 09:28 c_schmitz Bug heat 8 => 10
2021-12-01 09:28 c_schmitz Status resolved => closed