example.controllers.grant¶
grant controller
created 27-may-2019 by richb@instantlinux.net
Classes
|
Role-based access control |
|
Controller base class |
|
Account usage limits |
-
class
example.controllers.grant.
GrantController
¶ -
static
create
(body)¶ Controller for POST endpoints. This method assigns a new object ID, sets the _created_ timestamp, evaluates user’s permissions, adds a default category_id if the model has this attribute, and inserts a row to the back-end database.
- Parameters
body (dict) – resource fields as defined by openapi.yaml schema
id_prefix (str) – generated objects will be assigned a random 10- to 16-character ID; you can set a unique prefix if desired
- Returns
first element is a dict with the id, second element is response code (201 on success)
- Return type
tuple
-
static
find
(**kwargs)¶ Find records which match query parameters passed from connexion by name, in a dictionary that also includes user and token info
- Parameters
cursor_next (str) – pagination token to fetch subsequent records
filter (dict) – field/value pairs to query (simple queries only, with string or list matching; or * for any)
limit (int) – max records to fetch
offset (int) – old-style pagination starting offset
sort (str) – <field>[:{asc|desc}]
status (str) – value is added to filter
- Returns
items (list), count(int), cursor_next (str)
- Return type
dict
-
static
update
(id, body)¶ Controller for PUT endpoints. This method looks for an existing record, evaluates user’s permissions, and updates the row in the back-end database.
- Parameters
body (dict) – fields to be updated
access (str) – access-level required for RBAC evaluation
- Returns
first element is a dict with the id, second element is response code (200 on success)
- Return type
dict
-
static