source: main/waeup.sirp/trunk/src/waeup/sirp/applicants/securitypolicy.py @ 7156

Last change on this file since 7156 was 7156, checked in by Henrik Bettermann, 13 years ago

Implement securitypolicy in students package, which belongs to the base package, and inherit from this implementation.

  • Property svn:keywords set to Id
File size: 2.1 KB
Line 
1##
2## securitypolicy.py
3## Login : <uli@pu.smp.net>
4## Started on  Mon Nov 14 09:37:10 2011 Uli Fouquet
5## $Id: securitypolicy.py 7156 2011-11-20 12:07:49Z henrik $
6##
7## Copyright (C) 2011 Uli Fouquet & Henrik Bettermann
8## This program is free software; you can redistribute it and/or modify
9## it under the terms of the GNU General Public License as published by
10## the Free Software Foundation; either version 2 of the License, or
11## (at your option) any later version.
12##
13## This program is distributed in the hope that it will be useful,
14## but WITHOUT ANY WARRANTY; without even the implied warranty of
15## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16## GNU General Public License for more details.
17##
18## You should have received a copy of the GNU General Public License
19## along with this program; if not, write to the Free Software
20## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21##
22"""Security policy components for applicants.
23
24Applicants need special security policy treatment, as officers with
25local roles for departments and faculties might have additional
26permissions (local roles on depts/faculties) here.
27"""
28import grok
29from zope.securitypolicy.interfaces import (
30    IPrincipalRoleManager, IPrincipalPermissionManager,)
31from zope.securitypolicy.principalrole import AnnotationPrincipalRoleManager
32from zope.securitypolicy.principalpermission import (
33    AnnotationPrincipalPermissionManager,)
34from zope.securitypolicy.settings import Allow, Deny, Unset
35from waeup.sirp.applicants.interfaces import IApplicant
36from waeup.sirp.students.securitypolicy import StudentPrincipalRoleManager
37
38# All components in here have the same context: Applicant instances
39grok.context(IApplicant)
40
41class ApplicantPrincipalRoleManager(StudentPrincipalRoleManager):
42
43    grok.provides(IPrincipalRoleManager)
44
45    #: The attribute name to lookup for additional roles
46    extra_attrib = 'course1'
47    subcontainer = None
48
49    #: List of role names to look for in `extra_attrib` and parents.
50    external_rolenames = ['waeup.local.ClearanceOfficer',]
51
52    #: Role to add in case one of the above roles was found.
53    additional_rolename = 'waeup.ApplicationsOfficer'
Note: See TracBrowser for help on using the repository browser.