feat: add salary privilege to privilege management system
Add support for the salary privilege in the privilege handler. Implement associated logic to process and validate the salary privilege in the test cases. Update the data structures to include the new privilege and ensure correct functionality in the privilege processing flow.
This commit is contained in:
+15
-1
@@ -236,6 +236,18 @@ func TestPrivilegeHandler_IsAllowed_Return_True_If_Privilege_Exists(t *testing.T
|
||||
})
|
||||
|
||||
assert.True(t, result)
|
||||
|
||||
_, _ = handler.Process(&PrivilegeAdded{
|
||||
Email: "jim@example.org",
|
||||
CompanyID: "abc-123",
|
||||
Privilege: PrivilegeSalary,
|
||||
}, goamqp.Headers{})
|
||||
|
||||
result = handler.IsAllowed("jim@example.org", "abc-123", func(privileges CompanyPrivileges) bool {
|
||||
return privileges.Salary
|
||||
})
|
||||
|
||||
assert.True(t, result)
|
||||
}
|
||||
|
||||
func TestPrivilegeHandler_Fetch_Error_Response(t *testing.T) {
|
||||
@@ -289,7 +301,8 @@ func TestPrivilegeHandler_Fetch_Valid(t *testing.T) {
|
||||
"time": true,
|
||||
"invoicing": true,
|
||||
"accounting": false,
|
||||
"supplier": false
|
||||
"supplier": false,
|
||||
"salary": true
|
||||
}
|
||||
}
|
||||
}`
|
||||
@@ -313,6 +326,7 @@ func TestPrivilegeHandler_Fetch_Valid(t *testing.T) {
|
||||
Invoicing: true,
|
||||
Accounting: false,
|
||||
Supplier: false,
|
||||
Salary: true,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user