API policies
Policies for resources determine what actions can be taken on the resource, what attributes can be read, and which attributes can be written.
Define your policy by creating a file api/policies/SwordPolicy
:
API actions
There are 5 actions you can permit:
- Create:
operations.CREATE
akaSwordResource.create
method - Delete:
operations.DELETE
akaSwordResource().delete
method - Detail:
operations.DETAIL
akaSwordResource.member
method - List:
operations.LIST
akaSwordResource.collection
method - Update:
operations.UPDATE
akaSwordResource().update
method
API scopes
There are 2 scopes you can permit:
- Private:
OauthScope.CLIENT_PRIVATE
; user must be logged in to have access - Public:
OauthScope.CLIENT_PUBLIC
; user must be logged out to have access
Permit CRUD actions
Define which actions a user can perform:
If you want to permit certain actions for a user only if a condition is met, do the following:
Permit query parameters
Define which URL query parameters a user is allowed to use:
If you want to permit a different query parameter for a specific action, do the following:
You can also add a condition to these permissions:
Permit read attributes
Define which attributes of the resource the current user can read:
Permit write attributes
Define which attributes of the resource the current user can write to when creating a new resource or updating an existing resource:
Was this page helpful?