mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Fix how adding user to project works in acceptance tests
This commit is contained in:
parent
863d327743
commit
7dc759482c
2 changed files with 10 additions and 10 deletions
|
@ -213,9 +213,9 @@ describe "Authorization", ->
|
|||
@owner.createProject "private-project", (error, project_id) =>
|
||||
return done(error) if error?
|
||||
@project_id = project_id
|
||||
@owner.addUserToProject @project_id, @ro_user.email, "readOnly", (error) =>
|
||||
@owner.addUserToProject @project_id, @ro_user, "readOnly", (error) =>
|
||||
return done(error) if error?
|
||||
@owner.addUserToProject @project_id, @rw_user.email, "readAndWrite", (error) =>
|
||||
@owner.addUserToProject @project_id, @rw_user, "readAndWrite", (error) =>
|
||||
return done(error) if error?
|
||||
done()
|
||||
|
||||
|
@ -303,4 +303,4 @@ describe "Authorization", ->
|
|||
expect_no_settings_write_access @anon, @project_id, redirect_to: "/restricted", done
|
||||
|
||||
it "should not allow an anonymous user admin access to it", (done) ->
|
||||
expect_no_admin_access @anon, @project_id, redirect_to: "/restricted", done
|
||||
expect_no_admin_access @anon, @project_id, redirect_to: "/restricted", done
|
||||
|
|
|
@ -121,13 +121,13 @@ class User
|
|||
return callback(err)
|
||||
callback(null)
|
||||
|
||||
addUserToProject: (project_id, email, privileges, callback = (error, user) ->) ->
|
||||
@request.post {
|
||||
url: "/project/#{project_id}/users",
|
||||
json: {email, privileges}
|
||||
}, (error, response, body) ->
|
||||
return callback(error) if error?
|
||||
callback(null, body.user)
|
||||
addUserToProject: (project_id, user, privileges, callback = (error, user) ->) ->
|
||||
if privileges == 'readAndWrite'
|
||||
updateOp = {$addToSet: {collaberator_refs: user._id.toString()}}
|
||||
else if privileges == 'readOnly'
|
||||
updateOp = {$addToSet: {readOnly_refs: user._id.toString()}}
|
||||
db.projects.update {_id: db.ObjectId(project_id)}, updateOp, (err) ->
|
||||
callback(err)
|
||||
|
||||
makePublic: (project_id, level, callback = (error) ->) ->
|
||||
@request.post {
|
||||
|
|
Loading…
Reference in a new issue