def GET(self):
        """
        """
        userid = self.env["members"][0]

        user = userORM.getByID(userid)
        view = adminEditUserTmpl(searchList=[self.tmplSearchList])

        view.editUser = user

        return view
Esempio n. 2
0
    def POST(self):
        userid = self.env["members"][0]

        if userid == self.session.id:
            self.session.pushAlert("You can't delete yourself!",
                    "Can't do that!", "error")

            self.head = ("303 SEE OTHER",
                [("location", "/admin/users")])

            return

        user = userORM.getByID(userid)
        user.delete()

        self.session.pushAlert("User `%s` deleted" % user.username,
                "Bye!", "success")

        self.head = ("303 SEE OTHER",
            [("location", "/admin/users")])
Esempio n. 3
0
    def GET(self):
        """
        """
        userid = self.env["members"][0]

        if userid == self.session.id:
            self.session.pushAlert("You can't delete yourself!",
                    "Can't do that!", "error")

            self.head = ("303 SEE OTHER",
                [("location", "/admin/users")])

            return

        user = userORM.getByID(userid)
        view = adminDelUserTmpl(searchList=[self.tmplSearchList])

        view.editUser = user

        return view
    def POST(self):
        userid = self.env["members"][0]
        password = self.env["members"]["password"] if self.env["members"].has_key("password") else None
        passwordTwice = self.env["members"]["passwordTwice"] if self.env["members"].has_key("passwordTwice") else None
        about = self.env["members"]["about"] or ""
        level = self.env["members"]["level"] if self.env["members"].has_key("level") else 1
        email = self.env["members"]["email"] or ""
        emailVis = True if self.env["members"].has_key("emailVis") else False
        disable = True if self.env["members"].has_key("disable") else False

        user = userORM.getByID(userid)
        user.about = about
        #Not allowed to edit your own level,
        #or disable to avoid down leveling or locking out on accident
        if self.session.id != userid:
            user.level = level
            user.disable = disable
        user.email = email
        user.emailVisibility = emailVis
        user.save()

        if password and passwordTwice:
            if password == passwordTwice:
                user.setPassword(password)

            else:
                view = adminEditUserTmpl(searchList=[self.tmplSearchList])
                view.passwordMatchError = True

                self.session.pushAlert("Those passwords don't match, please try again.", "", "error")

                return view

        self.session.pushAlert("User `%s` updated" % user.username, "Yay", "success")

        self.head = ("303 SEE OTHER",
            [("location", "/admin/users")])