fix: Single share record per document (#1984)
This commit is contained in:
@ -5,8 +5,14 @@ import policy from "./policy";
|
||||
|
||||
const { allow } = policy;
|
||||
|
||||
allow(User, ["read"], Share, (user, share) => user.teamId === share.teamId);
|
||||
allow(User, ["update", "revoke"], Share, (user, share) => {
|
||||
allow(
|
||||
User,
|
||||
["read", "update"],
|
||||
Share,
|
||||
(user, share) => user.teamId === share.teamId
|
||||
);
|
||||
|
||||
allow(User, "revoke", Share, (user, share) => {
|
||||
if (!share || user.teamId !== share.teamId) return false;
|
||||
if (user.id === share.userId) return true;
|
||||
if (user.isAdmin) return true;
|
||||
|
Reference in New Issue
Block a user