예제 #1
0
    def getBWSnapShot(self, request):
        request.checkArgs("conds")
        conds = report_lib.fixConditionsDic(request["conds"])
        requester = request.getAuthNameObj()

        if request.hasAuthType(request.ADMIN):
            if not conds.has_key("user_id"):
                request.raiseIncompleteRequest("user_id")

            user_ids = MultiStr(conds["user_id"])
            loaded_users = user_main.getActionManager().getLoadedUsersByUserID(
                user_ids)

            for loaded_user in loaded_users:
                requester.canDo("SEE BW SNAPSHOTS", loaded_user)

            role = "admin"

        elif request.hasAuthType(request.NORMAL_USER) or request.hasAuthType(
                request.VOIP_USER):
            conds["user_id"] = str(request.getAuthNameObj().getUserID())
            role = "user"

        searcher = snapshot_searcher.SnapShotSearcher(conds, requester, role,
                                                      "bw")
        return searcher.getSnapShots()
예제 #2
0
    def getConnections(self, request):
        request.needAuthType(request.ADMIN, request.NORMAL_USER,
                             request.VOIP_USER)
        request.checkArgs("conds", "from", "to", "sort_by", "desc")
        requester = request.getAuthNameObj()
        conds = report_lib.fixConditionsDic(request["conds"])

        if request.hasAuthType(request.ADMIN):
            requester.canDo("SEE CONNECTION LOGS")
            role = "admin"
        elif request.hasAuthType(request.NORMAL_USER) or request.hasAuthType(
                request.VOIP_USER):
            conds["user_ids"] = str(requester.getUserID())
            role = "user"

        searcher = connection.ConnectionSearcher(conds, requester, role)

        connections = searcher.getConnectionLog(request["from"], request["to"],
                                                request["sort_by"],
                                                request["desc"],
                                                request.getDateType())

        if role == "user":
            connections = self.__filterConnectionsForUser(connections)

        return connections
예제 #3
0
    def getCreditChanges(self, request):
        request.needAuthType(request.ADMIN, request.NORMAL_USER,
                             request.VOIP_USER)
        request.checkArgs("conds", "from", "to", "sort_by", "desc")
        requester = request.getAuthNameObj()
        conds = report_lib.fixConditionsDic(request["conds"])

        if request.hasAuthType(request.ADMIN):
            requester.canDo("SEE CREDIT CHANGES")
            role = "admin"
        elif request.hasAuthType(request.NORMAL_USER) or request.hasAuthType(
                request.VOIP_USER):
            conds["user_ids"] = str(requester.getUserID())
            role = "user"

        searcher = credit.CreditSearcher(conds, requester, role)
        credit_changes = searcher.getCreditChanges(request["from"],
                                                   request["to"],
                                                   request["sort_by"],
                                                   request["desc"],
                                                   request.getDateType())

        if role == "user":
            credit_changes = self.__filterCreditChangesForUser(credit_changes)

        return credit_changes
예제 #4
0
    def getOnlineUsers(self, request):
        request.needAuthType(request.ADMIN)
        request.checkArgs("normal_sort_by", "normal_desc", "voip_sort_by",
                          "voip_desc", "conds")
        requester = request.getAuthNameObj()
        if requester.hasPerm("SEE ONLINE USERS"):
            admin_perm_obj = requester.getPerms()["SEE ONLINE USERS"]
        elif requester.isGod():
            admin_perm_obj = None
        else:
            raise GeneralException(errorText("GENERAL", "ACCESS_DENIED"))

        filter_manager = onlines_filter.createFilterManager(
            report_lib.fixConditionsDic(request["conds"]))

        normal_onlines, voip_onlines = online.getFormattedOnlineUsers(
            request.getDateType(), filter_manager)
        normal_onlines, voip_onlines = online.sortOnlineUsers(
            normal_onlines, voip_onlines,
            (request["normal_sort_by"], request["normal_desc"]),
            (request["voip_sort_by"], request["voip_desc"]))

        if admin_perm_obj != None and admin_perm_obj.isRestricted():
            normal_onlines = filter(
                lambda online_dic: online_dic["owner_id"] == requester.
                getAdminID(), normal_onlines)
            voip_onlines = filter(
                lambda online_dic: online_dic["owner_id"] == requester.
                getAdminID(), voip_onlines)

        return (normal_onlines, voip_onlines)
