[ English | 한국어 (대한민국) | español | français | Esperanto | português (Brasil) | English (United Kingdom) | Indonesia | 中文 (简体, 中国) | русский | नेपाली | Deutsch ]
Horizon Decorators¶
General-purpose decorators for use with Horizon.
- horizon.decorators.require_auth(view_func)[source]¶
- Performs user authentication check. - Similar to Django’s login_required decorator, except that this throws - NotAuthenticatedexception if the user is not signed-in.
- horizon.decorators.require_component_access(view_func, component)[source]¶
- Perform component can_access check to access the view. - :param component containing the view (panel or dashboard). - Raises a - NotAuthorizedexception if the user cannot access the component containing the view. By example the check of component policy rules will be applied to its views.
- horizon.decorators.require_perms(view_func, required)[source]¶
- Enforces permission-based access controls. - Parameters:
- required (list) – A tuple of permission names, all of which the request user must possess in order access the decorated view. 
 - Example usage: - from horizon.decorators import require_perms @require_perms(['foo.admin', 'foo.member']) def my_view(request): ... - Raises a - NotAuthorizedexception if the requirements are not met.
