-
-
Notifications
You must be signed in to change notification settings - Fork 440
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(schemas): add new scope read:member to both tenant admin and mem…
…ber roles (#5582)
- Loading branch information
1 parent
a279fb4
commit 7e33eae
Showing
2 changed files
with
34 additions
and
1 deletion.
There are no files selected for viewing
25 changes: 25 additions & 0 deletions
25
packages/schemas/alterations/next-1711624564-add-read-member-scope-to-tenant-roles.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { sql } from '@silverhand/slonik'; | ||
|
||
import type { AlterationScript } from '../lib/types/alteration.js'; | ||
|
||
const alteration: AlterationScript = { | ||
up: async (pool) => { | ||
await pool.query(sql` | ||
insert into organization_scopes (tenant_id, id, name, description) | ||
values ('admin', 'read-member', 'read:member', 'Read members of the tenant.'); | ||
insert into organization_role_scope_relations (tenant_id, organization_role_id, organization_scope_id) | ||
values ('admin', 'admin', 'read-member'), | ||
('admin', 'member', 'read-member'); | ||
`); | ||
}, | ||
down: async (pool) => { | ||
await pool.query(sql` | ||
delete from organization_role_scope_relations | ||
where tenant_id = 'admin' and organization_scope_id = 'read-member'; | ||
delete from organization_scopes | ||
where tenant_id = 'admin' and id = 'read-member'; | ||
`); | ||
}, | ||
}; | ||
|
||
export default alteration; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters