-
Notifications
You must be signed in to change notification settings - Fork 978
Add system user with special uuid #2428
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
CREATE EXTENSION IF NOT EXISTS "uuid-ossp"; | ||
|
||
DELETE FROM | ||
users | ||
WHERE | ||
id = '11111111-1111-1111-1111-111111111111'; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
INSERT INTO | ||
users ( | ||
id, | ||
email, | ||
username, | ||
hashed_password, | ||
created_at, | ||
updated_at, | ||
rbac_roles | ||
) | ||
VALUES | ||
('11111111-1111-1111-1111-111111111111', 'system@coder.com', 'system', '{}', NOW(), NOW(), '{}'); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,11 +22,13 @@ WHERE | |
LIMIT | ||
1; | ||
|
||
-- name: GetUserCount :one | ||
-- name: GetActualUserCount :one | ||
AbhineetJain marked this conversation as resolved.
Show resolved
Hide resolved
|
||
SELECT | ||
COUNT(*) | ||
FROM | ||
users; | ||
users | ||
WHERE | ||
id != '11111111-1111-1111-1111-111111111111'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't believe this is a valid uuid, it needs some certain bits set. See https://github.com/google/uuid/blob/master/version4.go#L53 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. TIL There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thank you! Updated it to |
||
|
||
-- name: InsertUser :one | ||
INSERT INTO | ||
|
@@ -104,6 +106,13 @@ WHERE | |
) | ||
ELSE true | ||
END | ||
-- Filter out system user | ||
AND CASE | ||
WHEN @include_system_user :: boolean THEN true | ||
ELSE ( | ||
id != '11111111-1111-1111-1111-111111111111' | ||
) | ||
END | ||
-- Filter by status | ||
AND CASE | ||
-- @status needs to be a text because it can be empty, If it was | ||
|
Uh oh!
There was an error while loading. Please reload this page.