-
Notifications
You must be signed in to change notification settings - Fork 96
Authz API
The Authz API encompasses the logic required for ACLs, Roles, and Permissions for private content. It also takes on the notion of Group Membership, since permissions are propagated down a chain of group membership.
Source Code: https://github.com/sakaiproject/Hilary/blob/master/node_modules/oae-authz/lib/api.js
- A role can be assigned to a principal on a resource instance
- A role can be removed from a principal on a resource instance
- A role can be updated from a principal on a resource instance
- A role is an arbitrary string, defined by the consumer of the Authz API
- It should be possible to determine if a user has a particular role on a resource instance (hasRole)
- It should be possible to determine what role a user has on a resource instance (getRole)
- It should be possible to determine, given a type of resource (e.g., content, group...), what resource instances the user has any role (getRolesForResourceType)
- Use Case: Get me all the content to which I have access
- Use Case: Get me all the groups of which I am a member
- It should be possible to determine, given a type of resource (e.g., content, group...) and an array of principals, what resource instants all principals have on that resource type (getRolesForPrincipalsAndResourceType)
- Use Case: Get me all the groups of which my parent groups are a member
- A role cannot be assigned to a principal on a group resource instance. The group resource type is reserved to be interacted with solely through group membership functions (see Group Membership requirements below)
A dynamic column family that enumerates role association between a principal (row key; e.g., user, group) and some resource (column name; e.g., content, group).
Row Key: The row key is the principal UUID, which is scoped by "principal type", "tenant alias" and "principal id", respectively. Therefore, a principal UUID of: "u:cam:mrvisser" would represent a user from Cambridge with userid 'mrvisser'.
Column Name: The column name is the resource UUID, which is scoped by "resource type", "tenant alias" and "resource id", respectively. Therefore, a resource UUID of "c:cam:Foo.docx" represents a content item from Cambridge with resource id "Foo.docx"
Column Values: The value of each column is the principal's role on the resource.
Row Key (principal) | |||||
---|---|---|---|---|---|
u:cam:mrvisser | c:cam:Foo.docx | c:gat:Instructions.txt | g:cam:cheese-lovers | g:cam:my-group | g:gat:georgia-tech-global-network |
manager | viewer | member | administrator | member | |
u:cam:simong | c:cam:Foo.docx | g:cam: pizza-lovers | |||
viewer | member | ||||
g:cam:cheese-lovers | g:cam: pizza-lovers | c:gat:some-content | |||
member | viewer |
Use Case | Query |
---|---|
Given a principal, give me all of their group memberships (paged by 2) | `select first 2 'g:' .. '' from Roles where principal = ?` |
`select first 2 'g:gat:georgia-tech-global-network' .. '' from Roles where principal = ?` | |
Given a principal, give me all the content they have shared with them (paged by 2) | `select first 2 'c:' .. '' from Roles where principal = ?` |
Given a principal, give me all their group memberships for their tenant (paged by 2) | `select first 2 'g:cam:' .. '' from Roles where principal = ?` |
Given a principal, get their entire group membership ancestry |
```javascript
var memberships = "select 'g:' .. 'g:|' from Roles where principal = ?"
var indirectMemberships = "select 'g:' .. 'g:|' from Roles where principal in $memberships"
var newMemberships = indirectMemberships - memberships; memberships.addAll(indirectMemberships); while (!newMemberships.isEmpty()) { indirectMemberships = "select 'g:' .. 'g:|' from Roles where principal in $newMemberships" newMemberships = indirectMemberships - memberships; memberships.addAll(indirectMemberships); } return memberships;
|