Needs work
Project:
Force Users Logout
Version:
2.0.0
Component:
User interface
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
16 Feb 2022 at 22:34 UTC
Updated:
20 Feb 2023 at 12:46 UTC
Jump to comment: Most recent, Most recent file

Comments
Comment #2
ex dj commentedComment #3
cadila commentedGot the same issue, easy fix required
Comment #4
cadila commentedComment #5
joshua1234511Updated the Issue summary with steps to replicate.
Reviewed the Patch provided in #3

Thanks @ cadila
- The patch applies clean.
- The proposed logic works as intended.
Rerolled the patch with the changes.
Removed the unused/ additional probably duplicated from Role based from
Not specific with this issue, part of PHPCS
+ /** @var \Drupal\user\UserInterface $user */Added a new issue to track the PHPCS fixes. So that all the PHPCS issues can be tracked together.
Fix phpcs --standard=Drupal and phpcs --standard=DrupalPractice for the Force Users Logout module
Comment #6
larisse commentedI have a user with only Authenticated user role and I notice that this user is not logout, even after applied this patch. I think this need be fixed, but I'm not sure if this is a another bug and a different issue need to be open. I'll put this in "Needs Work", but feel free to change.
Comment #7
cadila commented@larisse, please check patch from https://www.drupal.org/project/force_users_logout/issues/3264773
Comment #8
larisse commentedHello @Cadila. I'm not able to logout the user with only "Authenticated user" role, even after applied the patch from the issue mentioned in comment #7.
Comment #9
kreynen commentedI ran into this in #3287657: Automated Drupal 10 compatibility fixes and was able to reproduce the issue with users that are only Authenticated users that @larisse pointed out after applying the patches. The problem with Authenticated users is that this is an assumed state so the user really isn't in a role at all.
When we're logging out everyone, why start from the user and check to see if they have the roles are logged in? Why not check the uid > 0 of the users with sessions and log out anyone that isn't in the administrator role?
Comment #10
arunkumarkThe illegal choice issue is due to the ConfigFormBase and Checkbox #option. The issues has been addressed in the Merge request.
#3340115: Remove unwanted codes and replace relevant classes
https://git.drupalcode.org/project/force_users_logout/-/merge_requests/1...
Comment #11
kreynen commentedComment #12
kreynen commentedI think this fixes the issue in that users with only the authenticated user role do not generate an error... but they aren't logged out either.
Testing this is simple. With the patched module installed, create a user with no additional roles called test-user. Log into Drupal with test-user.
In another browser, log in as an admin user with permission to admin/config/force-users-logout/otheruserslogout. Check the checkbox next to `This setting will force logout all users except admin` and submit the form by clicking the Force Logout button.
Go back to the browser where you are logged in with the authenticated test-user. You will still be logged in.
Now add test-user to a role. As the admin user, run admin/config/force-users-logout/otheruserslogout again.
The test-user is now logged out.
The underlying issue remains. Users with just the authenticated user role really have no role. They are simply authenticated.
This module is using roles to get the list of users to log out instead of logging out everyone except the current user.
Comment #13
eloivaqueReroll patch with 2.0.1 version.