The horizon.users Module

Classes and methods related to user handling in Horizon.

horizon.users.LazyUser[source]
class horizon.users.User(id=None, token=None, user=None, tenant_id=None, service_catalog=None, tenant_name=None, roles=None, authorized_tenants=None, request=None)[source]

Bases: object

The main user class which Horizon expects.

horizon.users.token

The id of the Keystone token associated with the current user/tenant.

horizon.users.username

The name of the current user.

horizon.users.tenant_id

The id of the Keystone tenant for the current user/token.

horizon.users.tenant_name

The name of the Keystone tenant for the current user/token.

horizon.users.service_catalog

The ServiceCatalog data returned by Keystone.

horizon.users.roles

A list of dictionaries containing role names and ids as returned by Keystone.

horizon.users.admin

Boolean value indicating whether or not this user has admin privileges. Internally mapped to horizon.users.User.is_admin().

User.admin[source]
User.authorized_tenants[source]
User.get_and_delete_messages()[source]

Placeholder function for parity with django.contrib.auth.models.User.

User.is_admin()[source]

Evaluates whether this user has admin privileges. Returns True or False.

User.is_authenticated()[source]

Evaluates whether this User instance has been authenticated. Returns True or False.

horizon.users.get_user_from_request(request)[source]

Checks the current session and returns a User.

If the session contains user data the User will be treated as authenticated and the User will have all its attributes set.

If not, the User will have no attributes set.

If the session contains invalid data, NotAuthorized will be raised.

Previous topic

The horizon.test Module

Next topic

The horizon.models Module

This Page