keystone.common.controller.
V3Controller
[source]¶Bases: keystone.common.provider_api.ProviderAPIMixin
, keystone.common.wsgi.Application
Base controller class for Identity API v3.
Child classes should set the collection_name
and member_name
class
attributes, representing the collection of entities they are exposing to
the API. This is required for supporting self-referential links,
pagination, etc.
Class parameters:
build_driver_hints
(request, supported_filters)[source]¶Build list hints based on the context query string.
Parameters: |
|
---|
check_protection
(request, prep_info, target_attr=None)[source]¶Provide call protection for complex target attributes.
As well as including the standard parameters from the original API call (which is passed in prep_info), this call will add in any additional entities or attributes (passed in target_attr), so that they can be referenced by policy rules.
collection_name
= 'entities'¶filter_by_attributes
(refs, hints)[source]¶Filter a list of references by filter values.
filter_params
(ref)[source]¶Remove unspecified parameters from the dictionary.
This function removes unspecified parameters from the dictionary. This method checks only root-level keys from a ref dictionary.
Parameters: | ref – a dictionary representing deserialized response to be serialized |
---|
get_member_from_driver
= None¶limit
(refs, hints)[source]¶Limit a list of entities.
The underlying driver layer may have already truncated the collection for us, but in case it was unable to handle truncation we check here.
Parameters: |
|
---|---|
Returns: | boolean indicating whether the list was truncated, as well as the list of (truncated if necessary) entities. |
member_name
= 'entity'¶query_filter_is_true
(filter_value)[source]¶Determine if bool query param is ‘True’.
We treat this the same way as we do for policy enforcement:
{bool_param}=0 is treated as False
Any other value is considered to be equivalent to True, including the absence of a value
wrap_collection
(context, refs, hints=None)[source]¶Wrap a collection, checking for filtering and pagination.
Returns the wrapped collection, which includes: - Executing any filtering not already carried out - Truncate to a set limit if necessary - Adds ‘self’ links in every member - Adds ‘next’, ‘self’ and ‘prev’ links for the whole collection.
Parameters: |
|
---|
keystone.common.controller.
filterprotected
(*filters, **callback)[source]¶Wrap API list calls with role based access controls (RBAC).
This handles both the protection of the API parameters as well as any filters supplied.
More complex API list calls (for example that need to examine the contents of an entity referenced by one of the filters) should pass in a callback function, that will be subsequently called to check protection for these multiple entities. This callback function should gather the appropriate entities needed and then call check_protection() in the V3Controller class.
keystone.common.controller.
protected
(callback=None)[source]¶Wrap API calls with role based access controls (RBAC).
This handles both the protection of the API parameters as well as any target entities for single-entity API calls.
More complex API calls (for example that deal with several different entities) should pass in a callback function, that will be subsequently called to check protection for these multiple entities. This callback function should gather the appropriate entities needed and then call check_protection() in the V3Controller class.
Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.