|
|
@@ -814,7 +814,7 @@ describe('ProjectController', function() {
|
|
|
return this.ProjectController.loadEditor(this.req, this.res)
|
|
|
})
|
|
|
|
|
|
- it('should set isRestrictedTokenMember to true under the right conditions', function(done) {
|
|
|
+ it('should set isRestrictedTokenMember to true when the user is accessing project via read-only token', function(done) {
|
|
|
this.CollaboratorsHandler.userIsTokenMember.callsArgWith(2, null, true)
|
|
|
this.AuthorizationManager.getPrivilegeLevelForProject.callsArgWith(
|
|
|
3,
|
|
|
@@ -829,6 +829,21 @@ describe('ProjectController', function() {
|
|
|
return this.ProjectController.loadEditor(this.req, this.res)
|
|
|
})
|
|
|
|
|
|
+ it('should set isRestrictedTokenMember to true when anonymous read-only token access', function(done) {
|
|
|
+ this.CollaboratorsHandler.userIsTokenMember.callsArgWith(2, null, null)
|
|
|
+ this.AuthenticationController.isUserLoggedIn = sinon.stub().returns(false)
|
|
|
+ this.AuthorizationManager.getPrivilegeLevelForProject.callsArgWith(
|
|
|
+ 3,
|
|
|
+ null,
|
|
|
+ 'readOnly'
|
|
|
+ )
|
|
|
+ this.res.render = (pageName, opts) => {
|
|
|
+ opts.isRestrictedTokenMember.should.exist
|
|
|
+ opts.isRestrictedTokenMember.should.equal(true)
|
|
|
+ return done()
|
|
|
+ }
|
|
|
+ return this.ProjectController.loadEditor(this.req, this.res)
|
|
|
+ })
|
|
|
it('should render the closed page if the editor is closed', function(done) {
|
|
|
this.settings.editorIsOpen = false
|
|
|
this.res.render = (pageName, opts) => {
|