Exemplo n.º 1
0
 def RetrieveDataVersionGid(**argd):
     """
     Restful API for getting data version of COrgan, ONLY USE BY NAME SERVICE.
     :param argd: request argument dictionary
     :return: dumped json string
     """
     checkSign = argd["nsid"] + "," + argd["renid"]
     token = EncryptUtil.DecodeURLSafeBase64(argd["token"])
     try:
         tokenRet = EncryptUtil.VerifySign(
             checkSign, token,
             GlobalConfigContext.AUTH_NameService_PublicKey)
     except:
         tokenRet = False
     if tokenRet is False:
         return CGateway._UnauthorizedServiceResponse(token)
     flag1, ret1 = CGateway.core.GetCurrentDataVersion(
         GlobalConfigContext.AUTH_INTERNAL_SESSION)
     flag2, ret2 = CGateway.core.GetOrganizationId(
         GlobalConfigContext.AUTH_INTERNAL_SESSION)
     xFlag = CGateway._HandleExceptionAndUnauthorized(
         flag1 & flag2, ret1, GlobalConfigContext.AUTH_INTERNAL_SESSION)
     if xFlag is not None:
         return xFlag
     return CGateway._DumpResponse("%s,%s" % (ret1, ret2))
Exemplo n.º 2
0
 def RetrieveAllEntity(**argd):
     """
     Restful API for getting all entities in the COrgan, ONLY USE BY NAME SERVICE.
     :param argd: request argument dictionary
     :return: dumped json string
     """
     checkSign = argd["nsid"] + "," + argd["renid"]
     token = EncryptUtil.DecodeURLSafeBase64(argd["token"])
     try:
         tokenRet = EncryptUtil.VerifySign(
             checkSign, token,
             GlobalConfigContext.AUTH_NameService_PublicKey)
     except:
         tokenRet = False
     if tokenRet is False:
         return CGateway._UnauthorizedServiceResponse(token)
     flag1, ret1 = CGateway.core.RetrieveAllHuman(
         GlobalConfigContext.AUTH_INTERNAL_SESSION)
     flag2, ret2 = CGateway.core.RetrieveAllAgent(
         GlobalConfigContext.AUTH_INTERNAL_SESSION)
     flag3, ret3 = CGateway.core.RetrieveAllGroup(
         GlobalConfigContext.AUTH_INTERNAL_SESSION)
     flag4, ret4 = CGateway.core.RetrieveAllPosition(
         GlobalConfigContext.AUTH_INTERNAL_SESSION)
     flag5, ret5 = CGateway.core.RetrieveAllCapabilities(
         GlobalConfigContext.AUTH_INTERNAL_SESSION)
     retDict = dict()
     retDict["human"] = ret1
     retDict["agent"] = ret2
     retDict["group"] = ret3
     retDict["position"] = ret4
     retDict["capability"] = ret5
     return CGateway._DumpResponse(retDict)
Exemplo n.º 3
0
 def RetrieveWorkerEntityByGid(**argd):
     """
     Restful API for getting a list of worker entity, ONLY USE BY NAME SERVICE.
     :param argd: request argument dictionary
     :return: dumped json string
     """
     checkSign = argd["nsid"] + "," + argd["renid"]
     token = EncryptUtil.DecodeURLSafeBase64(argd["token"])
     try:
         tokenRet = EncryptUtil.VerifySign(
             checkSign, token,
             GlobalConfigContext.AUTH_NameService_PublicKey)
     except:
         tokenRet = False
     if tokenRet is False:
         return CGateway._UnauthorizedServiceResponse(token)
     flag, ret = CGateway.core.RetrieveWorkersEntity(
         GlobalConfigContext.AUTH_INTERNAL_SESSION, argd["gids"])
     return CGateway._DumpResponse(ret)
Exemplo n.º 4
0
 def RetrieveWorkerInCapability(**argd):
     """
     Restful API for getting a set of workers that a specific capability contains, ONLY USE BY NAME SERVICE.
     :param argd: request argument dictionary
     :return: dumped json string
     """
     checkSign = argd["nsid"] + "," + argd["renid"]
     token = EncryptUtil.DecodeURLSafeBase64(argd["token"])
     try:
         tokenRet = EncryptUtil.VerifySign(
             checkSign, token,
             GlobalConfigContext.AUTH_NameService_PublicKey)
     except:
         tokenRet = False
     if tokenRet is False:
         return CGateway._UnauthorizedServiceResponse(token)
     flag1, ret1 = CGateway.core.RetrieveHumanWithCapability(
         GlobalConfigContext.AUTH_INTERNAL_SESSION, argd["capabilityName"])
     flag2, ret2 = CGateway.core.RetrieveAgentWithCapability(
         GlobalConfigContext.AUTH_INTERNAL_SESSION, argd["capabilityName"])
     return CGateway._DumpResponse(ret1 + ret2)
Exemplo n.º 5
0
 def RetrieveAllConnection(**argd):
     """
     Restful API for getting all connections in the COrgan, ONLY USE BY NAME SERVICE.
     :param argd: request argument dictionary
     :return: dumped json string
     """
     checkSign = argd["nsid"] + "," + argd["renid"]
     token = EncryptUtil.DecodeURLSafeBase64(argd["token"])
     try:
         tokenRet = EncryptUtil.VerifySign(
             checkSign, token,
             GlobalConfigContext.AUTH_NameService_PublicKey)
     except:
         tokenRet = False
     if tokenRet is False:
         return CGateway._UnauthorizedServiceResponse(token)
     flag, ret = CGateway.core.RetrieveAllConnection(
         GlobalConfigContext.AUTH_INTERNAL_SESSION)
     xFlag = CGateway._HandleExceptionAndUnauthorized(
         flag, ret, GlobalConfigContext.AUTH_INTERNAL_SESSION)
     if xFlag is not None:
         return xFlag
     return CGateway._DumpResponse(ret)