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


Python TOJAuth.check_access_func方法代码示例

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


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

示例1: get_user_info_by_uid

# 需要导入模块: from tojauth import TOJAuth [as 别名]
# 或者: from tojauth.TOJAuth import check_access_func [as 别名]
    def get_user_info_by_uid(self, uid):
        cur = self.db.cursor()
        sqlstr = ('SELECT "uid", "username", "nickname", "email", "avatar", '
                  '"aboutme", "cover" FROM "USER" WHERE "uid" = %s;')
        sqlarr = (uid, )
        cur.execute(sqlstr, sqlarr)

        ret = None
        for data in cur:
            ret = {}
            ret['uid'] = data[0]
            ret['username'] = data[1]
            ret['nickname'] = data[2]
            ret['email'] = data[3]
            ret['avatar'] = data[4]
            ret['aboutme'] = data[5]
            ret['cover'] = data[6]

        uid = self.get_current_uid()
        if uid != ret['uid']:    
            try:
                TOJAuth.check_access_func(
                    self._accessid, TOJAuth.ACCESS_EXECUTE)
            except Exception:
                del ret['email']

        return ret
开发者ID:taiwan-online-judge,项目名称:taiwan-online-judge,代码行数:29,代码来源:user.py

示例2: get_notice

# 需要导入模块: from tojauth import TOJAuth [as 别名]
# 或者: from tojauth.TOJAuth import check_access_func [as 别名]
    def get_notice(self, noticeid):
        cur = self.db.cursor()
        sqlstr = ('SELECT "noticeid", "uid", "title", "content", "time", '
                  '"noticemodid", "metadata", "unread" FROM "NOTICE" WHERE '
                  '"noticeid" = %s;')
        sqlarr = (noticeid, )
        cur.execute(sqlstr, sqlarr)

        ret = None
        for data in cur:
            ret = {}
            ret['noticeid'] = data[0]
            ret['uid'] = data[1]
            ret['title'] = data[2]
            ret['content'] = data[3]
            ret['time'] = data[4]
            ret['noticemodid'] = data[5]
            ret['metadata'] = data[6]
            ret['unread'] = data[7]

        if ret == None:
            return None

        uid = mod.UserMg.get_current_uid()
        if uid != ret['uid']:
            TOJAuth.check_access_func(self._accessid, TOJAuth.ACCESS_EXECUTE)

        return ret
开发者ID:taiwan-online-judge,项目名称:taiwan-online-judge,代码行数:30,代码来源:notice.py

示例3: _add_testmode

# 需要导入模块: from tojauth import TOJAuth [as 别名]
# 或者: from tojauth.TOJAuth import check_access_func [as 别名]
    def _add_testmode(self, testmodename, timelimit, memlimit):
        TOJAuth.check_access_func(self._accessid, TOJAuth.ACCESS_WRITE)

        cur = self.db.cursor()
        sqlstr = ('INSERT INTO "PMOD_TEST_TESTMODE" ("proid", "testmodename", '
                  '"timelimit", "memlimit") VALUES (%s, %s, %s, %s);')
        sqlarr = (self._proid, testmodename, timelimit, memlimit)
        cur.execute(sqlstr, sqlarr)
开发者ID:taiwan-online-judge,项目名称:taiwan-online-judge,代码行数:10,代码来源:pmod_test.py

示例4: _set_mode

# 需要导入模块: from tojauth import TOJAuth [as 别名]
# 或者: from tojauth.TOJAuth import check_access_func [as 别名]
    def _set_mode(self, modeid, content, testmodeid):
        TOJAuth.check_access_func(self._accessid, TOJAuth.ACCESS_WRITE)

        cur = self.db.cursor()
        sqlstr = ('UPDATE "PMOD_TEST_MODE" SET "content" = %s, '
                  '"testmodeid" = %s WHERE "proid" = %s AND "modeid" = %s;')
        sqlarr = (content, testmodeid, self._proid, modeid)
        cur.execute(sqlstr, sqlarr)
开发者ID:taiwan-online-judge,项目名称:taiwan-online-judge,代码行数:10,代码来源:pmod_test.py

示例5: _del_mode

# 需要导入模块: from tojauth import TOJAuth [as 别名]
# 或者: from tojauth.TOJAuth import check_access_func [as 别名]
    def _del_mode(self, modeid):
        TOJAuth.check_access_func(self._accessid, TOJAuth.ACCESS_WRITE)

        cur = self.db.cursor()
        sqlstr = ('DELETE FROM "PMOD_TEST_MODE" WHERE "proid" = %s AND '
                  '"modeid" = %s;')
        sqlarr = (self._proid, modeid)
        cur.execute(sqlstr, sqlarr)
