<configure 
    xmlns="http://namespaces.zope.org/zope">

<!-- permission -->

  <!-- DocumentLibrary -->
 
  <permission
    id="documentlibrary.View"
    title="View Document Library"
    description="View Document Library"
  />

  <permission
    id="documentlibrary.ViewSubmitter"
    title="View Document Library (as Submitter)"
    description="View Document Library as Submitter"
  />

  <permission
    id="documentlibrary.ViewLibrarian"
    title="View Document Library (as Librarian)"
    description="View Document Library as Librarian"
  />

  <permission
    id="documentlibrary.ViewManager"
    title="View Document Library (as Manager)"
    description="View Document Library as Manager"
  />

  <!-- Category -->

  <permission
    id="documentlibrary.ViewCategory"
    title="View Category"
    description="View Categories"
  />
  
  <permission
    id="documentlibrary.EditCategory"
    title="Edit Category"
    description="Edit Categories"
   />

  <permission
    id="documentlibrary.AddCategory"
    title="Add Category"
    description="Add Categories" 
    />

  <permission 
    id="documentlibrary.ContributeToCategory"
    title="Contribute to Category"
    description="Contribute to Category"
    />

  <!-- DocumentFolder -->

  <permission
    id="documentlibrary.ViewDocumentFolder"
    title="View Document Folders"
    description="View Document Folders"
  />

  <permission
    id="documentlibrary.AddDocumentFolder"
    title="Add DocumentFolder"
    description="Add DocumentFolders"
  />

  <!-- Document -->

  <permission
    id="documentlibrary.ViewDocument"
    title="View Document"
    description="View Documents"
  />

  <permission
    id="documentlibrary.EditDocument"
    title="Edit Document"
    description="Edit Documents"
  />

  <permission
    id="documentlibrary.AddDocument"
    title="Add Document"
    description="Add Documents"
  />

  <permission
    id="documentlibrary.ApproveDocument"
    title="Approve Documents"
    description="Approve Documents"
  />

  <!-- History -->

  <permission
    id="documentlibrary.ViewHistory"
    title="View History"
    description="View History Entries"
  />

  <permission
    id="documentlibrary.AddHistory"
    title="Add History Entry"
    description="Add History Entries"
  />

  <!-- User -->
  
  <permission
    id="documentlibrary.ViewUser"
    title="View User"
    description="View Users"
  />

  <permission
    id="documentlibrary.EditUser"
    title="Edit User"
    description="Edit Users"
  />

  <permission
    id="documentlibrary.AddUser"
    title="Add User"
    description="Add Users"
  />

  <!-- Workflow -->
  <permission
    id="documentlibrary.Workflow"
    title="Drive workflow"
    description="Drive workflow"
  />

  <!-- Mail -->

  <permission
    id="documentlibrary.SendMail"
    title="Send out emails"
    description="Send out emails"
  />

  <!-- Configuration -->

  <permission
    id="documentlibrary.Configure"
    title="Configure document library"
    description="Configure document library"
  />

  <!-- Roles -->

  <!-- a viewer who can view/download documents -->
  <role
    id="documentlibrary.ViewerUser"
    title="Document Library Viewer User"
    description="User who can be given permission to view/download documents."
  />

  <!-- a viewer who has particular access to a document -->
  <role
    id="documentlibrary.DocumentViewer"
    title="Document Library Document Viewer"
    description="User who can view/download document."
  />

  <!-- Enters documentlibrary as submitter and has no access to
       librarian functionality. Can contribute documents to
       categories, and edit the documents they have contributed.  -->
  <role
    id="documentlibrary.SubmitterUser"
    title="Document Library Submitter User"
    description="Can do submitter actions in document library"
  />

  <!-- Enters the documentlibrary as librarian and has access to
       librarian functionality. Owns one or more categories to manage. 
       May also be just contributor to some categories. -->
  <role
    id="documentlibrary.LibrarianUser"
    title="Document Library Librarian User"
    description="Can do librarian actions in document library"
  />

  <!-- Owner of a document. Can edit the document. -->
  <role
    id="documentlibrary.DocumentOwner"
    title="Document Library Document Owner"
    description="Can do author actions on document"
  />

  <!-- Contributor to a category. Can add documents to that category. -->
  <role
    id="documentlibrary.CategoryContributor"
    title="Document Library Category Contributor"
    description="Can contribute documents to category"
  />

  <!-- Owner of a category. May manage as librarian documents in this 
       category. -->
  <role
    id="documentlibrary.CategoryOwner"
    title="Document Library Category Owner"
    description="Can do author and librarian actions on category"
  />

  <!-- Manager of the document library. Can do everything, everywhere. -->
  <role
    id="documentlibrary.ManagerUser"
    title="Document Library Manager User"
    description="Manager role for Document Lirary"
  />

