mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Remove obsolete auth check
This commit is contained in:
parent
78f87c0ecf
commit
3181f624a7
2 changed files with 23 additions and 44 deletions
|
@ -154,9 +154,6 @@ module.exports = ProjectController =
|
||||||
projectEntitiesJson: (req, res, next) ->
|
projectEntitiesJson: (req, res, next) ->
|
||||||
user_id = AuthenticationController.getLoggedInUserId(req)
|
user_id = AuthenticationController.getLoggedInUserId(req)
|
||||||
project_id = req.params.Project_id
|
project_id = req.params.Project_id
|
||||||
AuthorizationManager.canUserReadProject user_id, project_id, null, (err, canRead) ->
|
|
||||||
return next(err) if err?
|
|
||||||
return res.sendStatus(403) if !canRead
|
|
||||||
ProjectGetter.getProject project_id, (err, project) ->
|
ProjectGetter.getProject project_id, (err, project) ->
|
||||||
return next(err) if err?
|
return next(err) if err?
|
||||||
ProjectEntityHandler.getAllEntitiesFromProject project, (err, docs, files) ->
|
ProjectEntityHandler.getAllEntitiesFromProject project, (err, docs, files) ->
|
||||||
|
|
|
@ -562,10 +562,6 @@ describe "ProjectController", ->
|
||||||
@ProjectGetter.getProject = sinon.stub().callsArgWith(1, null, @project)
|
@ProjectGetter.getProject = sinon.stub().callsArgWith(1, null, @project)
|
||||||
@ProjectEntityHandler.getAllEntitiesFromProject = sinon.stub().callsArgWith(1, null, @docs, @files)
|
@ProjectEntityHandler.getAllEntitiesFromProject = sinon.stub().callsArgWith(1, null, @docs, @files)
|
||||||
|
|
||||||
describe 'when the user can access the project', ->
|
|
||||||
beforeEach () ->
|
|
||||||
@AuthorizationManager.canUserReadProject = sinon.stub().callsArgWith(3, null, true)
|
|
||||||
|
|
||||||
it 'should produce a list of entities', (done) ->
|
it 'should produce a list of entities', (done) ->
|
||||||
@res.json = (data) =>
|
@res.json = (data) =>
|
||||||
expect(data).to.deep.equal {
|
expect(data).to.deep.equal {
|
||||||
|
@ -581,20 +577,6 @@ describe "ProjectController", ->
|
||||||
done()
|
done()
|
||||||
@ProjectController.projectEntitiesJson @req, @res, @next
|
@ProjectController.projectEntitiesJson @req, @res, @next
|
||||||
|
|
||||||
describe 'when the user cannot access the project', ->
|
|
||||||
beforeEach () ->
|
|
||||||
@AuthorizationManager.canUserReadProject = sinon.stub().callsArgWith(3, null, false)
|
|
||||||
|
|
||||||
it 'should send a 403 response', (done) ->
|
|
||||||
@res.json = sinon.stub()
|
|
||||||
@res.sendStatus = (code) =>
|
|
||||||
expect(code).to.equal 403
|
|
||||||
expect(@ProjectGetter.getProject.callCount).to.equal 0
|
|
||||||
expect(@ProjectEntityHandler.getAllEntitiesFromProject.callCount).to.equal 0
|
|
||||||
expect(@res.json.callCount).to.equal 0
|
|
||||||
done()
|
|
||||||
@ProjectController.projectEntitiesJson @req, @res, @next
|
|
||||||
|
|
||||||
describe '_isInPercentageRollout', ->
|
describe '_isInPercentageRollout', ->
|
||||||
before ->
|
before ->
|
||||||
@ids = [
|
@ids = [
|
||||||
|
|
Loading…
Reference in a new issue