Organizations
Update organization's authorization policy
Update organization's authorization policy
put/orgs/{orgName}/authorization-policy
Request
- Base URLhttps://artifacthub.io/api/v1
- AuthAPI key in header X-API-KEY-ID and API key in header X-API-KEY-SECRET
- TypeScriptA function with typed inputs. Its response is checked against the schema.
Path parameters
orgNamestring required
Example:org1
Organization name
Request body
Example request
{
"predefined_policy": "rbac.v1",
"custom_policy": "package artifacthub.authz\n\n# By default, deny requests\ndefault allow = false\n\n# Allow the action if the user is allowed to perform it\nallow {\n # If user's role is owner\n data.roles.owner.users[_] == input.user\n}\nallow {\n # If user's role is allowed to perform this action\n allowed_actions[_] == input.action\n}\n\n# Get user allowed actions\nallowed_actions[action] {\n user_roles[_] == \"owner\"\n action := \"all\"\n}\nallowed_actions[action] {\n action := data.roles[role].allowed_actions[_]\n user_roles[_] == role\n}\n\n# Get user roles\nuser_roles[role] {\n data.roles[role].users[_] == input.user\n}\n",
"policy_data": "{\n \"roles\": {\n \"owner\": {\n \"users\": [\"user1\"]\n },\n \"customRole1\": {\n \"users\": [\"member1\", \"member2\"],\n \"allowed_actions\": [\"addOrganizationMember\", \"addOrganizationRepository\"]\n }\n }\n}\n"
}Response
The request has succeeded, no content returned
Changes
No recorded changes to this operation across all 1 revision of this API.