diff options
| author | Michael Merickel <michael@merickel.org> | 2020-01-16 10:34:45 -0600 |
|---|---|---|
| committer | Michael Merickel <michael@merickel.org> | 2020-01-16 10:34:45 -0600 |
| commit | 592cadd9c20ce410d9ab7b9a748ec59dff001f65 (patch) | |
| tree | 2e4133bffc8363259afef49f8899402d17098246 /docs | |
| parent | a7f61dc1ae95ffddacccfb583fa7a8f6d294f4b9 (diff) | |
| download | pyramid-592cadd9c20ce410d9ab7b9a748ec59dff001f65.tar.gz pyramid-592cadd9c20ce410d9ab7b9a748ec59dff001f65.tar.bz2 pyramid-592cadd9c20ce410d9ab7b9a748ec59dff001f65.zip | |
update docs with pyramid.authorizatio imports after syncing master
Diffstat (limited to 'docs')
16 files changed, 62 insertions, 35 deletions
diff --git a/docs/api/authorization.rst b/docs/api/authorization.rst index 7bf245500..be040f055 100644 --- a/docs/api/authorization.rst +++ b/docs/api/authorization.rst @@ -19,6 +19,10 @@ Constants granted to all requests. Its actual value is the string ``'system.Everyone'``. + .. versionadded:: 2.0 + + Moved from ``pyramid.security`` into ``pyramid.authorization``. + .. attribute:: Authenticated The special principal id named ``Authenticated``. This principal id @@ -26,6 +30,10 @@ Constants principal id (according to the :term:`authentication policy`). Its actual value is the string ``'system.Authenticated'``. + .. versionadded:: 2.0 + + Moved from ``pyramid.security`` into ``pyramid.authorization``. + .. attribute:: ALL_PERMISSIONS An object that can be used as the ``permission`` member of an ACE @@ -33,6 +41,10 @@ Constants ACE that uses ``ALL_PERMISSIONS`` might be composed like so: ``('Deny', 'system.Everyone', ALL_PERMISSIONS)``. + .. versionadded:: 2.0 + + Moved from ``pyramid.security`` into ``pyramid.authorization``. + .. attribute:: DENY_ALL A convenience shorthand ACE that defines ``('Deny', @@ -40,6 +52,10 @@ Constants last ACE in an ACL in systems that use an "inheriting" security policy, representing the concept "don't inherit any other ACEs". + .. versionadded:: 2.0 + + Moved from ``pyramid.security`` into ``pyramid.authorization``. + Return Values ------------- @@ -48,7 +64,15 @@ Return Values .. automethod:: __new__ + .. versionadded:: 2.0 + + Moved from ``pyramid.security`` into ``pyramid.authorization``. + .. autoclass:: ACLAllowed :members: msg .. automethod:: __new__ + + .. versionadded:: 2.0 + + Moved from ``pyramid.security`` into ``pyramid.authorization``. diff --git a/docs/quick_tutorial/authorization/tutorial/resources.py b/docs/quick_tutorial/authorization/tutorial/resources.py index 0cb656f12..b125cf083 100644 --- a/docs/quick_tutorial/authorization/tutorial/resources.py +++ b/docs/quick_tutorial/authorization/tutorial/resources.py @@ -1,4 +1,4 @@ -from pyramid.security import Allow, Everyone +from pyramid.authorization import Allow, Everyone class Root(object): @@ -6,4 +6,4 @@ class Root(object): (Allow, 'group:editors', 'edit')] def __init__(self, request): - pass
\ No newline at end of file + pass diff --git a/docs/quick_tutorial/authorization/tutorial/security.py b/docs/quick_tutorial/authorization/tutorial/security.py index 5b3e04a5f..53e3536fc 100644 --- a/docs/quick_tutorial/authorization/tutorial/security.py +++ b/docs/quick_tutorial/authorization/tutorial/security.py @@ -1,7 +1,10 @@ import bcrypt from pyramid.authentication import AuthTktCookieHelper -from pyramid.authorization import ACLHelper -from pyramid.security import Authenticated, Everyone +from pyramid.authorization import ( + ACLHelper, + Authenticated, + Everyone, +) def hash_password(pw): diff --git a/docs/quick_tutorial/authorization/tutorial/views.py b/docs/quick_tutorial/authorization/tutorial/views.py index 3876efb1c..b9c828086 100644 --- a/docs/quick_tutorial/authorization/tutorial/views.py +++ b/docs/quick_tutorial/authorization/tutorial/views.py @@ -2,13 +2,13 @@ from pyramid.httpexceptions import HTTPFound from pyramid.security import ( remember, forget, - ) +) from pyramid.view import ( view_config, view_defaults, forbidden_view_config - ) +) from .security import ( USERS, diff --git a/docs/quick_tutorial/databases/tutorial/models.py b/docs/quick_tutorial/databases/tutorial/models.py index 8e6649d49..bbfd480bb 100644 --- a/docs/quick_tutorial/databases/tutorial/models.py +++ b/docs/quick_tutorial/databases/tutorial/models.py @@ -1,4 +1,4 @@ -from pyramid.security import Allow, Everyone +from pyramid.authorization import Allow, Everyone from sqlalchemy import ( Column, diff --git a/docs/tutorials/wiki/authorization.rst b/docs/tutorials/wiki/authorization.rst index 995dfa729..3c9913d8c 100644 --- a/docs/tutorials/wiki/authorization.rst +++ b/docs/tutorials/wiki/authorization.rst @@ -108,8 +108,8 @@ For our application we've defined a list of a few principals: - ``u:<userid>`` - ``group:editor`` -- :attr:`pyramid.security.Authenticated` -- :attr:`pyramid.security.Everyone` +- :attr:`pyramid.authorization.Authenticated` +- :attr:`pyramid.authorization.Everyone` Various wiki pages will grant some of these principals access to edit existing or add new pages. @@ -176,9 +176,9 @@ Add the following lines to the ``Wiki`` class: :emphasize-lines: 4-7 :language: python -We import :data:`~pyramid.security.Allow`, an action which means that +We import :data:`~pyramid.authorization.Allow`, an action which means that permission is allowed. -We also import :data:`~pyramid.security.Everyone`, a special :term:`principal` that is associated to all requests. +We also import :data:`~pyramid.authorization.Everyone`, a special :term:`principal` that is associated to all requests. Both are used in the :term:`ACE` entries that make up the ACL. The ACL is a list that needs to be named ``__acl__`` and be an attribute of a class. diff --git a/docs/tutorials/wiki/src/authorization/tutorial/models/__init__.py b/docs/tutorials/wiki/src/authorization/tutorial/models/__init__.py index 64ae4bf5c..580ea41c5 100644 --- a/docs/tutorials/wiki/src/authorization/tutorial/models/__init__.py +++ b/docs/tutorials/wiki/src/authorization/tutorial/models/__init__.py @@ -1,11 +1,11 @@ from persistent import Persistent from persistent.mapping import PersistentMapping - -from pyramid.security import ( +from pyramid.authorization import ( Allow, Everyone, ) + class Wiki(PersistentMapping): __name__ = None __parent__ = None diff --git a/docs/tutorials/wiki/src/authorization/tutorial/security.py b/docs/tutorials/wiki/src/authorization/tutorial/security.py index 9f51aa54c..f4445578e 100644 --- a/docs/tutorials/wiki/src/authorization/tutorial/security.py +++ b/docs/tutorials/wiki/src/authorization/tutorial/security.py @@ -1,7 +1,7 @@ import bcrypt from pyramid.authentication import AuthTktCookieHelper -from pyramid.authorization import ACLHelper -from pyramid.security import ( +from pyramid.authorization import ( + ACLHelper, Authenticated, Everyone, ) diff --git a/docs/tutorials/wiki/src/tests/tutorial/models/__init__.py b/docs/tutorials/wiki/src/tests/tutorial/models/__init__.py index 64ae4bf5c..580ea41c5 100644 --- a/docs/tutorials/wiki/src/tests/tutorial/models/__init__.py +++ b/docs/tutorials/wiki/src/tests/tutorial/models/__init__.py @@ -1,11 +1,11 @@ from persistent import Persistent from persistent.mapping import PersistentMapping - -from pyramid.security import ( +from pyramid.authorization import ( Allow, Everyone, ) + class Wiki(PersistentMapping): __name__ = None __parent__ = None diff --git a/docs/tutorials/wiki/src/tests/tutorial/security.py b/docs/tutorials/wiki/src/tests/tutorial/security.py index 9f51aa54c..f4445578e 100644 --- a/docs/tutorials/wiki/src/tests/tutorial/security.py +++ b/docs/tutorials/wiki/src/tests/tutorial/security.py @@ -1,7 +1,7 @@ import bcrypt from pyramid.authentication import AuthTktCookieHelper -from pyramid.authorization import ACLHelper -from pyramid.security import ( +from pyramid.authorization import ( + ACLHelper, Authenticated, Everyone, ) diff --git a/docs/tutorials/wiki2/authorization.rst b/docs/tutorials/wiki2/authorization.rst index 001bde935..38b9b7373 100644 --- a/docs/tutorials/wiki2/authorization.rst +++ b/docs/tutorials/wiki2/authorization.rst @@ -30,7 +30,7 @@ identifiers that are easier to generalize. The permissions are then written against the principals without focusing on the exact user involved. :app:`Pyramid` defines two builtin principals used in every application: -:attr:`pyramid.security.Everyone` and :attr:`pyramid.security.Authenticated`. +:attr:`pyramid.authorization.Everyone` and :attr:`pyramid.authorization.Authenticated`. On top of these we have already mentioned the required principals for this application in the original design. The user has two possible roles: ``editor`` or ``basic``. These will be prefixed by the string ``role:`` to avoid clashing @@ -40,7 +40,7 @@ Open the file ``tutorial/security.py`` and edit it as follows: .. literalinclude:: src/authorization/tutorial/security.py :linenos: - :emphasize-lines: 2,5-8,17,42-53 + :emphasize-lines: 2-6,17,42-53 :language: python Only the highlighted lines need to be added. diff --git a/docs/tutorials/wiki2/src/authorization/tutorial/routes.py b/docs/tutorials/wiki2/src/authorization/tutorial/routes.py index f016d7541..f7bbe6011 100644 --- a/docs/tutorials/wiki2/src/authorization/tutorial/routes.py +++ b/docs/tutorials/wiki2/src/authorization/tutorial/routes.py @@ -1,11 +1,11 @@ +from pyramid.authorization import ( + Allow, + Everyone, +) from pyramid.httpexceptions import ( HTTPNotFound, HTTPSeeOther, ) -from pyramid.security import ( - Allow, - Everyone, -) from . import models diff --git a/docs/tutorials/wiki2/src/authorization/tutorial/security.py b/docs/tutorials/wiki2/src/authorization/tutorial/security.py index 7a99fb9e9..5a9d4bbf2 100644 --- a/docs/tutorials/wiki2/src/authorization/tutorial/security.py +++ b/docs/tutorials/wiki2/src/authorization/tutorial/security.py @@ -1,11 +1,11 @@ from pyramid.authentication import AuthTktCookieHelper -from pyramid.authorization import ACLHelper -from pyramid.csrf import CookieCSRFStoragePolicy -from pyramid.request import RequestLocalCache -from pyramid.security import ( +from pyramid.authorization import ( + ACLHelper, Authenticated, Everyone, ) +from pyramid.csrf import CookieCSRFStoragePolicy +from pyramid.request import RequestLocalCache from . import models diff --git a/docs/tutorials/wiki2/src/tests/tutorial/routes.py b/docs/tutorials/wiki2/src/tests/tutorial/routes.py index f016d7541..7070884d3 100644 --- a/docs/tutorials/wiki2/src/tests/tutorial/routes.py +++ b/docs/tutorials/wiki2/src/tests/tutorial/routes.py @@ -2,7 +2,7 @@ from pyramid.httpexceptions import ( HTTPNotFound, HTTPSeeOther, ) -from pyramid.security import ( +from pyramid.authorization import ( Allow, Everyone, ) diff --git a/docs/tutorials/wiki2/src/tests/tutorial/security.py b/docs/tutorials/wiki2/src/tests/tutorial/security.py index 7a99fb9e9..5a9d4bbf2 100644 --- a/docs/tutorials/wiki2/src/tests/tutorial/security.py +++ b/docs/tutorials/wiki2/src/tests/tutorial/security.py @@ -1,11 +1,11 @@ from pyramid.authentication import AuthTktCookieHelper -from pyramid.authorization import ACLHelper -from pyramid.csrf import CookieCSRFStoragePolicy -from pyramid.request import RequestLocalCache -from pyramid.security import ( +from pyramid.authorization import ( + ACLHelper, Authenticated, Everyone, ) +from pyramid.csrf import CookieCSRFStoragePolicy +from pyramid.request import RequestLocalCache from . import models diff --git a/docs/whatsnew-2.0.rst b/docs/whatsnew-2.0.rst index d5f825c43..a58f317d7 100644 --- a/docs/whatsnew-2.0.rst +++ b/docs/whatsnew-2.0.rst @@ -95,4 +95,4 @@ The new :attr:`pyramid.request.Request.authenticated_identity` property will output the same result as :attr:`pyramid.request.Request.authenticated_userid`. If using a security policy, :attr:`pyramid.request.Request.unauthenticated_userid` will return the same value as :attr:`pyramid.request.Request.authenticated_userid`. -:attr:`pyramid.request.Request.effective_principals` will always return a one-element list containing the :data:`pyramid.security.Everyone` principal, as there is no equivalent in the new security policy. +:attr:`pyramid.request.Request.effective_principals` will always return a one-element list containing the :data:`pyramid.authorization.Everyone` principal, as there is no equivalent in the new security policy. |
