Relationship Graph

Relationship 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
18281Bug reportsUser / Groups / Rolespublic2023-05-30 14:50
Reporterp_teichmann Assigned Toc_schmitz  
PrioritynoneSeverityminor 
Status feedbackResolutionopen 
Product Version5.3.x 
Summary18281: Users in group are not deleted
Description

When you click the menu entry “user groups“ in the top menu configuration you get an error (page is not loading) Screenshot attached

  1. The reason is (maybe), that when deleting a usergroup the entry in table user_in_groups is not deleted, but it should.
  2. Simply set debug=0 and it works again
Steps To Reproduce

Steps to reproduce

(Replace this text with detailed step-by-step instructions on how to reproduce the issue)

Expected result

(Write here what you expected to happen)

Actual result

(Write here what happened instead)

TagsNo tags attached.
Bug heat12
Complete LimeSurvey version number (& build)5
I will donate to the project if issue is resolvedNo
Browser
Database type & versionMySQL
Server OS (if known)
Webserver software & version (if known)
PHP Version7.2

Relationships

has duplicate 18400 closedgabrieljenik After I delte a User there will still be an entry in lime_user_in_groups 
related to 18294 ready for mergeollehar User was not added to group created automatically 
child of 18289 confirmed User with group creation allowed can not see is own group 

Activities

p_teichmann

p_teichmann

2022-07-27 11:04

administrator  

gabrieljenik

gabrieljenik

2022-07-27 22:32

manager   ~71204

Can you provide more steps for rerproducing?
I think you had some kind of orphan records or broken relationships..

gabrieljenik

gabrieljenik

2022-08-04 15:26

manager   ~71322

Last edited: 2022-08-04 15:28

So the problem happens when you create a usergrp as a user and then delete the user, when you then go to the usergroups page the error is visible. The main problem is that the users dont get deleted at all from the tables "user_groups" and "user_in_groups".

gabrieljenik

gabrieljenik

2022-08-09 19:28

manager   ~71391

Part of the problems had to do with the fact that the code assumed that if you were the owner you were in the group. In LTS it is like this, the owner is always in the group. But in master no.

Also done:

  • Transfer to user 1 if the owner user is deleted
  • If the owner of a group no longer exists, instead of the name it shows "(Deleted user)" in the table. (shouldn't happen, but still)
  • Fixed inconsistencies in the actionViewGroup(). Things that were set inside IF statements and were always used.

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

DenisChenu

DenisChenu

2022-08-23 16:00

developer   ~71519

Last edited: 2022-08-23 16:00

My opinion : we must have a clean decision about $userGroup->owner_id == Yii::app()->user->id on the right part
We don't have this control in 3.X

I think we must have UserGroup->hasPermission with something like this

    /* superadmin can do whole */
    if(Permission::model()->hasPermission(0, 'global', 'superadmin', 'read', $iUserID)) {
        return true;
    }
    /* usercontrolSameGroupPolicy : need to be in group */
    if (App()->getConfig('usercontrolSameGroupPolicy') && !$this->hasUser($iUserID)) {
        return false;
    }
    /* Check global right only (no single rights) */
    return Permission::model()->hasPermission(0, 'global', 'usergroups', $sCRUD, $iUserID);

When decision is done about owner : we can easily add it here.

gabrieljenik

gabrieljenik

2022-08-23 17:17

manager   ~71520

I think we must have UserGroup->hasPermission with something like this

So, you wouldn't care about who owns the group, right?

DenisChenu

DenisChenu

2022-08-24 08:16

developer   ~71522

Currently no, be cause we don't care in 3.X and in current 5.X.
owner_id are not used in UserGroup permission since years … do not add it without discussion (and API update)

Then : need decision about usage of owner_id before adding it.

See the last sentence

When decision is done about owner : we can easily add it here.

gabrieljenik

gabrieljenik

2022-08-24 14:30

manager   ~71525

owner_id are not used in UserGroup permission since years

Not sure if we are talking about the same thing... I see it is being used a lot...

https://github.com/LimeSurvey/LimeSurvey/blob/master/application/models/UserGroup.php#L191
https://github.com/LimeSurvey/LimeSurvey/blob/master/application/models/UserGroup.php#L232

https://github.com/LimeSurvey/LimeSurvey/blob/master/application/controllers/UserGroupController.php#L178
https://github.com/LimeSurvey/LimeSurvey/blob/master/application/controllers/UserGroupController.php#L190
https://github.com/LimeSurvey/LimeSurvey/blob/master/application/controllers/UserGroupController.php#L347
....

Are we talking about the same stuff?

do not add it without discussion (and API update)

No worries, I am not saying I will, I will not... Why would I?

DenisChenu

DenisChenu

2022-08-27 19:49

developer   ~71544

Not sure if we are talking about the same thing... I see it is being used a lot...

Seems to didn't work with specific permission then …

Time to update to real Permission system …
https://github.com/LimeSurvey/LimeSurvey/blob/master/application/models/Traits/PermissionTrait.php

gabrieljenik

gabrieljenik

2022-08-29 15:17

manager   ~71555

Look forward for decisions and directions ...

c_schmitz

c_schmitz

2023-05-30 14:50

administrator   ~75255

For LS5:
The group owner should be member of the group.
For LS6:
The group owner can be a group member, but doesn't have to be. However, the group owner should always be able to see/edit group members.

Issue History

Date Modified Username Field Change
2022-07-27 11:04 p_teichmann New Issue
2022-07-27 11:04 p_teichmann File Added: 58aefca2-a89d-4515-b277-d4cfdd7b17a9.png
2022-07-27 11:05 p_teichmann Assigned To => gabrieljenik
2022-07-27 11:05 p_teichmann Status new => assigned
2022-07-27 22:32 gabrieljenik Note Added: 71204
2022-07-27 22:32 gabrieljenik Bug heat 0 => 2
2022-07-27 22:32 gabrieljenik Status assigned => feedback
2022-08-04 15:26 gabrieljenik Status feedback => assigned
2022-08-04 15:26 gabrieljenik Note Added: 71322
2022-08-04 15:28 gabrieljenik Note Edited: 71322
2022-08-09 19:28 gabrieljenik Assigned To gabrieljenik => DenisChenu
2022-08-09 19:28 gabrieljenik Status assigned => ready for code review
2022-08-09 19:28 gabrieljenik Note Added: 71391
2022-08-23 15:49 DenisChenu Relationship added child of 18289
2022-08-23 16:00 DenisChenu Note Added: 71519
2022-08-23 16:00 DenisChenu Bug heat 2 => 4
2022-08-23 16:00 DenisChenu Note Edited: 71519
2022-08-23 16:30 DenisChenu Assigned To DenisChenu => gabrieljenik
2022-08-23 16:30 DenisChenu Status ready for code review => in code review
2022-08-23 17:17 gabrieljenik Note Added: 71520
2022-08-24 08:16 DenisChenu Note Added: 71522
2022-08-24 14:30 gabrieljenik Note Added: 71525
2022-08-27 19:49 DenisChenu Note Added: 71544
2022-08-29 15:17 gabrieljenik Assigned To gabrieljenik => c_schmitz
2022-08-29 15:17 gabrieljenik Status in code review => feedback
2022-08-29 15:17 gabrieljenik Note Added: 71555
2022-09-09 16:24 DenisChenu Relationship added related to 18294
2022-10-17 22:10 gabrieljenik Relationship added has duplicate 18400
2022-10-17 22:10 gabrieljenik Bug heat 4 => 10
2023-05-30 14:50 c_schmitz Note Added: 75255
2023-05-30 14:50 c_schmitz Bug heat 10 => 12