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

LA-9: User session is not killed when user is marked as non-active #3690

Conversation

mohabmes
Copy link
Member

@mohabmes mohabmes commented Jan 8, 2024

No description provided.

Copy link
Collaborator

@Shnoulle Shnoulle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are a little update on scope usage (API semver) but since active scope is new and it's not really in API : no issue.

@tiborpacalat tiborpacalat merged commit 7677c25 into master Jan 10, 2024
20 checks passed
@tiborpacalat tiborpacalat deleted the LS6/LA-9/user-session-is-not-killed-when-user-is-deactivated branch January 10, 2024 10:52
@edgarrmondragon
Copy link
Contributor

edgarrmondragon commented Jan 13, 2024

I think this change introduced an error, at least for the RC2 API. The get_session_key method is failing with:

CDbCommand failed to execute the SQL statement: SQLSTATE[42883]: Undefined function: 7 ERROR:  operator does not exist: boolean = integer
LINE 1: ...13 17:01:11' OR expires IS NULL) AND (user_status = 1)) AND ...
                                                             ^
HINT:  No operator matches the given name and argument types. You might need to add explicit type casts.. The SQL statement executed was: SELECT * FROM "lime_users" "t" WHERE ((expires > :now OR expires IS NULL) AND (user_status = :active)) AND ("t"."uid"=1) LIMIT 1. Bound with :now='2024-01-13 17:01:11', :active=1

This is using Postgres 14 and the latest master (6.4.1). Happy to report a bug too but thought it'd be good to first reach out to the folks involved directly.


UPDATE:

If it helps, replacing the 1 value with true seems to make the db happy:

          $activeScope = array(
              'condition' => 'user_status = :active',
              'params' => array(
-                 'active' => 1,
+                 'active' => true,
              )
          );

@olleharstedt
Copy link
Collaborator

olleharstedt commented Jan 15, 2024

Isn't user_status supposed to be an integer?

Also, please include which database vendor you're using.

@Shnoulle
Copy link
Collaborator

Isn't user_status supposed to be an integer?

Also, please include which database vendor you're using.

BOOLEAN : https://github.com/LimeSurvey/LimeSurvey/blob/master/application/helpers/update/updates/Update_619.php

Same when install.

Unsure it work on MSSQL here

Surely broke with pgsql

@Shnoulle
Copy link
Collaborator

Isn't user_status supposed to be an integer?

only for mysql/mariadb :

@tiborpacalat
Copy link
Collaborator

There was an issue that I discovered last Friday. The issue is in sql script for MSSQL and Postgres. It is already being worked on.

@olleharstedt
Copy link
Collaborator

Ugh, should better be int or tinyint. We might want more user_status than 0/1 in the future...

@Shnoulle
Copy link
Collaborator

Ugh, should better be int or tinyint. We might want more user_status than 0/1 in the future...

string ?

@olleharstedt
Copy link
Collaborator

Or enum? ;)

@Shnoulle
Copy link
Collaborator

Or enum? ;)

Unsure we have an easy way to have enum on my+ms+pg with Yii ;)

@olleharstedt
Copy link
Collaborator

No, that was a joke, hehe. I wouldn't go there.

@Shnoulle
Copy link
Collaborator

No, that was a joke, hehe. I wouldn't go there.

I know :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants