Skip to content

chore: Rename 'admin' to 'owner'#3498

Merged
Emyrk merged 11 commits into
mainfrom
stevenmasley/2135/roles_mig
Aug 15, 2022
Merged

chore: Rename 'admin' to 'owner'#3498
Emyrk merged 11 commits into
mainfrom
stevenmasley/2135/roles_mig

Conversation

@Emyrk
Copy link
Copy Markdown
Member

@Emyrk Emyrk commented Aug 12, 2022

What this does

Admin -> template-admin and user-admin
First user -> owner

Screenshot from 2022-08-12 16-26-23

@Emyrk Emyrk marked this pull request as draft August 12, 2022 21:30
@Emyrk Emyrk force-pushed the stevenmasley/2135/roles_mig branch from a202178 to fb4f80f Compare August 12, 2022 22:29
@Emyrk Emyrk marked this pull request as ready for review August 15, 2022 15:24
@Emyrk Emyrk requested review from a team and ammario as code owners August 15, 2022 15:24
Copy link
Copy Markdown
Member

@Kira-Pilot Kira-Pilot left a comment

Choose a reason for hiding this comment

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

FE ✅

@Emyrk Emyrk requested review from coadler and johnstcn August 15, 2022 16:52
Comment thread coderd/database/migrations/000034_remove_admin_role.down.sql Outdated
Comment thread coderd/database/migrations/000034_remove_admin_role.up.sql
-- Update the first user with the role 'admin'. This should be the first
-- user ever, but if that user was demoted from an admin, then choose
-- the next best user.
id = (SELECT id FROM users WHERE 'admin' = ANY(rbac_roles) ORDER BY created_at ASC LIMIT 1);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This could technically cause the query to fail if no rows are found, I think doing id IN (...) would allow it to match no rows.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Oh interesting. Let me try it out

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@coadler It does not seem to matter.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hmm, I thought this would've caused an issue when you compared a non-null field to null. Sounds good then!

Co-authored-by: Colin Adler <colin1adler@gmail.com>
@Emyrk Emyrk merged commit 01dd35f into main Aug 15, 2022
@Emyrk Emyrk deleted the stevenmasley/2135/roles_mig branch August 15, 2022 19:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants