mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Merge pull request #1996 from overleaf/spd-soft-deletion-admin-panel-improvements
Improve display of soft-deleted things in admin panel GitOrigin-RevId: 8413103fb750749bb27c69ccb6ff34c4ef62d402
This commit is contained in:
parent
d7bee9a7d8
commit
2243f42f9b
1 changed files with 70 additions and 35 deletions
|
@ -43,59 +43,75 @@ module.exports = CollaboratorsHandler = {
|
||||||
tokenAccessReadAndWrite_refs: 1,
|
tokenAccessReadAndWrite_refs: 1,
|
||||||
publicAccesLevel: 1
|
publicAccesLevel: 1
|
||||||
}
|
}
|
||||||
return ProjectGetter.getProject(project_id, projection, function(
|
ProjectGetter.getProject(project_id, projection, (error, project) => {
|
||||||
error,
|
if (error) {
|
||||||
project
|
|
||||||
) {
|
|
||||||
let member_id
|
|
||||||
if (error != null) {
|
|
||||||
return callback(error)
|
return callback(error)
|
||||||
}
|
}
|
||||||
if (project == null) {
|
if (!project) {
|
||||||
return callback(
|
return callback(
|
||||||
new Errors.NotFoundError(`no project found with id ${project_id}`)
|
new Errors.NotFoundError(`no project found with id ${project_id}`)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
const members = []
|
callback(
|
||||||
|
null,
|
||||||
|
CollaboratorsHandler.getMemberIdsWithPrivilegeLevelsFromFields(
|
||||||
|
project.owner_ref,
|
||||||
|
project.collaberator_refs,
|
||||||
|
project.readOnly_refs,
|
||||||
|
project.tokenAccessReadAndWrite_refs,
|
||||||
|
project.tokenAccessReadOnly_refs,
|
||||||
|
project.publicAccesLevel
|
||||||
|
)
|
||||||
|
)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
getMemberIdsWithPrivilegeLevelsFromFields(
|
||||||
|
ownerId,
|
||||||
|
collaboratorIds,
|
||||||
|
readOnlyIds,
|
||||||
|
tokenAccessIds,
|
||||||
|
tokenAccessReadOnlyIds,
|
||||||
|
publicAccessLevel
|
||||||
|
) {
|
||||||
|
let member_id
|
||||||
|
const members = []
|
||||||
|
members.push({
|
||||||
|
id: ownerId.toString(),
|
||||||
|
privilegeLevel: PrivilegeLevels.OWNER,
|
||||||
|
source: Sources.OWNER
|
||||||
|
})
|
||||||
|
for (member_id of Array.from(collaboratorIds || [])) {
|
||||||
members.push({
|
members.push({
|
||||||
id: project.owner_ref.toString(),
|
id: member_id.toString(),
|
||||||
privilegeLevel: PrivilegeLevels.OWNER,
|
privilegeLevel: PrivilegeLevels.READ_AND_WRITE,
|
||||||
source: Sources.OWNER
|
source: Sources.INVITE
|
||||||
})
|
})
|
||||||
for (member_id of Array.from(project.collaberator_refs || [])) {
|
}
|
||||||
|
for (member_id of Array.from(readOnlyIds || [])) {
|
||||||
|
members.push({
|
||||||
|
id: member_id.toString(),
|
||||||
|
privilegeLevel: PrivilegeLevels.READ_ONLY,
|
||||||
|
source: Sources.INVITE
|
||||||
|
})
|
||||||
|
}
|
||||||
|
if (publicAccessLevel === PublicAccessLevels.TOKEN_BASED) {
|
||||||
|
for (member_id of Array.from(tokenAccessIds || [])) {
|
||||||
members.push({
|
members.push({
|
||||||
id: member_id.toString(),
|
id: member_id.toString(),
|
||||||
privilegeLevel: PrivilegeLevels.READ_AND_WRITE,
|
privilegeLevel: PrivilegeLevels.READ_AND_WRITE,
|
||||||
source: Sources.INVITE
|
source: Sources.TOKEN
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
for (member_id of Array.from(project.readOnly_refs || [])) {
|
for (member_id of Array.from(tokenAccessReadOnlyIds || [])) {
|
||||||
members.push({
|
members.push({
|
||||||
id: member_id.toString(),
|
id: member_id.toString(),
|
||||||
privilegeLevel: PrivilegeLevels.READ_ONLY,
|
privilegeLevel: PrivilegeLevels.READ_ONLY,
|
||||||
source: Sources.INVITE
|
source: Sources.TOKEN
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
if (project.publicAccesLevel === PublicAccessLevels.TOKEN_BASED) {
|
}
|
||||||
for (member_id of Array.from(
|
return members
|
||||||
project.tokenAccessReadAndWrite_refs || []
|
|
||||||
)) {
|
|
||||||
members.push({
|
|
||||||
id: member_id.toString(),
|
|
||||||
privilegeLevel: PrivilegeLevels.READ_AND_WRITE,
|
|
||||||
source: Sources.TOKEN
|
|
||||||
})
|
|
||||||
}
|
|
||||||
for (member_id of Array.from(project.tokenAccessReadOnly_refs || [])) {
|
|
||||||
members.push({
|
|
||||||
id: member_id.toString(),
|
|
||||||
privilegeLevel: PrivilegeLevels.READ_ONLY,
|
|
||||||
source: Sources.TOKEN
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return callback(null, members)
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
|
|
||||||
getMemberIds(project_id, callback) {
|
getMemberIds(project_id, callback) {
|
||||||
|
@ -211,6 +227,25 @@ module.exports = CollaboratorsHandler = {
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
|
|
||||||
|
getInvitedMembersWithPrivilegeLevelsFromFields(
|
||||||
|
ownerId,
|
||||||
|
collaboratorIds,
|
||||||
|
readOnlyIds,
|
||||||
|
callback
|
||||||
|
) {
|
||||||
|
let members = CollaboratorsHandler.getMemberIdsWithPrivilegeLevelsFromFields(
|
||||||
|
ownerId,
|
||||||
|
collaboratorIds,
|
||||||
|
readOnlyIds,
|
||||||
|
[],
|
||||||
|
[],
|
||||||
|
null
|
||||||
|
)
|
||||||
|
return CollaboratorsHandler._loadMembers(members, (error, users) =>
|
||||||
|
callback(error, users)
|
||||||
|
)
|
||||||
|
},
|
||||||
|
|
||||||
getTokenMembersWithPrivilegeLevels(project_id, callback) {
|
getTokenMembersWithPrivilegeLevels(project_id, callback) {
|
||||||
if (callback == null) {
|
if (callback == null) {
|
||||||
callback = function(error, members) {}
|
callback = function(error, members) {}
|
||||||
|
|
Loading…
Reference in a new issue