mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
fix: Suspended users cannot authenticate (#1849)
* fix: Suspended users cannot authenticate - Merge roles and apikey extract httpmw - Add member account to make dev - feat: UI Shows suspended error logging into suspended account - change 'active' route to 'activate'
This commit is contained in:
@@ -101,17 +101,19 @@ WHERE
|
||||
WHEN @search :: text != '' THEN (
|
||||
email LIKE concat('%', @search, '%')
|
||||
OR username LIKE concat('%', @search, '%')
|
||||
)
|
||||
)
|
||||
ELSE true
|
||||
END
|
||||
-- Filter by status
|
||||
AND CASE
|
||||
-- @status needs to be a text because it can be empty, If it was
|
||||
-- user_status enum, it would not.
|
||||
WHEN @status :: text != '' THEN (
|
||||
status = @status :: user_status
|
||||
WHEN cardinality(@status :: user_status[]) > 0 THEN (
|
||||
status = ANY(@status :: user_status[])
|
||||
)
|
||||
ELSE true
|
||||
ELSE
|
||||
-- Only show active by default
|
||||
status = 'active'
|
||||
END
|
||||
-- End of filters
|
||||
ORDER BY
|
||||
@@ -135,7 +137,9 @@ WHERE
|
||||
-- name: GetAllUserRoles :one
|
||||
SELECT
|
||||
-- username is returned just to help for logging purposes
|
||||
id, username, array_cat(users.rbac_roles, organization_members.roles) :: text[] AS roles
|
||||
-- status is used to enforce 'suspended' users, as all roles are ignored
|
||||
-- when suspended.
|
||||
id, username, status, array_cat(users.rbac_roles, organization_members.roles) :: text[] AS roles
|
||||
FROM
|
||||
users
|
||||
LEFT JOIN organization_members
|
||||
|
||||
Reference in New Issue
Block a user