source: waeup_product/trunk/Students.py @ 54

Last change on this file since 54 was 47, checked in by joachim, 19 years ago

=weitere

  • Property svn:keywords set to Id
File size: 2.7 KB
Line 
1from Globals import InitializeClass
2from AccessControl import ClassSecurityInfo
3
4from Products.CMFCore.utils import UniqueObject, getToolByName
5from Products.CMFCore.permissions import View
6from Products.CMFCore.permissions import ModifyPortalContent
7from Products.CPSCore.CPSBase import CPSBase_adder, CPSBaseFolder
8#from Products.CPSCore.CPSBase import CPSBaseDocument as BaseDocument
9from Products.CPSDocument.CPSDocument import CPSDocument
10from Products.CPSCore.CPSBase import CPSBaseBTreeFolder as BaseBTreeFolder
11
12#
13# The StudentsFolder
14#
15class StudentsFolder(BaseBTreeFolder):
16    """
17    WAeUP container for the various WAeUP containers data
18    """
19    meta_type = 'Students Folder'
20    portal_type = meta_type
21    security = ClassSecurityInfo()
22   
23    security.declarePublic("doCheckAdmission")
24    def doCheckAdmission(self,type_name,datamodel):
25        "the admission callback"
26##        class CPSUnrestrictedUser(UnrestrictedUser):
27##            """Unrestricted user that still has an id.
28##
29##            Taken from CPSMembershipTool
30##            """
31##
32##            def getId(self):
33##                """Return the ID of the user."""
34##                return self.getUserName()
35        print type_name
36        print datamodel
37        return self.REQUEST.RESPONSE.redirect("%s" % self.absolute_url())
38        mtool = getToolByName(self, 'portal_membership')
39        username = "%s" % datamodel.get('reg_nr')
40        print username
41        member=mtool.getMemberById("S%s" % username)
42        print member
43        from AccessControl.SecurityManagement import newSecurityManager
44        newSecurityManager(None,member.__of__(mtool.acl_users))
45        # datamodel is passed so that flexti can initialize the object.
46        #datamodel.set('lastname','Meier')
47        student = getattr(self,username)
48        student.invokeFactory('StudentPersonal', '%s' % username)
49        ob = getattr(student, id)
50        ##context.notifyCPSDocumentCreation(ob=ob)
51        return ob
52       
53InitializeClass(StudentsFolder)
54
55def addStudentsFolder(container, id, REQUEST=None, **kw):
56    """Add a Student."""
57    ob = StudentsFolder(id, **kw)
58    return CPSBase_adder(container, ob, REQUEST=REQUEST)
59###
60### The Student
61###
62##class Student(CPSDocument):
63##    """
64##    WAeUP Student container for the various student data
65##    """
66####    meta_type = 'Student'
67####    portal_type = meta_type
68##    security = ClassSecurityInfo()
69##   
70##    security.declarePublic("test")
71##    def test(self):
72##        """test"""
73##        return self.REQUEST
74##   
75##InitializeClass(Student)
76#
77##def addStudent(container, id, REQUEST=None, **kw):
78##    """Add a Student."""
79##    ob = Student(id, **kw)
80##    return CPSBase_adder(container, ob, REQUEST=REQUEST)
Note: See TracBrowser for help on using the repository browser.