Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calculating profiles during login process removes all dynamic profiles of the user #16936

Closed
2 tasks done
kabassanov opened this issue Apr 16, 2024 · 1 comment
Closed
2 tasks done
Labels
Milestone

Comments

@kabassanov
Copy link
Contributor

kabassanov commented Apr 16, 2024

Code of Conduct

  • I agree to follow this project's Code of Conduct

Is there an existing issue for this?

  • I have searched the existing issues

Version

GLPI 10.0.15-dev

Bug description

Hello,

Some days ago I applied last commits from the bugfixes branch and I obseved that users with only dynamic profiles calculated from their groups stop connecting to GLPI. After some investigations, it appeared that the reason was that peoples dynamic profiles were deleted during the login process. Some debugging allowed me to see that the applyRightRules User's function were called twice, the first time during authentication, and the second time while getAuthToken. When I checked #16881, I found that a property called "must_process_ruleright" was introduced. I suppose that it was done in order to control if right rules should really be applied. But it seems that nothing switch it back to false. So on the first call, profile rights are updated in the DB, and on the second call they are removed. If the property is disabled at the end of the first processing, the second call would not do anything, so user would keep his profile rights...

--- User.php.orig       2024-04-16 10:28:48.495096498 +0200
+++ User.php    2024-04-16 10:29:47.579855251 +0200
@@ -1363,6 +1363,7 @@ class User extends CommonDBTM
                     $right->delete($db_profile);
                 }
             }
+           $this->must_process_ruleright = false;
         }
         return $return;
     }

Relevant log output

Backtrace :
  src/User.php:1198                                  User->applyRightRules()
  src/CommonDBTM.php:1747                            User->post_updateItem()
  src/Auth.php:1031                                  CommonDBTM->update()
  front/login.php:94                                 Auth->login()
  public/index.php:82                                require()

Backtrace :
  src/User.php:1198                                  User->applyRightRules()
  src/CommonDBTM.php:1747                            User->post_updateItem()
  src/User.php:5951                                  CommonDBTM->update()
  src/Auth.php:1094                                  User->getAuthToken()
  front/login.php:94                                 Auth->login()
  public/index.php:82                                require()

Page URL

No response

Steps To reproduce

No response

Your GLPI setup information

No response

Anything else?

No response

@trasher
Copy link
Contributor

trasher commented Apr 16, 2024

Indeed, thank for the investigation, and the proposed solution that seems perfectly correct. I've proposed it in #16937

@trasher trasher added the bug label Apr 16, 2024
@cedric-anne cedric-anne added this to the 10.0.15 milestone Apr 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants