The nova.context Module

RequestContext: context for requests that persist through all of nova.

class RequestContext(user_id=None, project_id=None, is_admin=None, read_deleted='no', roles=None, remote_address=None, timestamp=None, request_id=None, auth_token=None, overwrite=True, quota_class=None, user_name=None, project_name=None, service_catalog=None, instance_lock_checked=False, user_auth_plugin=None, **kwargs)

Bases: oslo_context.context.RequestContext

Security context and request information.

Represents the user taking a given action within the system.

connection
elevated(read_deleted=None)

Return a version of this context with admin flag set.

classmethod from_dict(values)
get_auth_plugin()
read_deleted
session
to_dict()
transaction
transaction_ctx
authorize_project_context(context, project_id)

Ensures a request has permission to access the given project.

authorize_quota_class_context(context, class_name)

Ensures a request has permission to access the given quota class.

authorize_user_context(context, user_id)

Ensures a request has permission to access the given user.

get_admin_context(read_deleted='no')
is_user_context(context)

Indicates if the request context is a normal user.

require_admin_context(ctxt)

Raise exception.AdminRequired() if context is not an admin context.

require_context(ctxt)

Raise exception.Forbidden() if context is not a user or an admin context.

target_cell(*args, **kwds)

Adds database connection information to the context for communicating with the given target cell.

Parameters:
  • context – The RequestContext to add database connection information
  • cell_mapping – A objects.CellMapping object

Previous topic

The nova.consoleauth.rpcapi Module

Next topic

The nova.crypto Module

Project Source

This Page