def test_login(self): request = my_request() name = 'admin' pwd = 'admin' stat, reason = request.login(name,pwd) print 'stat:' print name print 'reason:' print reason
def __init__(self): super(loginDialog, self).__init__() request = my_request() self.login = request.login self.setWindowTitle(u"系统登录") width = 300 height = 250 self.setFixedSize(width, height) self.drawlayout() self.connect(self.button_ok, SIGNAL("clicked()"), self.doLogin) self.connect(self.button_cancle, SIGNAL("clicked()"), self.reject)
def __init__(self,uid): super(newObjectDialog, self).__init__() self.uid = uid request = my_request() self.add_object = request.add_object self.has_object = request.has_object self.setWindowTitle(u"新建客体") width = 350 height = 350 self.setFixedSize(width, height) self.drawlayout() self.connect(self.button_ok, SIGNAL("clicked()"), self.saveObjecect) self.connect(self.button_cancle, SIGNAL("clicked()"), self.reject)
def __init__(self): super(newSubjectDialog,self).__init__() request = my_request() self.has_subject = request.has_subject self.add_subject = request.add_subject # set title self.setWindowTitle(u"新建主体") # set size width = 300 heiht = 250 self.setFixedSize(width, heiht) self.drawlayout() self.connect(self.button_ok,SIGNAL("clicked()"),self.save_subject) self.connect(self.button_cancle, SIGNAL("clicked()"),self.reject)
def __init__(self, grantor): super(grantAccessDialog, self).__init__() request = my_request() # set title self.setWindowTitle(u"新建授权") # set size width = 400 height = 300 self.grantor = grantor self.setFixedSize(width, height) # subject[0] means id , subject[1] means string name self.subjects = request.get_subjects() # object[0] means id, object[1] means string name self.objects = request.get_objects() # access[0] means id access[1] means string name self.accesses = request.get_accesses() self.can_grant = request.can_grant self.grant_access = request.grant_access self.drawlayout() self.connect(self.button_ok, SIGNAL("clicked()"), self.doGrant) self.connect(self.button_cancle, SIGNAL("clicked()"), self.reject)
def test_has_subject(self): request = my_request() self.has_subject = request.has_subject res = self.has_subject('never') assert res == False print 'OK'
# -*- coding:utf-8 import sys from PyQt4.QtGui import * from PyQt4.QtCore import * from module_request import module_request as my_request from module_request import Accesses request = my_request() def newBlackToken(grantor): new_blacktoken_dlg = newBlackTokenDialog(grantor) new_blacktoken_dlg.exec_() def delBlackToken(grantor): del_blacktoken_dlg = delBlackTokenDialog(grantor) del_blacktoken_dlg.exec_() def editBlackToken(grantor): edit_blacktoken_dlg = editBlackTokenDialog(grantor) edit_blacktoken_dlg.exec_() class newBlackTokenDialog(QDialog): def __init__(self, grantor): super(newBlackTokenDialog, self).__init__() self.setWindowTitle(u"添加黑令牌") width = 300 height = 300 self.setFixedSize(width,height) self.request = request self.grantor = grantor # obj[0] is id , obj[1] is name self.ownedObjects = request.getOwnedObjects(grantor)