summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorPatricio Paez <pp@pp.com.mx>2011-05-29 22:03:48 -0500
committerPatricio Paez <pp@pp.com.mx>2011-05-30 18:07:56 -0500
commit6346a4d686a0222349e338a8f5721b06280b0d90 (patch)
tree4cbfd64aa91c713072ed244ee4944f3f2c0b1a12 /docs
parentded6e085fdb6b64d676e96de15e59c0f657c658f (diff)
downloadpyramid-6346a4d686a0222349e338a8f5721b06280b0d90.tar.gz
pyramid-6346a4d686a0222349e338a8f5721b06280b0d90.tar.bz2
pyramid-6346a4d686a0222349e338a8f5721b06280b0d90.zip
Sync Adding Authorization on both wiki tutorials
Diffstat (limited to 'docs')
-rw-r--r--docs/tutorials/wiki/authorization.rst6
-rw-r--r--docs/tutorials/wiki2/authorization.rst67
2 files changed, 41 insertions, 32 deletions
diff --git a/docs/tutorials/wiki/authorization.rst b/docs/tutorials/wiki/authorization.rst
index dbfcb55d5..8781325d2 100644
--- a/docs/tutorials/wiki/authorization.rst
+++ b/docs/tutorials/wiki/authorization.rst
@@ -71,12 +71,12 @@ content:
:linenos:
:language: python
-The ``groupfinder`` function defined here is an authorization policy
+The ``groupfinder`` function defined here is an :term:`authentication policy`
"callback"; it is a callable that accepts a userid and a request. If the
-userid exists in the set of users known by the system, the callback will
+userid exists in the system, the callback will
return a sequence of group identifiers (or an empty sequence if the user
isn't a member of any groups). If the userid *does not* exist in the system,
-the callback will return ``None``. In a production system this data will
+the callback will return ``None``. In a production system, user and group data will
most often come from a database, but here we use "dummy" data to represent
user and groups sources. Note that the ``editor`` user is a member of the
``group:editors`` group in our dummy group data (the ``GROUPS`` data
diff --git a/docs/tutorials/wiki2/authorization.rst b/docs/tutorials/wiki2/authorization.rst
index 43231287d..64c587f07 100644
--- a/docs/tutorials/wiki2/authorization.rst
+++ b/docs/tutorials/wiki2/authorization.rst
@@ -13,6 +13,19 @@ continue allowing anyone with access to the server to view pages.
:term:`authentication`. We'll make use of both features to provide security
to our application.
+We will add an :term:`authentication policy` and an
+:term:`authorization policy` to our :term:`application
+registry`, add a ``security.py`` module, create a :term:`root factory`
+with an :term:`ACL`, and add :term:`permission` declarations to
+the ``edit_page`` and ``add_page`` views.
+
+Then we will add ``login`` and ``logout`` views, and modify the
+existing views to make them return a ``logged_in`` flag to the
+renderer.
+
+Finally, we will add a ``login.pt`` template and change the existing
+``view.pt`` and ``edit.pt`` to show a "Logout" link when not logged in.
+
The source code for this tutorial stage can be browsed at
`http://github.com/Pylons/pyramid/tree/master/docs/tutorials/wiki2/src/authorization/
<http://github.com/Pylons/pyramid/tree/master/docs/tutorials/wiki2/src/authorization/>`_.
@@ -156,7 +169,7 @@ Add a ``security.py`` module within your package (in the same directory as
:linenos:
:language: python
-The groupfinder defined here is an :term:`authentication policy`
+The ``groupfinder`` function defined here is an :term:`authentication policy`
"callback"; it is a callable that accepts a userid and a request. If
the userid exists in the system, the callback will return a sequence
of group identifiers (or an empty sequence if the user isn't a member
@@ -245,6 +258,25 @@ class="app-welcome align-right">`` div:
<a href="${request.application_url}/logout">Logout</a>
</span>
+Seeing Our Changes To ``views.py`` and our Templates
+----------------------------------------------------
+
+Our ``views.py`` module will look something like this when we're done:
+
+.. literalinclude:: src/authorization/tutorial/views.py
+ :linenos:
+ :language: python
+
+Our ``edit.pt`` template will look something like this when we're done:
+
+.. literalinclude:: src/authorization/tutorial/templates/edit.pt
+ :language: xml
+
+Our ``view.pt`` template will look something like this when we're done:
+
+.. literalinclude:: src/authorization/tutorial/templates/view.pt
+ :language: xml
+
Viewing the Application in a Browser
------------------------------------
@@ -272,31 +304,8 @@ try are as follows:
credentials with the username ``editor``, password ``editor`` will
display the edit page form.
-Seeing Our Changes To ``views.py`` and our Templates
-----------------------------------------------------
-
-Our ``views.py`` module will look something like this when we're done:
-
-.. literalinclude:: src/authorization/tutorial/views.py
- :linenos:
- :language: python
-
-Our ``edit.pt`` template will look something like this when we're done:
-
-.. literalinclude:: src/authorization/tutorial/templates/edit.pt
- :language: xml
-
-Our ``view.pt`` template will look something like this when we're done:
-
-.. literalinclude:: src/authorization/tutorial/templates/view.pt
- :language: xml
-
-Revisiting the Application
----------------------------
-
-When we revisit the application in a browser, and log in (as a result
-of hitting an edit or add page and submitting the login form with the
-``editor`` credentials), we'll see a Logout link in the upper right
-hand corner. When we click it, we're logged out, and redirected back
-to the front page.
-
+- After logging in (as a result of hitting an edit or add page
+ and submitting the login form with the ``editor``
+ credentials), we'll see a Logout link in the upper right hand
+ corner. When we click it, we're logged out, and redirected
+ back to the front page.