Introduction
Once we have made a functional first implementation of our database management system RBAC #3375, we will proceed to make the endpoints for the administration of this.
Endpoints definition
We must make the following endpoints in order to cover the functionalities as indicated in #3287 :
Roles and policies management
Customizing RBAC must be as simple as possible, so a catalog of new API endpoints will be provided to operate the CRUD cycle of roles and policies:
- PUT /security/role: creates a new role given a name, a rule and optionally the ids of policies related to it.
- GET /security/roles: lists all existing roles and their details.
- GET /security/role/:role_id: gets the full definition of a role given its id (including policies related to it)
- POST /security/role/:role_id: updates an existing role. It allows changing the rule, name or relating policies.
- DELETE /security/role/:role_id: deletes an existing role. It should also remove all the relationships to any policies.
- PUT /security/policy: creates a new policy given a name and a definition.
- GET /security/policies: lists all existing policies and their details.
- GET /security/policy/:policy_id: gets the full definition of a policy given its id (including name and definition)
- POST /security/policy/:policy_id: updates an existing policy given its id.
- DELETE /security/policy/:policy_id: deletes an existing policy. It should also remove all
the relationships to any roles.
- POST /security/role/:role_id/policy/:policy_id: attaches a role and a policy.
- DELETE /security/role/:role_id/policy/:policy_id: detaches a role and a policy.
Pending
- [x] PUT /security/role
- [x] GET /security/roles
- [x] GET /security/role/:role_id
- [x] POST /security/role/:role_id
- [x] DELETE /security/role/:role_id
- [x] PUT /security/policy
- [x] GET /security/policies
- [x] GET /security/policy/:policy_id
- [x] POST /security/policy/:policy_id
- [x] DELETE /security/policy/:policy_id
- [x] POST /security/role/:role_id/policy/:policy_id
- [x] DELETE /security/role/:role_id/policy/:policy_id
该提问来源于开源项目:wazuh/wazuh