[Zope3-checkins] CVS: Products3/NewsSite - configure.zcml:1.14

Tres Seaver tseaver@zope.com
Thu, 27 Mar 2003 07:07:12 -0500


Update of /cvs-repository/Products3/NewsSite
In directory cvs.zope.org:/tmp/cvs-serv516

Modified Files:
	configure.zcml 
Log Message:


  - Declare roles and permissions specific to our application, and set
    up default grants.

  - Normalize order of attributes within view directives, to ease
    comparison / checking.


=== Products3/NewsSite/configure.zcml 1.13 => 1.14 ===
--- Products3/NewsSite/configure.zcml:1.13	Thu Mar 27 05:21:59 2003
+++ Products3/NewsSite/configure.zcml	Thu Mar 27 07:07:11 2003
@@ -3,14 +3,142 @@
     xmlns:browser='http://namespaces.zope.org/browser'
 >
 
-<!-- Declare a special menu for the content to be added within
-  :: a NewsSite.  The custom "adding" view for the site uses this
-  :: menu, and the content objects will insert their add forms into
-  :: it.
+<!-- Roles and permissions for a user-contributed news site.
   -->
-<browser:menu
-    id="add_news"
-    title="News Site Items"
+<role
+    id="Owner"
+    title="Content Owner"
+    description="The originator of a piece of content."
+    />
+
+<role
+    id="Member"
+    title="Site Member"
+    description="A member who has registered on the site."
+    />
+
+<role
+    id="Reviewer"
+    title="Site Reviewer"
+    description="A user who reviews submitted content."
+    />
+
+<!-- This is basically just 'zope.View';  meke it more fine-grained
+     to allow policy choices, and hope that the "remap permissions"
+     option for included ZCML lands soon).
+  -->
+<permission
+    id="zopeproducts.NewsSite.BrowseNewsItems"
+    title="Browse News Items"
+    description="Browse the news site."
+    />
+
+<grant
+    permission="zopeproducts.NewsSite.BrowseNewsItems"
+    role="Anonymous"
+    />
+
+<!-- Allow including file to turn off anonymous access without disabling
+     member access.
+  -->
+<grant
+    permission="zopeproducts.NewsSite.BrowseNewsItems"
+    role="Member"
+    />
+
+<permission
+    id="zopeproducts.NewsSite.SyndicateNewsItems"
+    title="Syndicate News Items"
+    description="Retrieve syndicated news items via RSS."
+    />
+
+<grant
+    permission="zopeproducts.NewsSite.SyndicateNewsItems"
+    role="Anonymous"
+    />
+
+<grant
+    permission="zopeproducts.NewsSite.SyndicateNewsItems"
+    role="Member"
+    />
+
+<permission
+    id="zopeproducts.NewsSite.JoinSite"
+    title="Join Site"
+    description="Register to become a member of the site."
+    />
+
+<grant
+    permission="zopeproducts.NewsSite.JoinSite"
+    role="Anonymous"
+    />
+
+<!-- Allow the manager to create members. -->
+<grant
+    permission="zopeproducts.NewsSite.JoinSite"
+    role="Manager"
+    />
+
+<permission
+    id="zopeproducts.NewsSite.CreateNewsItems"
+    title="Create News Items"
+    description="Create short documents for publication to the site."
+    />
+
+<grant
+    permission="zopeproducts.NewsSite.CreateNewsItems"
+    role="Member"
+    />
+
+<grant
+    permission="zopeproducts.NewsSite.CreateNewsItems"
+    role="Manager"
+    />
+
+<permission
+    id="zopeproducts.NewsSite.ModifyNewsItems"
+    title="Modify News Items"
+    description="Edit news items."
+    />
+
+<grant
+    permission="zopeproducts.NewsSite.ModifyNewsItems"
+    role="Owner"
+    />
+
+<grant
+    permission="zopeproducts.NewsSite.ModifyNewsItems"
+    role="Manager"
+    />
+
+<permission
+    id="zopeproducts.NewsSite.SubmitContentForReview"
+    title="Submit Content for Review"
+    />
+
+<grant
+    permission="zopeproducts.NewsSite.SubmitContentForReview"
+    role="Owner"
+    />
+
+<grant
+    permission="zopeproducts.NewsSite.SubmitContentForReview"
+    role="Manager"
+    />
+
+<permission
+    id="zopeproducts.NewsSite.PublishContent"
+    title="Publish Content"
+    />
+
+<grant
+    permission="zopeproducts.NewsSite.PublishContent"
+    role="Reviewer"
+    />
+
+<grant
+    permission="zopeproducts.NewsSite.PublishContent"
+    role="Manager"
     />
 
 <permission
@@ -23,6 +151,17 @@
     role="Manager"
     />
 
