Beispiel #1
0
 def searchAct(self,req):
     result = []         
     
     for col in self.session.query(UserGroupInfo).\
         filter(UserGroupInfo.userGroupType!=GLBConfig.GTYPE_ADMINISTRATOR).\
         filter(UserGroupInfo.userGroupName!='administrator').\
         all():
         row = {}
         row = SysUtil.schema2Json(col)
         result.append(row)
     return result
Beispiel #2
0
 def searchAct(self, req):
     result = []
     for user, operator in self.session.query(User, OperatorInfo).\
         filter(User.userID==OperatorInfo.userID).\
         filter(User.accountType==GLBConfig.ATYPE_OPERATOR).\
         filter(User.dataStatus==GLBConfig.ENABLE).\
         order_by(User.makeTime.desc()).all():
         row = {}
         row = SysUtil.schema2Json(operator)
         row['userName'] = user.userName
         result.append(row)
     return result
Beispiel #3
0
 def addAct(self,req):
     doc = req.context['doc']
     rtn = {}
     userGroup = self.session.query(UserGroupInfo).filter_by(userGroupName=doc['userGroupName']).first()
     if userGroup is not None:
         self.errorReturn(GLBConfig.API_ERROR, '用户组已经存在')
     else:
         try:
             userGroup = UserGroupInfo(userGroupType = GLBConfig.GTYPE_OPERATORGROUP,
                                       userGroupName = doc['userGroupName'],
                                       userGroupStatus = GLBConfig.ENABLE)
             self.session.add(userGroup)
             self.session.commit()
             rtn = SysUtil.schema2Json(userGroup)
         except Exception as ex:
             self.logger.error(ex)
             self.session.rollback()
             self.errorReturn(GLBConfig.SYSTEM_ERROR, '系统错误')
     return rtn