chore: Serialize domain policies on team (#1970)
* domain policies exposed on team, consistency * fix: Remove usage of isAdmin in frontend * test
This commit is contained in:
@@ -53,7 +53,7 @@ router.post("collections.create", auth(), async (ctx) => {
|
||||
}
|
||||
|
||||
const user = ctx.state.user;
|
||||
authorize(user, "create", Collection);
|
||||
authorize(user, "createCollection", user.team);
|
||||
|
||||
const collections = await Collection.findAll({
|
||||
where: { teamId: user.teamId, deletedAt: null },
|
||||
@@ -139,7 +139,7 @@ router.post("collections.import", auth(), async (ctx) => {
|
||||
ctx.assertUuid(attachmentId, "attachmentId is required");
|
||||
|
||||
const user = ctx.state.user;
|
||||
authorize(user, "import", Collection);
|
||||
authorize(user, "importCollection", user.team);
|
||||
|
||||
const attachment = await Attachment.findByPk(attachmentId);
|
||||
authorize(user, "read", attachment);
|
||||
|
||||
Reference in New Issue
Block a user