Browse Source

Update `removeUserFromProject` to account for token-access

Shane Kilkelly 9 years ago
parent
commit
16416463c6

+ 5 - 1
services/web/app/coffee/Features/Collaborators/CollaboratorsHandler.coffee

@@ -158,7 +158,11 @@ module.exports = CollaboratorsHandler =
 		logger.log user_id: user_id, project_id: project_id, "removing user"
 		conditions = _id:project_id
 		update = $pull:{}
-		update["$pull"] = collaberator_refs:user_id, readOnly_refs:user_id
+		update["$pull"] =
+			collaberator_refs:user_id,
+			readOnly_refs:user_id
+			tokenAccessReadOnly_refs:user_id
+			tokenAccessReadAndWrite_refs:user_id
 		Project.update conditions, update, (err)->
 			if err?
 				logger.error err: err, "problem removing user from project collaberators"

+ 4 - 1
services/web/test/UnitTests/coffee/Collaborators/CollaboratorsHandlerTests.coffee

@@ -223,7 +223,10 @@ describe "CollaboratorsHandler", ->
 				.calledWith({
 					_id: @project_id
 				}, {
-					"$pull":{collaberator_refs:@user_id, readOnly_refs:@user_id}
+					"$pull":{
+						collaberator_refs:@user_id, readOnly_refs:@user_id,
+						tokenAccessReadOnly_refs:@user_id, tokenAccessReadAndWrite_refs:@user_id
+					}
 				})
 				.should.equal true