mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
Clean up
This commit is contained in:
parent
b5bed1837e
commit
d386f79a76
1 changed files with 26 additions and 9 deletions
|
@ -30,19 +30,36 @@ module.exports = CollaboratorsHandler =
|
|||
return callback(error) if error?
|
||||
return callback new Errors.NotFoundError("no project found with id #{project_id}") if !project?
|
||||
members = []
|
||||
members.push { id: project.owner_ref.toString(), privilegeLevel: PrivilegeLevels.OWNER, source: Sources.OWNER }
|
||||
# read-and-write
|
||||
members.push {
|
||||
id: project.owner_ref.toString(),
|
||||
privilegeLevel: PrivilegeLevels.OWNER,
|
||||
source: Sources.OWNER
|
||||
}
|
||||
for member_id in project.collaberator_refs or []
|
||||
members.push { id: member_id.toString(), privilegeLevel: PrivilegeLevels.READ_AND_WRITE, source: Sources.INVITE }
|
||||
members.push {
|
||||
id: member_id.toString(),
|
||||
privilegeLevel: PrivilegeLevels.READ_AND_WRITE,
|
||||
source: Sources.INVITE
|
||||
}
|
||||
for member_id in project.readOnly_refs or []
|
||||
members.push {
|
||||
id: member_id.toString(),
|
||||
privilegeLevel: PrivilegeLevels.READ_ONLY,
|
||||
source: Sources.INVITE
|
||||
}
|
||||
if project.publicAccesLevel == PublicAccessLevels.TOKEN_BASED
|
||||
for member_id in project.tokenAccessReadAndWrite_refs or []
|
||||
members.push { id: member_id.toString(), privilegeLevel: PrivilegeLevels.READ_AND_WRITE, source: Sources.TOKEN }
|
||||
# read-only
|
||||
for member_id in project.readOnly_refs or []
|
||||
members.push { id: member_id.toString(), privilegeLevel: PrivilegeLevels.READ_ONLY, source: Sources.INVITE }
|
||||
if project.publicAccesLevel == PublicAccessLevels.TOKEN_BASED
|
||||
members.push {
|
||||
id: member_id.toString(),
|
||||
privilegeLevel: PrivilegeLevels.READ_AND_WRITE,
|
||||
source: Sources.TOKEN
|
||||
}
|
||||
for member_id in project.tokenAccessReadOnly_refs or []
|
||||
members.push { id: member_id.toString(), privilegeLevel: PrivilegeLevels.READ_ONLY, source: Sources.TOKEN }
|
||||
members.push {
|
||||
id: member_id.toString(),
|
||||
privilegeLevel: PrivilegeLevels.READ_ONLY,
|
||||
source: Sources.TOKEN
|
||||
}
|
||||
return callback null, members
|
||||
|
||||
getMemberIds: (project_id, callback = (error, member_ids) ->) ->
|
||||
|
|
Loading…
Reference in a new issue