本文整理汇总了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
示例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
示例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)
示例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)
示例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)
示例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)
示例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)
示例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)
示例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)
示例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
示例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
示例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)
示例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
示例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
示例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