+<!-- Declare a special menu for the content to be added within
+     a NewsSite.  The custom "adding" view for the site uses this
+     menu, and the content objects will insert their add forms into
+     it.
+  -->
+<browser:menu
+    id="add_news"
+    title="News Site Items"
+    />
+
+
 <include package=".NewsItem" />
 
 <!-- Configuration for News Site Object
@@ -62,16 +201,16 @@
 
 </content>
 
-<!-- Register us with the "global" add list.
+<!-- Register NewsSite with the "global" add list.
+  -->
 <browser:menuItem
     menu="add_content"
-    for="zope.app.interfaces.container.IAdding"
     title="News site"
+    for="zope.app.interfaces.container.IAdding"
     action="NewsSite"
     description="A boring news site."
 	permission="zope.View"
     />
- -->
 
 <browser:addform
   name="AddNewsSite"
@@ -95,7 +234,7 @@
     name="+" 
     menu="zmi_actions" title="Add"
     class=".browser.NewsSiteAdding"
-    permission="zope.ManageContent"
+    permission="zopeproducts.NewsSite.CreateNewsItems"
     allowed_attributes="addingInfo"
     >
     <browser:page name="index.html"  template="add.pt" />
@@ -103,19 +242,19 @@
 </browser:view>
 
 <!-- Default view.
-  ::
-  :: XXX:  This should be named 'index.html', obviating the need for the
-  ::       'browser:defaultView' below;  however, some other directive is
-  ::       stomping on our registration if we do that! :(
+    
+     XXX:  This should be named 'index.html', obviating the need for the
+           'browser:defaultView' below;  however, some other directive is
+           stomping on our registration if we do that! :(
   -->
 <browser:page
-    template="newsindex.pt"
     name="list.html"
     for=".interfaces.INewsSite"
+    class=".newssite.NewsSiteView"
+    template="newsindex.pt"
     permission="zope.View"
     menu="zmi_views"
     title="View news index"
-    class=".newssite.NewsSiteView"
     />
 
 <browser:defaultView
@@ -126,21 +265,21 @@
 <!-- Render RSS for our items.
   -->
 <browser:page
-    for=".interfaces.INewsSite"
     name="index.rss"
+    for=".interfaces.INewsSite"
+    class=".browser.NewsSiteSyndicationView"
     template="index_rss.pt"
+    permission="zope.View"
     menu="zmi_views"
     title="RSS"
-    class=".browser.NewsSiteSyndicationView"
-    permission="zope.View"
     />
 
 <!-- Adapt the NewsSite to ISyndicationPolicies.
   -->
 <adapter
-    factory=".newssite.NewsSiteSyndicationPoliciesAdapter"
     provides=".interfaces.ISyndicationPolicies"
     for=".interfaces.INewsSite"
+    factory=".newssite.NewsSiteSyndicationPoliciesAdapter"
     permission="zopeproducts.NewsSite.ManageSyndication"
     />
 
@@ -148,11 +287,11 @@
   -->
 <browser:editform
     name="syndication.html"
+    for=".interfaces.INewsSite"
+    class=".browser.NewsSiteSyndicationPoliciesView"
     schema=".interfaces.ISyndicationPolicies"
     label="Syndication Policies"
     permission="zope.ManageContent"
-    for=".interfaces.INewsSite"
-    class=".browser.NewsSiteSyndicationPoliciesView"
     menu="zmi_views"
     title="Syndication"
     />
@@ -161,21 +300,21 @@
   -->
 <browser:addform
     name="register.html"
-    schema=".interfaces.IMember"
-    label="Registration"
     for=".interfaces.INewsSite"
     class=".register.MemberAddView"
-    menu="zmi_actions"
-    title="Register"
+    schema=".interfaces.IMember"
+    label="Registration"
     arguments="login password"
     set_before_add="email realname"
     permission="zope.View"
+    menu="zmi_actions"
+    title="Register"
     />
 
 <adapter
-    factory=".register.MemberDataAdapter"
     provides=".interfaces.IMember"
     for="zope.app.interfaces.security.IPrincipal"
+    factory=".register.MemberDataAdapter"
     permission="zope.Security"
     />
 
@@ -188,28 +327,13 @@
 
 <browser:editform
     name="memberdata.html"
+    for="zope.app.interfaces.security.IPrincipal"
     schema=".interfaces.IMember"
     label="Member Data"
     permission="zope.ManageContent"
-    for="zope.app.interfaces.security.IPrincipal"
     menu="zmi_views"
     title="Member Data"
     />
-
-<!--
-  **
-  **    How do we do this?  Should the view class just unwrap the user
-  **    object in order to have its way with it?
-  **
-<content
-    class="????"
->
-    <require
-        permission="zope.Public"
-        set_schema=".interfaces.IMember"
-        />
-</content>
-  -->
 
 <browser:skin name="news" layers="news rotterdam default" />