<!-- Role assignments -->

  <!-- ViewerUser -->

  <!-- DocumentViewer -->

  <grant
    role="documentlibrary.DocumentViewer"
    permission="documentlibrary.ViewDocument"
  />

  <!-- SubmitterUser -->

  <grant
    role="documentlibrary.SubmitterUser"
    permission="documentlibrary.ViewSubmitter"
   />

  <grant
    role="documentlibrary.SubmitterUser"
    permission="documentlibrary.AddHistory"
  />

  <grant
    role="documentlibrary.SubmitterUser"
    permission="documentlibrary.AddDocument"
  />

  <!-- LibrarianUser -->

  <grant
    role="documentlibrary.LibrarianUser"
    permission="documentlibrary.ViewSubmitter"
   />

  <grant
    role="documentlibrary.LibrarianUser"
    permission="documentlibrary.AddHistory"
  />

  <grant
    role="documentlibrary.LibrarianUser"
    permission="documentlibrary.AddDocument"
  />

  <grant 
    role="documentlibrary.LibrarianUser"
    permission="documentlibrary.ViewLibrarian"
  />

  <!-- DocumentOwner -->

  <grant
    role="documentlibrary.DocumentOwner"
    permission="documentlibrary.ViewSubmitter"
   />

  <grant
    role="documentlibrary.DocumentOwner"
    permission="documentlibrary.ViewDocument"
  />

  <grant
    role="documentlibrary.DocumentOwner"
    permission="documentlibrary.EditDocument"
  />

  <grant
    role="documentlibrary.DocumentOwner"
    permission="documentlibrary.ViewDocumentFolder"
  />

  <grant
    role="documentlibrary.DocumentOwner"
    permission="documentlibrary.SendMail"
  />

  <!-- CategoryContributor -->

  <grant
    role="documentlibrary.CategoryContributor"
    permission="documentlibrary.ContributeToCategory"
  />

  <grant
    role="documentlibrary.CategoryContributor"
    permission="documentlibrary.ViewCategory" 
   />

  <!-- XXX this may be too broad -->
  <grant
    role="documentlibrary.CategoryContributor"
    permission="documentlibrary.ViewDocument"
  />
  
  <!-- CategoryOwner -->
  <grant
    role="documentlibrary.CategoryOwner"
    permission="documentlibrary.ViewDocument"
  />

  <grant
    role="documentlibrary.CategoryOwner"
    permission="documentlibrary.EditDocument"
  />

  <grant
    role="documentlibrary.CategoryOwner"
    permission="documentlibrary.ContributeToCategory"
  />

  <grant
    role="documentlibrary.CategoryOwner"
    permission="documentlibrary.ApproveDocument"
  />

  <grant
    role="documentlibrary.CategoryOwner"
    permission="documentlibrary.ViewDocumentFolder"
  />

  <grant
    role="documentlibrary.CategoryOwner"
    permission="documentlibrary.AddDocumentFolder"
  />

  <grant
    role="documentlibrary.CategoryOwner"
    permission="documentlibrary.ViewCategory" 
   />

  <grant
    role="documentlibrary.CategoryOwner"
    permission="documentlibrary.EditCategory"
  />

  <grant
    role="documentlibrary.CategoryOwner"
    permission="documentlibrary.AddCategory"
  />

  <grant
    role="documentlibrary.CategoryOwner"
    permission="documentlibrary.SendMail"
  />

  <!-- ManagerUser -->

  <grant
    role="documentlibrary.ManagerUser"
    permission="documentlibrary.ViewSubmitter"
   />

  <grant
    role="documentlibrary.ManagerUser"
    permission="documentlibrary.ViewLibrarian"
  />

  <grant
    role="documentlibrary.ManagerUser"
    permission="documentlibrary.ViewManager"
  />

  <grant
    role="documentlibrary.ManagerUser"
    permission="documentlibrary.ViewDocument"
  />

  <grant
    role="documentlibrary.ManagerUser"
    permission="documentlibrary.EditDocument"
  />

  <grant
    role="documentlibrary.ManagerUser"
    permission="documentlibrary.AddDocument"
  />

  <grant
    role="documentlibrary.ManagerUser"
    permission="documentlibrary.ContributeToCategory"
  />

  <grant
    role="documentlibrary.ManagerUser"
    permission="documentlibrary.ApproveDocument"
  />

  <grant
    role="documentlibrary.ManagerUser"
    permission="documentlibrary.ViewDocumentFolder"
  />

  <grant
    role="documentlibrary.ManagerUser"
    permission="documentlibrary.AddDocumentFolder"
  />

  <grant
    role="documentlibrary.ManagerUser"
    permission="documentlibrary.ViewCategory" 
   />

  <grant
    role="documentlibrary.ManagerUser"
    permission="documentlibrary.EditCategory"
  />

  <grant
    role="documentlibrary.ManagerUser"
    permission="documentlibrary.AddCategory"
  />

  <grant
    role="documentlibrary.ManagerUser"
    permission="zope.View"
  />

  <grant
    role="documentlibrary.ManagerUser"
    permission="documentlibrary.SendMail"
  />

  <grant
    role="documentlibrary.ManagerUser"
    permission="documentlibrary.ViewHistory"
  />

  <grant
    role="documentlibrary.ManagerUser"
    permission="documentlibrary.ViewUser"
  />

  <grant
    role="documentlibrary.ManagerUser"
    permission="documentlibrary.EditUser"
  />

  <grant
    role="documentlibrary.ManagerUser"
    permission="documentlibrary.AddUser"
  />

  <grant
    role="documentlibrary.ManagerUser"
    permission="documentlibrary.Configure"
  />

</configure>
