Michael Merickel
2018-10-15 d8a08302f3b38da8a5d9b854afbe346d84c534c2
Merge pull request #3386 from Pylons/update-auth-policy-docs

Update documentation for implementing custom authz policy
1 files modified
12 ■■■■■ changed files
docs/narr/security.rst 12 ●●●●● patch | view | raw | blame | history
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