예제 #5
0
    def getConnections(self,request):
	request.needAuthType(request.ADMIN)
	request.checkArgs("conds","from","to","sort_by","desc")
	requester=request.getAuthNameObj()
	requester.canDo("SEE CONNECTION LOGS")
	conds=report_lib.fixConditionsDic(request["conds"])
	searcher=connection.ConnectionSearcher(conds,requester)
	return searcher.getConnectionLog(request["from"],request["to"],request["sort_by"],request["desc"],request.getDateType())
예제 #6
0
    def getCreditChanges(self,request):
	request.needAuthType(request.ADMIN)
	request.checkArgs("conds","from","to","sort_by","desc")
	requester=request.getAuthNameObj()
	requester.canDo("SEE CREDIT CHANGES")
	conds=report_lib.fixConditionsDic(request["conds"])
	searcher=credit.CreditSearcher(conds,requester)
	return searcher.getCreditChanges(request["from"],request["to"],request["sort_by"],request["desc"],request.getDateType())
예제 #7
0
    def getOnlinesSnapShot(self, request):
        request.needAuthType(request.ADMIN)
        request.checkArgs("conds", "type")
        requester = request.getAuthNameObj()
        requester.canDo("SEE ONLINE SNAPSHOTS")

        conds = report_lib.fixConditionsDic(request["conds"])

        searcher = snapshot_searcher.SnapShotSearcher(conds, requester,
                                                      "admin", request["type"])
        return searcher.getSnapShots()
예제 #8
0
    def getTopVisited(self, request):
        request.needAuthType(request.ADMIN)
        request.checkArgs("conds", "from", "to")
        requester = request.getAuthNameObj()
        conds = report_lib.fixConditionsDic(request["conds"])

        requester.canDo("SEE WEB ANALYZER LOGS")
        role = "admin"

        searcher = web_analyzer_report.WebAnalyzerSearcher(
            conds, requester, role)
        return searcher.getTopVisited(request["from"], request["to"],
                                      request.getDateType())
예제 #9
0
    def getUserMessages(self, request):
        request.needAuthType(request.VOIP_USER, request.NORMAL_USER)
        request.checkArgs("conds", "from", "to", "sort_by", "desc")
        requester = request.getAuthNameObj()
        conds = report_lib.fixConditionsDic(request["conds"])

        searcher = message_searcher.MessageSearcher(conds, requester, "user",
                                                    "user_messages")
        messages = searcher.getMessages(request["from"], request["to"],
                                        request["sort_by"], request["desc"],
                                        request.getDateType())

        return messages
예제 #10
0
    def __adminConnectionReport(self, request, method_name):
        """
            handle admin connection report. check conds in request
            and call n return method_name of searcher and if everything was ok
        """
        request.needAuthType(request.ADMIN)
        request.checkArgs("conds")
        requester = request.getAuthNameObj()
        conds = report_lib.fixConditionsDic(request["conds"])
        requester.canDo("SEE CONNECTION LOGS")
        role = "admin"

        searcher = connection.ConnectionSearcher(conds, requester, role)
        return apply(getattr(searcher, method_name), [])
예제 #11
0
    def __connectionUsageHandler(self, request, searcher_method):
        request.needAuthType(request.ADMIN)
        request.checkArgs("conds", "from", "to")
        requester = request.getAuthNameObj()
        conds = report_lib.fixConditionsDic(request["conds"])

        requester.canDo("SEE CONNECTION LOGS")
        role = "admin"

        searcher = connection_usage.ConnectionUsageSearcher(
            conds, requester, role)

        result = getattr(searcher, searcher_method)(request["from"],
                                                    request["to"])

        return result
