from Globals import InitializeClass from AccessControl import ClassSecurityInfo from Products.CMFCore.utils import UniqueObject, getToolByName from Products.CMFCore.permissions import View from Products.CMFCore.permissions import ModifyPortalContent from Products.CPSCore.CPSBase import CPSBase_adder, CPSBaseFolder #from Products.CPSCore.CPSBase import CPSBaseDocument as BaseDocument from Products.CPSDocument.CPSDocument import CPSDocument from Products.CPSCore.CPSBase import CPSBaseBTreeFolder as BaseBTreeFolder # # The StudentsFolder # class StudentsFolder(BaseBTreeFolder): """ WAeUP container for the various WAeUP containers data """ meta_type = 'Students Folder' portal_type = meta_type security = ClassSecurityInfo() security.declarePublic("doCheckAdmission") def doCheckAdmission(self,type_name,datamodel): "the admission callback" ## class CPSUnrestrictedUser(UnrestrictedUser): ## """Unrestricted user that still has an id. ## ## Taken from CPSMembershipTool ## """ ## ## def getId(self): ## """Return the ID of the user.""" ## return self.getUserName() print type_name print datamodel return self.REQUEST.RESPONSE.redirect("%s" % self.absolute_url()) mtool = getToolByName(self, 'portal_membership') username = "%s" % datamodel.get('reg_nr') print username member=mtool.getMemberById("S%s" % username) print member from AccessControl.SecurityManagement import newSecurityManager newSecurityManager(None,member.__of__(mtool.acl_users)) # datamodel is passed so that flexti can initialize the object. #datamodel.set('lastname','Meier') student = getattr(self,username) student.invokeFactory('StudentPersonal', '%s' % username) ob = getattr(student, id) ##context.notifyCPSDocumentCreation(ob=ob) return ob InitializeClass(StudentsFolder) def addStudentsFolder(container, id, REQUEST=None, **kw): """Add a Student.""" ob = StudentsFolder(id, **kw) return CPSBase_adder(container, ob, REQUEST=REQUEST) ### ### The Student ### ##class Student(CPSDocument): ## """ ## WAeUP Student container for the various student data ## """ #### meta_type = 'Student' #### portal_type = meta_type ## security = ClassSecurityInfo() ## ## security.declarePublic("test") ## def test(self): ## """test""" ## return self.REQUEST ## ##InitializeClass(Student) # ##def addStudent(container, id, REQUEST=None, **kw): ## """Add a Student.""" ## ob = Student(id, **kw) ## return CPSBase_adder(container, ob, REQUEST=REQUEST)