开发者ID:taiwan-online-judge,项目名称:taiwan-online-judge,代码行数:10,代码来源:pmod_test.py

示例6: set_problem

# 需要导入模块: from tojauth import TOJAuth [as 别名]
# 或者: from tojauth.TOJAuth import check_access_func [as 别名]
    def set_problem(self, proid, title):
        accessid = self.get_accessid_by_proid(proid)
        TOJAuth.check_access_func(accessid, TOJAuth.ACCESS_WRITE)

        cur = self.db.cursor()
        sqlstr = ('UPDATE "PROBLEM" SET "title" = %s WHERE "proid" = %s;')
        sqlarr = (title, proid)
        cur.execute(sqlstr, sqlarr)
开发者ID:taiwan-online-judge,项目名称:taiwan-online-judge,代码行数:10,代码来源:problem.py

示例7: _set_testmode

# 需要导入模块: from tojauth import TOJAuth [as 别名]
# 或者: from tojauth.TOJAuth import check_access_func [as 别名]
    def _set_testmode(self, testmodeid, testmodename, timelimit, memlimit):
        TOJAuth.check_access_func(self._accessid, TOJAuth.ACCESS_WRITE)

        cur = self.db.cursor()
        sqlstr = ('UPDATE "PMOD_TEST_TESTMODE" SET "testmodename" = %s, '
                  '"timelimit" = %s, "memlimit" = %s WHERE "proid" = %s AND '
                  '"testmodeid" = %s;')
        sqlarr = (testmodename, timelimit, memlimit, self._proid, testmodeid)
        cur.execute(sqlstr, sqlarr)
开发者ID:taiwan-online-judge,项目名称:taiwan-online-judge,代码行数:11,代码来源:pmod_test.py

示例8: set_square

# 需要导入模块: from tojauth import TOJAuth [as 别名]
# 或者: from tojauth.TOJAuth import check_access_func [as 别名]
    def set_square(self, sqid, title, start_time, end_time, intro, logo):
        accessid = self.get_accessid_by_sqid(sqid)
        TOJAuth.check_access_func(accessid, TOJAuth.ACCESS_WRITE)

        cur = self.db.cursor()
        sqlstr = ('UPDATE "SQUARE" SET "title" = %s, "start_time" = %s, '
                  '"end_time" = %s, "intro" = %s, "logo" = %s '
                  'WHERE "sqid" = %s;')
        sqlarr = (title, start_time, end_time, intro, logo, sqid)
        cur.execute(sqlstr, sqlarr)
开发者ID:taiwan-online-judge,项目名称:taiwan-online-judge,代码行数:12,代码来源:square.py

示例9: _set_square_category

# 需要导入模块: from tojauth import TOJAuth [as 别名]
# 或者: from tojauth.TOJAuth import check_access_func [as 别名]
    def _set_square_category(self, sqid, category):
        sq_accessid = self.get_accessid_by_sqid(sqid)
        TOJAuth.check_access_func(sq_accessid, TOJAuth.ACCESS_WRITE)

        if category == []:
            category = [0]

        cur = self.db.cursor()
        sqlstr = ('UPDATE "SQUARE" SET "cateid" = %s WHERE "sqid" = %s;')
        sqlarr = (category, sqid)
        cur.execute(sqlstr, sqlarr)
开发者ID:taiwan-online-judge,项目名称:taiwan-online-judge,代码行数:13,代码来源:square.py

示例10: _list_testdata

# 需要导入模块: from tojauth import TOJAuth [as 别名]
# 或者: from tojauth.TOJAuth import check_access_func [as 别名]
    def _list_testdata(self):
        TOJAuth.check_access_func(self._accessid, TOJAuth.ACCESS_WRITE)

        with TOJAuth.change_current_iden(self._idendesc):
            testdata_list = mod.TestdataMg.instance._list_testdata(self._proid)

        for test in testdata_list:
            del test['blobname']
            del test['proid']

        return testdata_list
开发者ID:taiwan-online-judge,项目名称:taiwan-online-judge,代码行数:13,代码来源:pmod_test.py

示例11: _create_testdata

