mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-06-01 13:21:37 +02:00
[web] Log messages to the project audit log and do so for enabling/disabling sharing (#10281)
GitOrigin-RevId: d6af26bcbafb4d1789fca6319fd343fe8c2ecd25
This commit is contained in:
committed by
Copybot
parent
1ad8a99887
commit
c9cf530e36
@@ -144,6 +144,9 @@ describe('ProjectController', function () {
|
||||
this.SurveyHandler = {
|
||||
getSurvey: sinon.stub().yields(null, {}),
|
||||
}
|
||||
this.ProjectAuditLogHandler = {
|
||||
addEntry: sinon.stub().yields(),
|
||||
}
|
||||
|
||||
this.ProjectController = SandboxedModule.require(MODULE_PATH, {
|
||||
requires: {
|
||||
@@ -190,6 +193,7 @@ describe('ProjectController', function () {
|
||||
},
|
||||
'../Institutions/InstitutionsFeatures': this.InstitutionsFeatures,
|
||||
'../Survey/SurveyHandler': this.SurveyHandler,
|
||||
'./ProjectAuditLogHandler': this.ProjectAuditLogHandler,
|
||||
},
|
||||
})
|
||||
|
||||
@@ -293,17 +297,34 @@ describe('ProjectController', function () {
|
||||
it('should update the public access level', function (done) {
|
||||
this.EditorController.setPublicAccessLevel = sinon.stub().callsArg(2)
|
||||
this.req.body = {
|
||||
publicAccessLevel: (this.publicAccessLevel = 'readonly'),
|
||||
publicAccessLevel: 'readOnly',
|
||||
}
|
||||
this.res.sendStatus = code => {
|
||||
this.EditorController.setPublicAccessLevel
|
||||
.calledWith(this.project_id, this.publicAccessLevel)
|
||||
.calledWith(this.project_id, 'readOnly')
|
||||
.should.equal(true)
|
||||
code.should.equal(204)
|
||||
done()
|
||||
}
|
||||
this.ProjectController.updateProjectAdminSettings(this.req, this.res)
|
||||
})
|
||||
|
||||
it('should record the change in the project audit log', function (done) {
|
||||
this.EditorController.setPublicAccessLevel = sinon.stub().callsArg(2)
|
||||
this.req.body = {
|
||||
publicAccessLevel: 'readOnly',
|
||||
}
|
||||
this.res.sendStatus = code => {
|
||||
this.ProjectAuditLogHandler.addEntry
|
||||
.calledWith(this.project_id, 'toggle-access-level', this.user._id, {
|
||||
publicAccessLevel: 'readOnly',
|
||||
status: 'OK',
|
||||
})
|
||||
.should.equal(true)
|
||||
done()
|
||||
}
|
||||
this.ProjectController.updateProjectAdminSettings(this.req, this.res)
|
||||
})
|
||||
})
|
||||
|
||||
describe('deleteProject', function () {
|
||||
|
||||
Reference in New Issue
Block a user