当前位置: 首页>>代码示例>>Python>>正文


Python MUser.update_privilege方法代码示例

本文整理汇总了Python中torlite.model.muser.MUser.update_privilege方法的典型用法代码示例。如果您正苦于以下问题:Python MUser.update_privilege方法的具体用法?Python MUser.update_privilege怎么用?Python MUser.update_privilege使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在torlite.model.muser.MUser的用法示例。


在下文中一共展示了MUser.update_privilege方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: UserHandler

# 需要导入模块: from torlite.model.muser import MUser [as 别名]
# 或者: from torlite.model.muser.MUser import update_privilege [as 别名]

#.........这里部分代码省略.........
    def changepassword(self):

        post_data = {}
        for key in self.request.arguments:
            post_data[key] = self.get_arguments(key)

        uu = self.muser.check_user(self.user_name, post_data['rawpass'][0])
        if uu == 1:
            self.muser.update_pass(self.user_name, post_data['user_pass'][0])
            self.redirect(('/{0}/info').format(self.tmpl_router))
        else:
            return False

    @tornado.web.authenticated
    def changeinfo(self):
        post_data = {}
        for key in self.request.arguments:
            post_data[key] = self.get_arguments(key)

        uu = self.muser.check_user(self.user_name, post_data['rawpass'][0])

        if uu == 1:
            self.muser.update_info(self.user_name, post_data['user_email'][0])
            self.redirect(('/user/info'))
        else:
            return False

    @tornado.web.authenticated
    def changeprivilege(self, xg_username):
        post_data = {}
        for key in self.request.arguments:
            post_data[key] = self.get_arguments(key)
        if self.tmpl_router == "user":
            self.muser.update_privilege(xg_username, post_data['privilege'][0])
            self.redirect(('/user/info'))
        else:
            if self.muser.update_privilege(xg_username, post_data['privilege'][0]):
                output = {
                    'del_category ': 1,
                }
            else:
                output = {
                    'del_category ': 0,
                }
            return json.dump(output, self)

    @tornado.web.authenticated
    def logout(self):
        self.clear_all_cookies()
        self.redirect('/')

    @tornado.web.authenticated
    def changepass(self):

        self.render('{0}/{1}/changepass.html'.format(self.tmpl_name, self.tmpl_router),
                    user_info=self.muser.get_by_id(self.user_name))

    @tornado.web.authenticated
    def change_info(self):
        self.render('{0}/{1}/changeinfo.html'.format(self.tmpl_name, self.tmpl_router),
                    user_info=self.muser.get_by_id(self.user_name))

    @tornado.web.authenticated
    def change_privilege(self, xg_username):
        self.render('{0}/{1}/changeprivilege.html'.format(self.tmpl_name, self.tmpl_router),
开发者ID:vaveee,项目名称:TorCMS,代码行数:69,代码来源:user_handler.py

示例2: UserHandler

# 需要导入模块: from torlite.model.muser import MUser [as 别名]
# 或者: from torlite.model.muser.MUser import update_privilege [as 别名]
class UserHandler(BaseHandler):
    def initialize(self):
        self.muser = MUser()
        self.user_name = self.get_current_user()

    def get(self, url_str):
        url_arr = url_str.split('/')
        if url_str == 'regist':
            if self.get_current_user():
                self.redirect('/')
            else:
                self.__to_register__()
        elif url_str == 'login':
            self.to_login()
        elif url_str == 'info':
            self.show_info()
        elif url_str == 'logout':
            self.logout()
        elif url_str == 'changepass':
            self.changepass()
        elif url_str == 'changeinfo':
            self.change_info()
        elif url_arr[0] == 'changeprivilege':
            self.change_privilege(url_arr[1])
        elif url_str == 'find':
            self.to_find()
        elif url_arr[0] == 'find':
            self.find(url_arr[1])

    def post(self, url_str):
        url_arr = url_str.split('/')
        if url_str == 'regist':
            self.register()
        elif url_str == 'login':
            self.login()
        elif url_str == 'changepass':
            self.changepassword()
        elif url_str == 'changeinfo':
            self.changeinfo()
        elif url_str == 'find':
            self.post_find()
        elif url_arr[0] == 'changeprivilege':
            self.changeprivilege(url_arr[1])

    @tornado.web.authenticated
    def changepassword(self):
        post_data = {}
        for key in self.request.arguments:
            post_data[key] = self.get_arguments(key)

        uu = self.muser.check_user(self.user_name, post_data['rawpass'][0])
        print(uu)
        if uu == 1:
            self.muser.update_pass(self.user_name, post_data['user_pass'][0])
            self.redirect(('/user/info'))
        else:
            return False

    @tornado.web.authenticated
    def changeinfo(self):
        post_data = {}
        for key in self.request.arguments:
            post_data[key] = self.get_arguments(key)

        uu = self.muser.check_user(self.user_name, post_data['rawpass'][0])
        print(uu)
        if uu == 1:
            self.muser.update_info(self.user_name, post_data['user_email'][0])
            self.redirect(('/user/info'))
        else:
            return False

    @tornado.web.authenticated
    def changeprivilege(self, xg_username):
        post_data = {}
        for key in self.request.arguments:
            post_data[key] = self.get_arguments(key)

            self.muser.update_privilege(xg_username, post_data['privilege'][0])
            self.redirect(('/user/info'))

    @tornado.web.authenticated
    def logout(self):
        self.clear_all_cookies()
        self.redirect('/')

    @tornado.web.authenticated
    def changepass(self):
        self.render('tplite/user/changepass.html',
                    user_info=self.muser.get_by_id(self.user_name))

    @tornado.web.authenticated
    def change_info(self):
        self.render('tplite/user/changeinfo.html',
                    user_info=self.muser.get_by_id(self.user_name))

    @tornado.web.authenticated
    def change_privilege(self, xg_username):
        self.render('tplite/user/changeprivilege.html',

#.........这里部分代码省略.........
开发者ID:Geoion,项目名称:TorCMS,代码行数:103,代码来源:user_handler.py


注:本文中的torlite.model.muser.MUser.update_privilege方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。