summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatricio Paez <pp@pp.com.mx>2011-04-16 07:46:07 -0500
committerPatricio Paez <pp@pp.com.mx>2011-04-16 07:46:07 -0500
commitf5eba4b0745c8313bdb291bba68ee58a4420171a (patch)
treea0761a22846557f71d6b649b93caf5f7ab07fc68
parenta6e30eb7c937023fb2e987571cc1b31df5deb270 (diff)
downloadpyramid-f5eba4b0745c8313bdb291bba68ee58a4420171a.tar.gz
pyramid-f5eba4b0745c8313bdb291bba68ee58a4420171a.tar.bz2
pyramid-f5eba4b0745c8313bdb291bba68ee58a4420171a.zip
Improve ZODB tutorial (Adding Authorization)
- Consolidate two sections and promote some to first level - Add a couple of terms
-rw-r--r--docs/tutorials/wiki/authorization.rst42
1 files changed, 16 insertions, 26 deletions
diff --git a/docs/tutorials/wiki/authorization.rst b/docs/tutorials/wiki/authorization.rst
index ee86eb543..3a83a38fb 100644
--- a/docs/tutorials/wiki/authorization.rst
+++ b/docs/tutorials/wiki/authorization.rst
@@ -7,22 +7,18 @@ edit, and add pages to our wiki. For purposes of demonstration we'll change
our application to allow people whom are members of a *group* named
``group:editors`` to add and edit wiki pages but we'll continue allowing
anyone with access to the server to view pages. :app:`Pyramid` provides
-facilities for *authorization* and *authentication*. We'll make use of both
-features to provide security to our application.
+facilities for :term:`authorization` and :term:`authentication`. We'll make
+use of both features to provide security to our application.
-The source code for this tutorial stage can be browsed via
-`http://github.com/Pylons/pyramid/tree/master/docs/tutorials/wiki/src/authorization/
-<http://github.com/Pylons/pyramid/tree/master/docs/tutorials/wiki/src/authorization/>`_.
-
-
-Configuring a ``pyramid`` Authentication Policy
---------------------------------------------------
-
-For any :app:`Pyramid` application to perform authorization, we need to add a
+We need to add a
``security.py`` module and we'll need to change our :term:`application
registry` to add an :term:`authentication policy` and a :term:`authorization
policy`.
+The source code for this tutorial stage can be browsed via
+`http://github.com/Pylons/pyramid/tree/master/docs/tutorials/wiki/src/authorization/
+<http://github.com/Pylons/pyramid/tree/master/docs/tutorials/wiki/src/authorization/>`_.
+
Adding Authentication and Authorization Policies
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -155,7 +151,7 @@ class="app-welcome align-right">`` div:
</span>
Giving Our Root Resource an ACL
--------------------------------
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
We need to give our root resource object an :term:`ACL`. This ACL will be
sufficient to provide enough information to the :app:`Pyramid` security
@@ -192,7 +188,7 @@ Our resulting ``models.py`` file will now look like so:
:language: python
Adding ``permission`` Declarations to our ``view_config`` Decorators
---------------------------------------------------------------------
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To protect each of our views with a particular permission, we need to pass a
``permission`` argument to each of our :class:`pyramid.view.view_config`
@@ -239,7 +235,7 @@ decorators. To do so, within ``views.py``:
pages.
Viewing the Application in a Browser
-------------------------------------
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
We can finally examine our application in a browser. The views we'll try are
as follows:
@@ -267,8 +263,13 @@ as follows:
credentials with the username ``editor``, password ``editor`` will
show the edit page form being displayed.
+- 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.
+
Seeing Our Changes To ``views.py`` and our Templates
-----------------------------------------------------
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Our ``views.py`` module will look something like this when we're done:
@@ -288,14 +289,3 @@ Our ``view.pt`` template will look something like this when we're done:
:linenos:
: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.
-
-
-