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(error) if error?
return callback new Errors.NotFoundError("no project found with id #{project_id}") if !project? return callback new Errors.NotFoundError("no project found with id #{project_id}") if !project?
members = [] members = []
members.push { id: project.owner_ref.toString(), privilegeLevel: PrivilegeLevels.OWNER, source: Sources.OWNER } members.push {
# read-and-write id: project.owner_ref.toString(),
privilegeLevel: PrivilegeLevels.OWNER,
source: Sources.OWNER
}
for member_id in project.collaberator_refs or [] 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 if project.publicAccesLevel == PublicAccessLevels.TOKEN_BASED
for member_id in project.tokenAccessReadAndWrite_refs or [] for member_id in project.tokenAccessReadAndWrite_refs or []
members.push { id: member_id.toString(), privilegeLevel: PrivilegeLevels.READ_AND_WRITE, source: Sources.TOKEN } members.push {
# read-only id: member_id.toString(),
for member_id in project.readOnly_refs or [] privilegeLevel: PrivilegeLevels.READ_AND_WRITE,
members.push { id: member_id.toString(), privilegeLevel: PrivilegeLevels.READ_ONLY, source: Sources.INVITE } source: Sources.TOKEN
if project.publicAccesLevel == PublicAccessLevels.TOKEN_BASED }
for member_id in project.tokenAccessReadOnly_refs or [] 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 return callback null, members
getMemberIds: (project_id, callback = (error, member_ids) ->) -> getMemberIds: (project_id, callback = (error, member_ids) ->) ->