# 需要导入模块: from tojauth import TOJAuth [as 别名]
# 或者: from tojauth.TOJAuth import check_access_func [as 别名]
    def _create_testdata(self, info, filekey, expire):
        TOJAuth.check_access_func(self._accessid, TOJAuth.ACCESS_WRITE)

        # Upload file

        blobname = 'TEST_BLOBNAME'

        with TOJAuth.change_current_iden(self._idendesc):
            testid = mod.TestdataMg.instance._add_testdata(
                blobname, expire, self._proid, info)

        return testid
开发者ID:taiwan-online-judge,项目名称:taiwan-online-judge,代码行数:14,代码来源:pmod_test.py

示例12: _add_mode

# 需要导入模块: from tojauth import TOJAuth [as 别名]
# 或者: from tojauth.TOJAuth import check_access_func [as 别名]
    def _add_mode(self, modeid, content, testmodeid):
        TOJAuth.check_access_func(self._accessid, TOJAuth.ACCESS_WRITE)

        cur = self.db.cursor()
        sqltab = ('INSERT INTO "PMOD_TEST_MODE" (')
        sqlcol = ('"proid", "content", "testmodeid"')
        sqlval = (') VALUES (%s, %s, %s')
        sqlend = (');')
        sqlarr = [self._proid, content, testmodeid]

        if modeid != None:
            sqlcol = sqlcol + ', "modeid"'
            sqlval = sqlval + ', %s'
            sqlarr.append(modeid)

        sqlstr = sqltab + sqlcol + sqlval + sqlend
        cur.execute(sqlstr, sqlarr)
开发者ID:taiwan-online-judge,项目名称:taiwan-online-judge,代码行数:19,代码来源:pmod_test.py

示例13: _get_mode_by_modeid

# 需要导入模块: from tojauth import TOJAuth [as 别名]
# 或者: from tojauth.TOJAuth import check_access_func [as 别名]
    def _get_mode_by_modeid(self, modeid):
        TOJAuth.check_access_func(self._accessid, TOJAuth.ACCESS_WRITE)

        cur = self.db.cursor()
        sqlstr = ('SELECT "proid", "modeid", "content", "testmodeid" FROM '
                  '"PMOD_TEST_MODE" WHERE "proid" = %s AND "modeid" = %s;')
        sqlarr = (self._proid, modeid)
        cur.execute(sqlstr, sqlarr)

        mode = None
        for data in cur:
            mode = {}
            mode['proid'] = data[0]
            mode['modeid'] = data[1]
            mode['content'] = data[2]
            mode['testmodeid'] = data[3]

        return mode
开发者ID:taiwan-online-judge,项目名称:taiwan-online-judge,代码行数:20,代码来源:pmod_test.py

示例14: _list_mode

# 需要导入模块: from tojauth import TOJAuth [as 别名]
# 或者: from tojauth.TOJAuth import check_access_func [as 别名]
    def _list_mode(self):
        TOJAuth.check_access_func(self._accessid, TOJAuth.ACCESS_WRITE)

        cur = self.db.cursor()
        sqlstr = ('SELECT "modeid", "testmodeid" FROM "PMOD_TEST_MODE" '
                  'WHERE "proid" = %s ORDER BY "modeid" ASC;')
        sqlarr = (self._proid, )
        cur.execute(sqlstr, sqlarr)

        mode_list = []
        for data in cur:
            obj = {}
            obj['modeid'] = data[0]
            obj['testmodeid'] = data[1]

            mode_list.append(obj)

        return mode_list
开发者ID:taiwan-online-judge,项目名称:taiwan-online-judge,代码行数:20,代码来源:pmod_test.py

示例15: _get_testmode

# 需要导入模块: from tojauth import TOJAuth [as 别名]
# 或者: from tojauth.TOJAuth import check_access_func [as 别名]
    def _get_testmode(self, testmodeid):
        TOJAuth.check_access_func(self._accessid, TOJAuth.ACCESS_WRITE)

        cur = self.db.cursor()
        sqlstr = ('SELECT "testmodeid", "testmodename", "timelimit", '
                  '"memlimit" FROM "PMOD_TEST_TESTMODE" WHERE "proid" = %s AND '
                  '"testmodeid" = %s;')
        sqlarr = (self._proid, testmodeid)
        cur.execute(sqlstr, sqlarr)

        testmode = None
        for data in cur:
            testmode = {}
            testmode['testmodeid'] = data[0]
            testmode['testmodename'] = data[1]
            testmode['timelimit'] = data[2]
            testmode['memlimit'] = data[3]

        return testmode
开发者ID:taiwan-online-judge,项目名称:taiwan-online-judge,代码行数:21,代码来源:pmod_test.py


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