[45] | 1 | from Globals import InitializeClass |
---|
| 2 | from AccessControl import ClassSecurityInfo |
---|
| 3 | |
---|
| 4 | from Products.CMFCore.utils import getToolByName |
---|
| 5 | from Products.CMFCore.permissions import View |
---|
| 6 | from Products.CMFCore.permissions import ModifyPortalContent |
---|
| 7 | from Products.CPSCore.CPSBase import CPSBase_adder, CPSBaseFolder |
---|
| 8 | from Products.CPSCore.CPSBase import CPSBaseDocument as BaseDocument |
---|
| 9 | from Products.CPSCore.CPSBase import CPSBaseBTreeFolder as BaseBTreeFolder |
---|
[84] | 10 | from Products.CPSDocument.CPSDocument import CPSDocument |
---|
[45] | 11 | |
---|
| 12 | # |
---|
| 13 | # The WAeUP BaseContainer |
---|
| 14 | # |
---|
| 15 | |
---|
[139] | 16 | class University(CPSDocument): |
---|
[45] | 17 | """ |
---|
| 18 | Container for the various WAeUP containers |
---|
| 19 | """ |
---|
| 20 | meta_type = 'University' |
---|
| 21 | portal_type = meta_type |
---|
| 22 | security = ClassSecurityInfo() |
---|
[46] | 23 | |
---|
[139] | 24 | security.declarePublic('waeup_url') |
---|
| 25 | def waeup_url(self): |
---|
| 26 | """ return the base_url""" |
---|
| 27 | return "%s/sections/waeup" % self.portal_url |
---|
| 28 | return self.REQUEST |
---|
| 29 | |
---|
[166] | 30 | |
---|
| 31 | ## security.declarePublic('backEnd') |
---|
| 32 | ## def backEnd(self): |
---|
| 33 | ## """ are we in back-end mode""" |
---|
| 34 | ## mtool = self.portal_membership |
---|
| 35 | ## member = mtool.getAuthenticatedMember() |
---|
| 36 | ## roles = member.getRoles() |
---|
| 37 | ## if 'UniversityManager' in roles or 'StudentManager' in roles: |
---|
| 38 | ## return True |
---|
| 39 | ## return False |
---|
| 40 | ## |
---|
| 41 | ## security.declarePublic('frontEnd') |
---|
| 42 | ## def frontEnd(self): |
---|
| 43 | ## """ are we in front-end mode""" |
---|
| 44 | ## mtool = self.portal_membership |
---|
| 45 | ## member = mtool.getAuthenticatedMember() |
---|
| 46 | ## roles = member.getRoles() |
---|
| 47 | ## if 'Student' in roles: |
---|
| 48 | ## return True |
---|
| 49 | ## return False |
---|
| 50 | |
---|
| 51 | |
---|
[45] | 52 | InitializeClass(University) |
---|
| 53 | |
---|
[46] | 54 | |
---|
[45] | 55 | def addUniversity(container, id, REQUEST=None, **kw): |
---|
| 56 | """Add a WAeUP""" |
---|
| 57 | ob = University(id, **kw) |
---|
| 58 | return CPSBase_adder(container, ob, REQUEST=REQUEST) |
---|
| 59 | |
---|