tailbone.subscribers
¶
Event Subscribers
- tailbone.subscribers.new_request(event)[source]¶
Identify the current user, and cache their current permissions. Also adds the
rattail_config
attribute to the request.A global Rattail
config
should already be present within the Pyramid application registry’s settings, which would normally be accessed via:request.registry.settings['rattail_config']
This function merely “promotes” that config object so that it is more directly accessible, a la:
request.rattail_config
Note
This of course assumes that a Rattail
config
object has in fact already been placed in the application registry settings. If this is not the case, this function will do nothing.Also, attach some goodies to the request object:
The currently logged-in user instance (if any), as
user
.is_admin
flag indicating whether user has the Administrator role.is_root
flag indicating whether user is currently elevated to root.A shortcut method for permission checking, as
has_perm()
.