1 | ## |
---|
2 | ## securitypolicy.py |
---|
3 | ## Login : <uli@pu.smp.net> |
---|
4 | ## Started on Mon Nov 14 09:37:10 2011 Uli Fouquet |
---|
5 | ## $Id: dynamicroles.py 7159 2011-11-21 10:11:07Z 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 | |
---|
24 | Applicants need special security policy treatment, as officers with |
---|
25 | local roles for departments and faculties might have additional |
---|
26 | permissions (local roles on depts/faculties) here. |
---|
27 | """ |
---|
28 | import grok |
---|
29 | from zope.securitypolicy.interfaces import ( |
---|
30 | IPrincipalRoleManager, IPrincipalPermissionManager,) |
---|
31 | from zope.securitypolicy.principalrole import AnnotationPrincipalRoleManager |
---|
32 | from zope.securitypolicy.principalpermission import ( |
---|
33 | AnnotationPrincipalPermissionManager,) |
---|
34 | from zope.securitypolicy.settings import Allow, Deny, Unset |
---|
35 | from waeup.sirp.applicants.interfaces import IApplicant |
---|
36 | from waeup.sirp.students.dynamicroles import StudentPrincipalRoleManager |
---|
37 | |
---|
38 | # All components in here have the same context: Applicant instances |
---|
39 | grok.context(IApplicant) |
---|
40 | |
---|
41 | class 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' |
---|