From a7e16c231c05ca8bea3271632a347e7eac96cb9d Mon Sep 17 00:00:00 2001 From: Bert JW Regeer <bertjw@regeer.org> Date: Mon, 15 Oct 2018 01:23:17 +0200 Subject: [PATCH] Update documentation for implementing custom authz policy --- docs/narr/security.rst | 12 +++++++----- 1 files changed, 7 insertions(+), 5 deletions(-) diff --git a/docs/narr/security.rst b/docs/narr/security.rst index 5bccd6d..6b6f9a1 100644 --- a/docs/narr/security.rst +++ b/docs/narr/security.rst @@ -714,14 +714,16 @@ .. code-block:: python :linenos: - class IAuthorizationPolicy(object): + class IAuthorizationPolicy(Interface): """ An object representing a Pyramid authorization policy. """ - def permits(self, context, principals, permission): - """ Return ``True`` if any of the ``principals`` is allowed the - ``permission`` in the current ``context``, else return ``False`` + def permits(context, principals, permission): + """ Return an instance of :class:`pyramid.security.Allowed` if any + of the ``principals`` is allowed the ``permission`` in the current + ``context``, else return an instance of + :class:`pyramid.security.Denied`. """ - def principals_allowed_by_permission(self, context, permission): + def principals_allowed_by_permission(context, permission): """ Return a set of principal identifiers allowed by the ``permission`` in ``context``. This behavior is optional; if you choose to not implement it you should define this method as -- Gitblit v1.9.3