def GetSessionLevel(session): """ Get session level :param session: session id :return: session level value in int """ try: return True, SessionManager.GetSession(session).Level except Exception as e: print "Exception in WebUI: %s" % str(e) return False, e
def Unauthorized(session): """ Warp unauthorized service request feedback package. :param session: session id :return: unauthorized feedback """ try: sObj = SessionManager.GetSession(session) sUser = "" if sObj is not None: sUser = sObj.Username LogUtil.Log( "username:%s, session:%s unauthorized request." % (sUser, session), RenUIController.__name__, "Warning", True) except Exception as e: print "Exception in RenWebUI authorization check: %s" % str(e) finally: return GCC.UNAUTHORIZED