feat: Add read-only collections (#1991)

closes #1017
This commit is contained in:
Tom Moor
2021-03-30 21:02:08 -07:00
committed by GitHub
parent d7acf616cf
commit 7e1b07ef98
50 changed files with 940 additions and 558 deletions

View File

@ -91,7 +91,7 @@ User.prototype.collectionIds = async function (options = {}) {
const collectionStubs = await Collection.scope({
method: ["withMembership", this.id],
}).findAll({
attributes: ["id", "private"],
attributes: ["id", "permission"],
where: { teamId: this.teamId },
paranoid: true,
...options,
@ -100,7 +100,8 @@ User.prototype.collectionIds = async function (options = {}) {
return collectionStubs
.filter(
(c) =>
!c.private ||
c.permission === "read" ||
c.permission === "read_write" ||
c.memberships.length > 0 ||
c.collectionGroupMemberships.length > 0
)