예제 #12
0
    def getDurations(self, request):
        request.needAuthType(request.ADMIN, request.NORMAL_USER,
                             request.VOIP_USER)
        request.checkArgs("conds")
        requester = request.getAuthNameObj()
        conds = report_lib.fixConditionsDic(request["conds"])

        if request.hasAuthType(request.ADMIN):
            requester.canDo("SEE CONNECTION LOGS")
            role = "admin"
        elif request.hasAuthType(request.NORMAL_USER) or request.hasAuthType(
                request.VOIP_USER):
            conds["user_ids"] = str(requester.getUserID())
            role = "user"

        searcher = connection.ConnectionSearcher(conds, requester, role)

        return searcher.getDurations()
예제 #13
0
    def getAdminMessages(self, request):
        request.needAuthType(request.ADMIN)
        request.checkArgs("conds", "from", "to", "sort_by", "desc")
        requester = request.getAuthNameObj()

        requester.canDo("VIEW MESSAGES")

        conds = report_lib.fixConditionsDic(request["conds"])
        if conds.has_key("table") and conds["table"] == "user":
            table = "user_messages"
        else:
            table = "admin_messages"
        searcher = message_searcher.MessageSearcher(conds, requester, "admin",
                                                    table)
        messages = searcher.getMessages(request["from"], request["to"],
                                        request["sort_by"], request["desc"],
                                        request.getDateType())

        return messages
예제 #14
0
    def getWebAnalyzerLogs(self, request):
        request.needAuthType(request.ADMIN)
        request.checkArgs("conds", "from", "to", "sort_by", "desc")
        requester = request.getAuthNameObj()
        conds = report_lib.fixConditionsDic(request["conds"])

        requester.canDo("SEE WEB ANALYZER LOGS")
        role = "admin"

        searcher = web_analyzer_report.WebAnalyzerSearcher(
            conds, requester, role)
        totals, report = searcher.getWebAnalyzerLogs(request["from"],
                                                     request["to"],
                                                     request["sort_by"],
                                                     request["desc"],
                                                     request.getDateType())

        totals = self.__convTotalsToFloat(totals)

        return (totals, report)
예제 #15
0
    def getAdminDepositChangeLogs(self, request):
        """
            return admin change deposit logs
        """
        request.needAuthType(request.ADMIN)
        request.checkArgs("conds", "from", "to", "sort_by", "desc")
        requester = request.getAuthNameObj()

        conds = report_lib.fixConditionsDic(request["conds"])

        requester.canDo("CHANGE ADMIN DEPOSIT")
        role = "admin"

        searcher = admin_deposit_change_log.AdminDepositChangeLogsSearcher(
            conds, requester, role)
        audit_log_report = searcher.getAdminDepositChangeLogs(
            request["from"], request["to"], request["sort_by"],
            request["desc"], request.getDateType())

        return audit_log_report
예제 #16
0
    def getUserAuditLogs(self, request):
        """
            return user audit logs, based on request["conds"] conditions
            return value is a dic in format {"total_rows":,"report":[]}
        """
        request.needAuthType(request.ADMIN)
        request.checkArgs("conds", "from", "to", "sort_by", "desc")
        requester = request.getAuthNameObj()
        conds = report_lib.fixConditionsDic(request["conds"])

        requester.canDo("SEE USER AUDIT LOGS")
        role = "admin"

        searcher = audit_log.UserAuditLogSearcher(conds, requester, role)
        audit_log_report = searcher.getUserAuditLogs(request["from"],
                                                     request["to"],
                                                     request["sort_by"],
                                                     request["desc"],
                                                     request.getDateType())

        return audit_log_report
예제 #17
0
    def __searchUserFixConds(self,conds):
	"""
	    convert integer key dictionaries to lists. It takes care of other dics so it won't convert 
	    other dics
	"""
	return report_lib.fixConditionsDic(conds)
예제 #18
0
 def __searchUserFixConds(self, conds):
     """
         convert integer key dictionaries to lists. It takes care of other dics so it won't convert 
         other dics
     """
     return report_lib.fixConditionsDic(conds)