I'm seeking guidance on configuring granular privileges in MarkLogic to allow updates to database configurations for a specific database only, excluding others.
For example, I have a user named 'custom-rest-admin' with the roles rest-writer, rest-admin, and manage-admin assigned for a specific REST API. The database in question is named MY_DATABASE_NAME. Using the following command, I successfully updated the database properties:
curl --anyauth --user custom-rest-admin:pass -X PUT -d@"./database-config.json" -i -H "Content-type: application/json" "http://localhost:8002/manage/v2/databases/MY_DATABASE_NAME/properties"
However, due to the broad scope of the manage-admin role, I found that I could also update properties for other databases, as demonstrated here:
curl --anyauth --user custom-rest-admin:pass -X PUT -d@"./database-config.json" -i -H "Content-type: application/json" "http://localhost:8002/manage/v2/databases/OTHER_DATABASE_NAME/properties"
I've reviewed the section on Granular Privileges in MarkLogic's documentation but haven't found specific guidance on this scenario: MarkLogic Granular Privileges.
Could someone provide instructions or code examples on how to achieve this level of granularity?
Instead of granting
manage-adminrole, can create an appropriate fine-grained privilege, assign it to some role, and then assign that role to the user.Find the ID of the MY_DATABASE_NAME database that you want to grant privileges for, and use it to grant a privilege with that ID.
For example, if the MY_DATABASE_NAME ID was 123456, then grant:
https://docs.marklogic.com/11.0/guide/security-guide/en/granular-privileges/categories-of-granularity/privileges-to-administer-a-specific-resource.html