This commit is contained in:
Shane Kilkelly 2017-10-06 16:10:33 +01:00
parent b5bed1837e
commit d386f79a76

View file

@ -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) ->) ->