Add ensureUserCanSendComment authorization middleware (#22959)

* Add ensureUserCanSendComment authorization middleware

* added tests

GitOrigin-RevId: d1f58bd6bc63275456e5280ccb8c99aaa02c4e5f
This commit is contained in:
Domagoj Kriskovic
2025-01-21 09:05:53 +00:00
committed by Copybot
parent e5a4a8606f
commit 741b65d0eb
4 changed files with 49 additions and 0 deletions
@@ -462,6 +462,15 @@ describe('AuthorizationManager', function () {
tokenReadAndWrite: true,
})
testPermission('canUserSendComment', {
siteAdmin: true,
owner: true,
readAndWrite: true,
review: true,
publicReadAndWrite: true,
tokenReadAndWrite: true,
})
testPermission('canUserWriteProjectContent', {
siteAdmin: true,
owner: true,
@@ -26,6 +26,7 @@ describe('AuthorizationMiddleware', function () {
canUserWriteProjectSettings: sinon.stub(),
canUserWriteProjectContent: sinon.stub(),
canUserResolveThread: sinon.stub(),
canUserSendComment: sinon.stub(),
canUserAdminProject: sinon.stub(),
canUserRenameProject: sinon.stub(),
canUserReviewProjectContent: sinon.stub(),
@@ -86,6 +87,10 @@ describe('AuthorizationMiddleware', function () {
)
})
describe('ensureUserCanSendComment', function () {
testMiddleware('ensureUserCanSendComment', 'canUserSendComment')
})
describe('ensureUserCanResolveThread', function () {
beforeEach(function () {
this.req.params.doc_id = this.doc_id