Exemplo n.º 1
0
    def awake(self, trans):
        SitePage.awake(self, trans)
        self.trans = trans
        comps = self.compGet()
        self.userForm.company.clearChoices()
        self.editUserForm.company.clearChoices()
        if comps:
            for id, comp in comps:
                self.userForm.company.addChoice(id, comp)
                self.editUserForm.company.addChoice(id, comp)
        if trans.request().hasField("userid"):
            self.userForm.user.clearValidators()
            self.userForm.password.clearValidators()
            self.userForm.password_again.clearValidators()
            if not self.userFormInput:
                self.userFormInput = self.getUserInfo(
                    trans.request().field("userid"))

        # Update the validators since they depend upon session data and cannot be used across
        # sessions.
        self.userForm.company.clearValidators()
        self.editUserForm.cid.clearValidators()
        self.editUserForm.access.clearValidators()
        self.virtualForm._validators = []

        #self.userForm.company.addValidator(CompanyAccess(self.getUser(), self.db))
        #self.editUserForm.cid.addValidator(CompanyAccess(self.getUser(), self.db))
        self.virtualForm.addFormValidator(
            VirtualAccess(self.getUser(), self.db))
        self.virtualForm.addFormValidator(ValidEmail())
        if self.userFormInput:
            self.editUserForm.access.addValidator(
                AdminAccess(self.getUser(), self.db,
                            self.userFormInput["user"]))
Exemplo n.º 2
0
    def awake(self, trans):
        SitePage.awake(self, trans)
        self.trans = trans
        request = trans.request()

        #self.virtualForm.domain.clearChoices()
        #self.editVirtualForm.domain.clearChoices()
        #for domain in self.getDomains(None):
        #    self.virtualForm.domain.addChoice(domain, domain)
        #    self.editVirtualForm.domain.addChoice(domain, domain)

        self.mode = None
        self.dataInput = {}
        if trans.request().hasField("aid"):
            self.mode = "AID"
            try:
                self.dataInput = self.aliasGet(request.field("aid"))
            except:
                self.mode = None
        elif trans.request().hasField("vid"):
            self.mode = "VID"
            try:
                self.dataInput = self.getVirtualId(request.field("vid"))
            except:
                self.mode = None
        elif trans.request().hasField("new"):
            if trans.request().field("new") == "alias":
                self.mode = "ALIAS"
            if trans.request().field("new") == "virtual":
                self.mode = "VIRTUAL"
        else:
            self.mode = None
Exemplo n.º 3
0
    def awake(self,trans):
        SitePage.awake(self,trans)
        self.trans = trans
        comps = self.compGet()
        self.userForm.company.clearChoices()
        self.editUserForm.company.clearChoices()
        if comps:
            for id,comp in comps:
                self.userForm.company.addChoice(id,comp)
                self.editUserForm.company.addChoice(id,comp)
        if trans.request().hasField("userid"):
            self.userForm.user.clearValidators()
            self.userForm.password.clearValidators()
            self.userForm.password_again.clearValidators()
            if not self.userFormInput:
                self.userFormInput = self.getUserInfo(trans.request().field("userid"))

        # Update the validators since they depend upon session data and cannot be used across
        # sessions.
        self.userForm.company.clearValidators()
        self.editUserForm.cid.clearValidators()
        self.editUserForm.access.clearValidators()
        self.virtualForm._validators = []

        #self.userForm.company.addValidator(CompanyAccess(self.getUser(), self.db))
        #self.editUserForm.cid.addValidator(CompanyAccess(self.getUser(), self.db))
        self.virtualForm.addFormValidator(VirtualAccess(self.getUser(), self.db))
        self.virtualForm.addFormValidator(ValidEmail())
        if self.userFormInput:
            self.editUserForm.access.addValidator(AdminAccess(self.getUser(), self.db,self.userFormInput["user"]))
Exemplo n.º 4
0
 def awake(self, trans):
     SitePage.awake(self, trans)
     self.trans = trans
     comps = self.compGet()
     self.page1.company.clearChoices()
     for id,comp in comps:
         self.page1.company.addChoice(id, comp)
     self.page = 1
Exemplo n.º 5
0
    def awake(self, trans):
        SitePage.awake(self, trans)

        self.editCompForm.id.clearValidators()
        # self.editCompForm.id.addValidator(CompanyAccess(self.getUser(), self.db))

        if trans.request().hasField("id"):
            self.id = id = trans.request().field("id")
            # if not self.formInput:
            # self.formInput = {}
            self.formInput = self.compGet(id=id)
Exemplo n.º 6
0
    def awake(self, trans):
        SitePage.awake(self, trans)

        self.editCompForm.id.clearValidators()
        #self.editCompForm.id.addValidator(CompanyAccess(self.getUser(), self.db))

        if trans.request().hasField('id'):
            self.id = id = trans.request().field('id')
            #if not self.formInput:
            #self.formInput = {}
            self.formInput = self.compGet(id=id)