[real-time] make sure reviewer has permissions to read a project (#22317)

* added "review" in assertClientCanViewProject

* test if reviewer can read project

GitOrigin-RevId: 92a30f8b456bec9f0fc81a1361e454eecff838bd
This commit is contained in:
Domagoj Kriskovic
2024-12-09 17:42:55 +01:00
committed by Copybot
parent 79e854009e
commit 780acfdeb4
2 changed files with 12 additions and 1 deletions

View File

@@ -5,7 +5,7 @@ module.exports = AuthorizationManager = {
assertClientCanViewProject(client, callback) {
AuthorizationManager._assertClientHasPrivilegeLevel(
client,
['readOnly', 'readAndWrite', 'owner'],
['readOnly', 'readAndWrite', 'review', 'owner'],
callback
)
},

View File

@@ -47,6 +47,17 @@ describe('AuthorizationManager', function () {
)
})
it('should allow the review privilegeLevel', function (done) {
this.client.ol_context.privilege_level = 'review'
return this.AuthorizationManager.assertClientCanViewProject(
this.client,
error => {
expect(error).to.be.null
return done()
}
)
})
it('should allow the owner privilegeLevel', function (done) {
this.client.ol_context.privilege_level = 'owner'
return this.AuthorizationManager.assertClientCanViewProject(