Provided a context (a model object), and a permission (a string or unicode object), return a sequence of principal ids that possess the permission in the context. If no authorization policy is in effect, this will return a sequence with the single value representing Everyone (the special principal identifier representing all principals).
Note
even if an authorization policy is in effect, some (exotic) authorization policies may not implement the required machinery for this function; those will cause a NotImplementedError exception to be raised when this function is invoked.
Return a sequence of header tuples (e.g. [('Set-Cookie', 'foo=abc')]) suitable for ‘forgetting’ the set of credentials possessed by the currently authenticated user. A common usage might look like so within the body of a view function (response is assumed to be an WebOb-style response object computed previously by the view code):
from repoze.bfg.security import forget
headers = forget(context, request)
response.headerlist.extend(headers)
return response
If no authentication policy is in use, this function will always return an empty sequence.
Return a sequence of header tuples (e.g. [('Set-Cookie', 'foo=abc')]) suitable for ‘remembering’ a set of credentials implied by the data passed as principal and *kw using the current authentication policy. Common usage might look like so within the body of a view function (response is assumed to be an WebOb-style response object computed previously by the view code):
from repoze.bfg.security import forget
headers = remember(context, request, 'chrism', password='123')
response.headerlist.extend(headers)
return response
If no authentication policy is in use, this function will always return an empty sequence. If used, the composition and meaning of **kw must be agreed upon by the calling code and the effective authentication policy.