diff options
| author | Michael Merickel <michael@merickel.org> | 2020-01-17 16:09:27 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-01-17 16:09:27 -0600 |
| commit | a71df99b57e88788cf9ce3a78fc005f309033bbd (patch) | |
| tree | 56668260a48bef6b194a735de947ee59fd9429f6 /docs/tutorials | |
| parent | 03d3bbd2791918a844da49eb4449b4953b83a31b (diff) | |
| parent | 592cadd9c20ce410d9ab7b9a748ec59dff001f65 (diff) | |
| download | pyramid-a71df99b57e88788cf9ce3a78fc005f309033bbd.tar.gz pyramid-a71df99b57e88788cf9ce3a78fc005f309033bbd.tar.bz2 pyramid-a71df99b57e88788cf9ce3a78fc005f309033bbd.zip | |
Merge pull request #3563 from mmerickel/move-acl-security-to-authorization
Move acl security to authorization
Diffstat (limited to 'docs/tutorials')
10 files changed, 27 insertions, 27 deletions
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 |
