Ejemplo n.º 1
0
    def changeInit(self, ips):
        ip_list = map(lambda ip: ip.strip(), MultiStr(ips))

        for ip in ip_list:
            if not iplib.checkIPAddr(ip):
                raise GeneralException(
                    errorText("GENERAL", "INVALID_IP_ADDRESS") % ip)

        self.useGenerateQuery({"limit_station_ip": ",".join(ip_list)})
Ejemplo n.º 2
0
    def __changeDepositCheckInput(self,changer_admin_name,admin_name,deposit_change,comment,remote_addr):
	self.__getAdminLoader().checkAdminName(changer_admin_name)
	self.__getAdminLoader().checkAdminName(admin_name)
	
	if not isFloat(deposit_change):
	    raise GeneralException(errorText("ADMIN","DEPOSIT_SHOULD_BE_FLOAT"))
	
	if not iplib.checkIPAddr(remote_addr):
	    raise GeneralException(errorText("GENERAL","INVALID_IP_ADDRESS")%remote_addr)
Ejemplo n.º 3
0
 def __delUserCheckInput(self, user_ids, comment, del_connections,
                         del_audit_logs, admin_name, remote_address):
     admin_main.getLoader().checkAdminName(admin_name)
     if not iplib.checkIPAddr(remote_address):
         raise GeneralException(
             errorText("GENERAL", "INVALID_IP_ADDRESS") % remote_address)
     if len(user_ids) == 0:
         raise GeneralException(
             errorText("USER_ACTIONS", "INVALID_USER_COUNT") % 0)
Ejemplo n.º 4
0
    def __changeDepositCheckInput(self, changer_admin_name, admin_name,
                                  deposit_change, comment, remote_addr):
        self.__getAdminLoader().checkAdminName(changer_admin_name)
        self.__getAdminLoader().checkAdminName(admin_name)

        if not isFloat(deposit_change):
            raise GeneralException(
                errorText("ADMIN", "DEPOSIT_SHOULD_BE_FLOAT"))

        if not iplib.checkIPAddr(remote_addr):
            raise GeneralException(
                errorText("GENERAL", "INVALID_IP_ADDRESS") % remote_addr)
Ejemplo n.º 5
0
    def __changeCreditCheckInput(self,user_ids,credit,changer_admin_name,remote_address,credit_change_comment,loaded_users):
	if not isFloat(credit):
	    raise GeneralException(errorText("USER_ACTIONS","CREDIT_NOT_FLOAT"))

	admin_main.getLoader().checkAdminName(changer_admin_name)

	if not iplib.checkIPAddr(remote_address):
	    raise GeneralException(errorText("GENERAL","INVALID_IP_ADDRESS")%remote_address)

	if len(user_ids)==0:
	    raise GeneralException(errorText("USER_ACTIONS","INVALID_USER_COUNT")%0)

	for loaded_user in loaded_users:
	    if credit<0 and loaded_user.getBasicUser().getCredit()+credit<0:
		raise GeneralException(errorText("USER_ACTIONS","CAN_NOT_NEGATE_CREDIT")%(loaded_user.getUserID(),loaded_user.getBasicUser().getCredit()))
Ejemplo n.º 6
0
    def __changeCreditCheckInput(self, user_ids, credit, changer_admin_name,
                                 remote_address, credit_change_comment,
                                 loaded_users):
        if not isFloat(credit):
            raise GeneralException(
                errorText("USER_ACTIONS", "CREDIT_NOT_FLOAT"))

        admin_main.getLoader().checkAdminName(changer_admin_name)

        if not iplib.checkIPAddr(remote_address):
            raise GeneralException(
                errorText("GENERAL", "INVALID_IP_ADDRESS") % remote_address)

        if len(user_ids) == 0:
            raise GeneralException(
                errorText("USER_ACTIONS", "INVALID_USER_COUNT") % 0)

        for loaded_user in loaded_users:
            if credit < 0 and loaded_user.getBasicUser().getCredit(
            ) + credit < 0:
                raise GeneralException(
                    errorText("USER_ACTIONS", "CAN_NOT_NEGATE_CREDIT") %
                    (loaded_user.getUserID(),
                     loaded_user.getBasicUser().getCredit()))
Ejemplo n.º 7
0
    def __delUserCheckInput(self,user_ids,comment,del_connections,admin_name,remote_address):
	admin_main.getLoader().checkAdminName(admin_name)
	if not iplib.checkIPAddr(remote_address):
	    raise GeneralException(errorText("GENERAL","INVALID_IP_ADDRESS")%remote_addr)
	if len(user_ids)==0:
	    raise GeneralException(errorText("USER_ACTIONS","INVALID_USER_COUNT")%0)
Ejemplo n.º 8
0
 def __bwStaticIPCheckIP(self, ip_addr):
     if not iplib.checkIPAddr(ip_addr):
         raise GeneralException(
             errorText("GENERAL", "INVALID_IP_ADDRESS") % ip_addr)
     self.__checkIPAddrExistence(ip_addr)
Ejemplo n.º 9
0
 def __checkIP(self):
     for ip in self.ip:
         if not iplib.checkIPAddr(ip):
             raise GeneralException(errorText("GENERAL","INVALID_IP_ADDRESS")%ip)
Ejemplo n.º 10
0
    def __bwStaticIPCheckIP(self,ip_addr):
	if not iplib.checkIPAddr(ip_addr):
	    raise GeneralException(errorText("GENERAL","INVALID_IP_ADDRESS")%ip_addr)
	self.__checkIPAddrExistence(ip_addr)
Ejemplo n.º 11
0
 def __checkIP(self):
     for ip in self.ip:
         if not iplib.checkIPAddr(ip):
             raise GeneralException(errorText("GENERAL", "INVALID_IP_ADDRESS") % ip)
Ejemplo n.º 12
0
 def checkNewValue(self, new_val):
     if not iplib.checkIPAddr(new_val):
         self.newValueException(
             errorText("GENERAL", "INVALID_IP_ADDRESS", 0) % new_val)
Ejemplo n.º 13
0
    def checkNewValue(self,new_val):
	if not iplib.checkIPAddr(new_val):
	    self.newValueException(errorText("GENERAL","INVALID_IP_ADDRESS",0)%new_val)