Update
Update an existing role.
Parameters
ctx
- The context of the request.
roleKey
- The Key of the role. This can also be the role id.
roleUpdate
- An object that contains the information about the new role. The payload is defined below.
Payload
Name
- optional - The name of the role.
Description
- optional - Description string explaining what this role represents, or what permissions are granted to it.
Permissions
- optional - List of action keys that define what actions this resource role is permitted to do.
Extends
- optional - List of role keys that define what roles this role extends. In other words: this role will automatically inherit all the permissions of the given roles in this list.
roleUpdate := models.NewRoleUpdate()
roleUpdate.SetPermissions([]string{"resource-key:read", "resource-key:write"})
Implementation
role, err := Permit.Api.Roles.Create(ctx, "role-key", *roleUpdate)