glance.context module

class glance.context.RequestContext(service_catalog=None, policy_enforcer=None, **kwargs)[source]

Bases: RequestContext

Stores information about the security context.

Stores how the user accesses the system, as well as additional request information.

property can_see_deleted

Admins can see deleted by default

elevated()[source]

Return a copy of this context with admin flag set.

classmethod from_dict(values)[source]

Construct a context object from a provided dictionary.

property owner

Return the owner to correlate with an image.

to_dict()[source]

Return a dictionary of context attributes.

glance.context.get_admin_context(show_deleted=False)[source]

Create an administrator context.

glance.context.get_ksa_client(context)[source]

Returns a keystoneauth Adapter using token from context.

This will return a simple keystoneauth adapter that can be used to make requests against a remote service using the token provided (and already authenticated) from the user and stored in a RequestContext.

Parameters:

context – User request context

Returns:

keystoneauth1 Adapter object