Currently the rbac and entitlements mock return a pre-canned response no matter what user makes the incoming request.
Modify the code so that:
A user can be created with specific entitlements/rbac permissions (i.e., a user's JSON stored in our tinydb should now have entitlements -- a list of entitlements for this user, and permissions -- a list of permissions for this user
The rbac and entitlements APIs should analyze the x-rh-identity header that comes in on API requests, extract the username and account_number, query our tinydb to find the matching user, and return the entitlements/permissions assigned to them.
There should also be default entitlements/permissions applied to each user if you did not specify them as there are now. These could be defined in config.py. If a user does NOT exist in the tinyDB, we should probably by default return a 404 or 401 or whatever rbac/entitlements would normally return for an "invalid" identity. However, we can also provide a config option that allows the default permissions/entitlements to be returned even in cases where the user does not exist in our tinydb.
Currently the rbac and entitlements mock return a pre-canned response no matter what user makes the incoming request.
Modify the code so that:
entitlements
-- a list of entitlements for this user, andpermissions
-- a list of permissions for this userx-rh-identity
header that comes in on API requests, extract theusername
andaccount_number
, query our tinydb to find the matching user, and return the entitlements/permissions assigned to them.There should also be default entitlements/permissions applied to each user if you did not specify them as there are now. These could be defined in
config.py
. If a user does NOT exist in the tinyDB, we should probably by default return a404
or401
or whatever rbac/entitlements would normally return for an "invalid" identity. However, we can also provide a config option that allows the default permissions/entitlements to be returned even in cases where the user does not exist in our tinydb.