Exemplo n.º 1
0
    def _changeUserAttr(self, ibs_query, attrs, users, admin_obj):
        for user_id in users:
            user = users[user_id]
            for attr_name in attrs:
                if user.userHasAttr(attr_name):
                    ibs_query += user_main.getActionManager(
                    ).updateUserAttrQuery(user.getUserID(), attr_name,
                                          attrs[attr_name])

                else:
                    ibs_query += user_main.getActionManager(
                    ).insertUserAttrQuery(user.getUserID(), attr_name,
                                          attrs[attr_name])

                if self.__generate_query_audit_log:
                    if user.hasAttr(attr_name):
                        old_value = user.getUserAttrs()[attr_name]
                    else:
                        old_value = self.AUDIT_LOG_NOVALUE

                    self.genQueryAuditLogQuery(ibs_query, attr_name, old_value,
                                               attrs[attr_name], True, user,
                                               admin_obj)

        return ibs_query
Exemplo n.º 2
0
    def getUserInfo(self,request):
	"""
	    return user information in a list of dics in format
	    [{"basic_info":{basic_user_info},"attrs":{user_attributes}},{"basic_info":{basic_user_info},"attrs":{user_attributes}},...]
	    if requester is admin, he can specify user_id or normal_username, user_id or normal_username can be multi strings
	    if requirter is user, no argument will be parsed and auth_name is used
	"""
	if request.hasAuthType(request.ADMIN):
	    if request.has_key("user_id"):
		loaded_users=user_main.getActionManager().getLoadedUsersByUserID(MultiStr(request["user_id"]))
	    elif request.has_key("normal_username"):
		loaded_users=user_main.getActionManager().getLoadedUsersByNormalUsername(MultiStr(request["normal_username"]))
	    elif request.has_key("voip_username"):
		loaded_users=user_main.getActionManager().getLoadedUsersByVoIPUsername(MultiStr(request["voip_username"]))
	    else:
		raise request.raiseIncompleteRequest("user_id")

	    admin_obj=request.getAuthNameObj()
	    map(admin_obj.canAccessUser,loaded_users)
	    
	elif request.hasAuthType(request.NORMAL_USER):
	    loaded_users=[request.getAuthNameObj()]
	else:
	    raise request.raiseIncompleteRequest("auth_type")
	
	return user_main.getActionManager().getUserInfosFromLoadedUsers(loaded_users,request.getDateType())
Exemplo n.º 3
0
 def changePassword(self, user_id, password):
     """
         user_id(int): should be valid user id
         password(str): new voip password of user
     """
     password = Password(password)
     self.__changePasswordCheckInput(password)
     self.__updatePasswordDB(user_id, password.getPassword())
     user_main.getActionManager().broadcastChange([user_id])
Exemplo n.º 4
0
    def __changeUserAttr(self,ibs_query,attrs,users):
	for user_id in users:
	    user=users[user_id]
	    for attr_name in attrs:
		if user.userHasAttr(attr_name):
		    ibs_query+=user_main.getActionManager().updateUserAttrQuery(user.getUserID(),attr_name,attrs[attr_name])
		else:
		    ibs_query+=user_main.getActionManager().insertUserAttrQuery(user.getUserID(),attr_name,attrs[attr_name])
	return ibs_query
Exemplo n.º 5
0
    def getIASUserInfo(self, request):
        request.needAuthType(request.ADMIN)
        requester_obj = request.getAuthNameObj()
        requester_obj.canDo("HANDLE IAS EVENTS")
        request.checkArgs("user_ids")

        loaded_users = user_main.getActionManager().getLoadedUsersByUserID(
            request.fixList("user_ids"))

        user_infos = user_main.getActionManager().getUserInfosFromLoadedUsers(
            loaded_users, request.getDateType())

        return self.__filterUserInfos(user_infos)
Exemplo n.º 6
0
    def addNewUsers(self, request):
        """
            Add "count" number of raw users. Created users has no attribute assigned to them.
            Later you should assign attribute by updateUserAttrs
            
            return a list of created user_id s
        """
        request.needAuthType(request.ADMIN)
        request.checkArgs("count", "credit", "owner_name", "group_name",
                          "credit_comment")
        requester = request.getAuthNameObj()
        requester.canDo("ADD NEW USER")
        if request["owner_name"] != requester.getUsername():
            requester.canDo("CHANGE USERS OWNER")
        try:
            _count = int(request["count"])
        except ValueError:
            raise GeneralException(
                errorText("USER_ACTIONS", "COUNT_NOT_INTEGER"))

        try:
            credit = float(request["credit"])
        except ValueError:
            raise GeneralException(
                errorText("USER_ACTIONS", "CREDIT_NOT_FLOAT"))

        return user_main.getActionManager().addNewUsers(
            _count, credit, request["owner_name"],
            requester.getUsername(), request["group_name"],
            request.getRemoteAddr(), request["credit_comment"])
Exemplo n.º 7
0
 def __checkPoolUsageInUsers(self, ippool_obj):
     user_ids = user_main.getActionManager().getUserIDsWithAttr(
         "ippool", ippool_obj.getIPpoolID())
     if len(user_ids) > 0:
         raise GeneralException(
             errorText("IPPOOL", "IPPOOL_USED_IN_USER") %
             ",".join(map(str, user_ids)))
Exemplo n.º 8
0
 def __checkChargeUsageInUsers(self, charge_obj, attr_name):
     user_ids = user_main.getActionManager().getUserIDsWithAttr(
         attr_name, charge_obj.getChargeID())
     if len(user_ids) > 0:
         raise GeneralException(
             errorText("CHARGES", "CHARGE_USED_IN_USER") %
             (charge_obj.getChargeName(), ",".join(map(str, user_ids))))
Exemplo n.º 9
0
    def __addAllToWaitings(self):
	"""
	    ask for users who use this ras as persistent lan, and add em to waiting list
	"""	
	users=user_main.getActionManager().getPersistentLanUsers(self.getRasID())
	for user_dic in users:
	    self.__addToWaitings(user_dic["user_id"],user_dic["persistent_lan_mac"].upper(),user_dic["persistent_lan_ip"])
Exemplo n.º 10
0
    def delUser(self,request):
	"""
	    delete users
	"""
	request.needAuthType(request.ADMIN)
	request.checkArgs("user_id","delete_comment","del_connection_logs")
	requester=request.getAuthNameObj()
	user_id_multi=MultiStr(request["user_id"])
	loaded_users=user_main.getActionManager().getLoadedUsersByUserID(user_id_multi)
	map(self.__canDeleteUser,loaded_users,itertools.repeat(requester,len(loaded_users)))
	return user_main.getActionManager().delUser(user_id_multi,
						    request["delete_comment"],
						    request["del_connection_logs"],
						    requester.getUsername(),
						    request.getRemoteAddr()
						    )
Exemplo n.º 11
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()
Exemplo n.º 12
0
 def commit(self):
     query = ""
     if self.__commit_first_login:
         query += user_main.getActionManager().insertUserAttrQuery(
             self.user_obj.getUserID(), "first_login", self.__first_login)
         self.__commit_first_login = False
     return query
Exemplo n.º 13
0
    def changeCredit(self,request):
	"""
	    change credit of user
	"""
	request.needAuthType(request.ADMIN)
	request.checkArgs("user_id","credit","credit_comment")
	requester=request.getAuthNameObj()
	user_id_multi=MultiStr(request["user_id"])
	loaded_users=user_main.getActionManager().getLoadedUsersByUserID(user_id_multi)
	map(self.__canChangeCredit,loaded_users,itertools.repeat(requester,len(loaded_users)))
	return user_main.getActionManager().changeCredit(user_id_multi,
							 to_float(request["credit"],"credit"),
							 requester.getUsername(),
							 request.getRemoteAddr(),
							 request["credit_comment"],
							 loaded_users)
Exemplo n.º 14
0
 def changeCredit(self, request):
     """
         change credit of user
     """
     request.needAuthType(request.ADMIN)
     request.checkArgs("user_id", "credit", "credit_comment")
     requester = request.getAuthNameObj()
     user_id_multi = MultiStr(request["user_id"])
     loaded_users = user_main.getActionManager().getLoadedUsersByUserID(
         user_id_multi)
     map(self.__canChangeCredit, loaded_users,
         itertools.repeat(requester, len(loaded_users)))
     return user_main.getActionManager().changeCredit(
         user_id_multi, to_float(request["credit"], "credit"),
         requester.getUsername(), request.getRemoteAddr(),
         request["credit_comment"], loaded_users)
Exemplo n.º 15
0
 def __checkGroupUsageInUsers(self, group_obj):
     user_ids = user_main.getActionManager().getUserIDsWithBasicAttr(
         "group_id", group_obj.getGroupID())
     if len(user_ids) > 0:
         raise GeneralException(
             errorText("GROUPS", "GROUP_USED_IN_USER") %
             (group_obj.getGroupName(), ",".join(map(str, user_ids))))
Exemplo n.º 16
0
 def delUser(self, request):
     """
         delete users
     """
     request.needAuthType(request.ADMIN)
     request.checkArgs("user_id", "delete_comment", "del_connection_logs",
                       "del_audit_logs")
     requester = request.getAuthNameObj()
     user_id_multi = MultiStr(request["user_id"])
     loaded_users = user_main.getActionManager().getLoadedUsersByUserID(
         user_id_multi)
     map(self.__canDeleteUser, loaded_users,
         itertools.repeat(requester, len(loaded_users)))
     return user_main.getActionManager().delUser(
         user_id_multi, request["delete_comment"],
         request["del_connection_logs"], request["del_audit_logs"],
         requester.getUsername(), request.getRemoteAddr())
Exemplo n.º 17
0
    def changePassword(self, request):
        request.needAuthType(request.ADMIN, request.NORMAL_USER)

        if request.hasAuthType(request.ADMIN):
            loaded_user = user_main.getUserPool().getUserByNormalUsername(
                request["normal_username"])
            request.getAuthNameObj().canChangeNormalAttrs(loaded_user)
            user_id = loaded_user.getUserID()
        else:
            user_id = request.getAuthNameObj().getUserID()
            self.__checkOldPassword(request.getAuthNameObj(),
                                    request["old_password"])

        password = Password(request["password"])

        self.__changePasswordCheckInput(password)
        self.__updatePasswordDB(user_id, password.getPassword())
        user_main.getActionManager().broadcastChange([user_id])
Exemplo n.º 18
0
    def __deleteUserAttr(self,ibs_query,attrs,users):
	for user_id in users:
	    user=users[user_id]	
	    for attr_name in attrs:
		    ibs_query+=user_main.getActionManager().deleteUserAttrQuery(user.getUserID(),attr_name)
	return ibs_query
	

	
Exemplo n.º 19
0
    def commit(self):
	query=""
	if self.commit_first_login:
	    query+=user_main.getActionManager().insertUserAttrQuery(self.user_obj.getUserID(),
								    "first_login",
								    self.first_login
								    )
	    self.commit_first_login=False
	return query
Exemplo n.º 20
0
 def __addUsernameRepr(self, report):
     fixed_report = []
     
     for user_id, value in report:
         fixed_report.append([user_id,
                              user_main.getActionManager().getUsernameReprForUserID(user_id),
                              value])
     
     return fixed_report
Exemplo n.º 21
0
    def updateUserAttrs(self, request):
        """
            update user attributes
            
            user_id(string): user ids that should be updated, can be multi strings
            attrs(dic): dictionary of attr_name:attr_value. We say we want attr_name value to be attr_value
            to_del_attrs(dic): dic of attributes that should be deleted 
        """
        request.needAuthType(request.ADMIN)
        request.checkArgs("user_id", "attrs", "to_del_attrs")
        loaded_users = user_main.getActionManager().getLoadedUsersByUserID(
            MultiStr(request["user_id"]))
        admin_obj = request.getAuthNameObj()
        map(admin_obj.canChangeUser, loaded_users)

        to_del_attrs = requestDicToList(request["to_del_attrs"])
        return user_main.getActionManager().updateUserAttrs(
            loaded_users, request.getAuthNameObj(), request["attrs"],
            to_del_attrs)
Exemplo n.º 22
0
    def getUserInfo(self, request):
        """
            return user information in a list of dics in format
            [{"basic_info":{basic_user_info},"attrs":{user_attributes}},{"basic_info":{basic_user_info},"attrs":{user_attributes}},...]
            basic_user_info and user_attributes are dictionaries contain name=>values

            if requester is admin, he can specify user_id or normal_username or voip_username. All can be multistrings
            if requirter is user, no argument will be parsed and auth_name is used
        """
        if request.hasAuthType(request.ADMIN):
            if request.has_key("user_id"):
                loaded_users = user_main.getActionManager(
                ).getLoadedUsersByUserID(MultiStr(request["user_id"]))
            elif request.has_key("normal_username"):
                loaded_users = user_main.getActionManager(
                ).getLoadedUsersByNormalUsername(
                    MultiStr(request["normal_username"]))
            elif request.has_key("voip_username"):
                loaded_users = user_main.getActionManager(
                ).getLoadedUsersByVoIPUsername(
                    MultiStr(request["voip_username"]))
            else:
                raise request.raiseIncompleteRequest("user_id")

            admin_obj = request.getAuthNameObj()
            map(admin_obj.canAccessUser, loaded_users)

        elif request.hasAuthType(request.NORMAL_USER) or request.hasAuthType(
                request.VOIP_USER):
            loaded_users = [request.getAuthNameObj()]
        else:
            raise request.raiseIncompleteRequest("auth_type")

        user_infos = user_main.getActionManager().getUserInfosFromLoadedUsers(
            loaded_users, request.getDateType())

        if request.hasAuthType(request.NORMAL_USER) or request.hasAuthType(
                request.VOIP_USER):
            user_info = self.__filterAttrsForUser(user_infos.values()[0])
            return self.__addGroupAttrsForUser(user_info,
                                               request.getDateType())

        return user_infos
Exemplo n.º 23
0
    def addDestinationToFastDial(self, voip_username, destination, _index):
        """
            add "destination" to fast dial _index of "voip_username"
        """
        self.__addDestinationToFastDialCheckInput(voip_username, destination,
                                                  _index)
        loaded_user = user_main.getUserPool().getUserByVoIPUsername(
            voip_username)
        if loaded_user.userHasAttr("fast_dial"):
            fast_dials = loaded_user.getUserAttrs()["fast_dial"].split(",")
        else:
            fast_dials = ['' for i in range(10)]

        fast_dials[_index] = destination

        user_main.getActionManager().updateUserAttrs(
            [loaded_user],
            admin_main.getLoader().getAdminByName("system"),
            {"fast_dial": fast_dials}, [])
Exemplo n.º 24
0
 def __addAllToWaitings(self):
     """
         ask for users who use this ras as persistent lan, and add em to waiting list
     """
     users = user_main.getActionManager().getPersistentLanUsers(
         self.getRasID())
     for user_dic in users:
         self.__addToWaitings(user_dic["user_id"],
                              user_dic["persistent_lan_mac"].upper(),
                              user_dic["persistent_lan_ip"])
Exemplo n.º 25
0
    def updateUserAttrs(self,request):
	"""
	    update user attributes
	    
	    user_id(string): user ids that should be updated, can be multi strings
	    attrs(dic): dictionary of attr_name:attr_value. We say we want attr_name value to be attr_value
	    to_del_attrs(dic): dic of attributes that should be deleted 
	"""
	request.needAuthType(request.ADMIN)
	request.checkArgs("user_id","attrs","to_del_attrs")
	loaded_users=user_main.getActionManager().getLoadedUsersByUserID(MultiStr(request["user_id"]))
	admin_obj=request.getAuthNameObj()
        map(admin_obj.canChangeUser,loaded_users)

	to_del_attrs=requestDicToList(request["to_del_attrs"])
	return user_main.getActionManager().updateUserAttrs(loaded_users,
							    request.getAuthNameObj(),
							    request["attrs"],
							    to_del_attrs
							    )
Exemplo n.º 26
0
    def __createReportResult(self, result, date_type):
        for row in result:
            row["change_time_formatted"] = AbsDate(
                row["change_time"], "gregorian").getDate(date_type)
            row["admin_name"] = admin_main.getLoader().getAdminByID(
                row["admin_id"]).getUsername()
            if row["is_user"] == "t":
                row["username"] = user_main.getActionManager(
                ).getUsernameReprForUserID(row["object_id"])
            else:
                row["group_name"] = group_main.getLoader().getGroupByID(
                    row["object_id"]).getGroupName()

        return result
Exemplo n.º 27
0
 def deleteCallerIDAuthentication(self, request):
     """
         remove caller id of user in voip caller id attribute
         
         username(str): pin number of user
         caller_id(str): caller_id to be added to voip caller ids
     """
     self.__checkAsteriskAuth(request)
     request.checkArgs("username", "caller_id")
     try:
         return user_main.getActionManager().deleteCallerIDAuthentication(
             request["username"], request["caller_id"])
     except IBSError, e:
         raise IBSError(e.getErrorKey())
Exemplo n.º 28
0
    def killUser(self,request):
	request.needAuthType(request.ADMIN)
	request.checkArgs("user_id","ras_ip","unique_id_val","kill")
	requester=request.getAuthNameObj()
	user_id=to_int(request["user_id"],"user_id")
	loaded_user=user_main.getUserPool().getUserByID(user_id)
	if request["kill"]:
	    self.__canKillUser(loaded_user,requester)
	else:
	    self.__canClearUser(loaded_user,requester)
	return user_main.getActionManager().killUser(user_id,
						     request["ras_ip"],
						     request["unique_id_val"],
						     request["kill"],requester.getUsername())
Exemplo n.º 29
0
    def killUser(self, request):
        request.needAuthType(request.ADMIN)
        request.checkArgs("user_id", "ras_ip", "unique_id_val", "kill")
        requester = request.getAuthNameObj()
        loaded_users = user_main.getActionManager().getLoadedUsersByUserID(
            MultiStr(request["user_id"]), True)
        if request["kill"]:
            map(lambda loaded_user: self.__canKillUser(loaded_user, requester),
                loaded_users)
        else:
            map(
                lambda loaded_user: self.__canClearUser(
                    loaded_user, requester), loaded_users)

        ras_ips = MultiStr(request["ras_ip"])
        unique_id_vals = MultiStr(request["unique_id_val"])

        for i in xrange(len(loaded_users)):
            user_main.getActionManager().killUser(loaded_users[i].getUserID(),
                                                  ras_ips[i],
                                                  unique_id_vals[i],
                                                  request["kill"],
                                                  requester.getUsername())
Exemplo n.º 30
0
    def __createReportResult(self, result, date_type):
        requester_is_admin = self.isRequesterAdmin()
        for row in result:
            row["post_date_formatted"] = AbsDate(
                row["post_date"], "gregorian").getDate(date_type)
            if row["user_id"] == None:
                row["user_id"] = "ALL USERS"
                if requester_is_admin:
                    row["username_text"] = "ALL USERS"

            elif requester_is_admin:
                row["username_text"] = user_main.getActionManager(
                ).getUsernameReprForUserID(row["user_id"])

        return result
Exemplo n.º 31
0
 def getLastDestination(self, request):
     """
         get last destination dialed by user
         return string of last destination or empty string if
         there's no last number
         
         username(str): pin number of user
     """
     self.__checkAsteriskAuth(request)
     request.checkArgs("username")
     try:
         return user_main.getActionManager().getLastDestination(
             request["username"])
     except IBSError, e:
         raise IBSError(e.getErrorKey())
Exemplo n.º 32
0
    def _deleteUserAttr(self, ibs_query, attrs, users, admin_obj):
        for user_id in users:
            user = users[user_id]
            for attr_name in attrs:
                if user.userHasAttr(attr_name):
                    ibs_query += user_main.getActionManager(
                    ).deleteUserAttrQuery(user.getUserID(), attr_name)
                    old_value = user.getUserAttrs()[attr_name]

                    if self.__generate_query_audit_log:
                        self.genQueryAuditLogQuery(ibs_query, attr_name,
                                                   old_value,
                                                   self.AUDIT_LOG_NOVALUE,
                                                   True, user, admin_obj)

        return ibs_query
Exemplo n.º 33
0
 def __createInOutUsageReportList(self, in_usages, out_usages):
     """
         merge in_usages and out_usages and return a list in format [[user_id, user_repr, in_usage, out_usage],..]
     """
     out_usage_dic = {}
     for user_id, out_usage in out_usages:
         out_usage_dic[user_id] = out_usage
     
     inout_usage = []
     for user_id, in_usage in in_usages:
         inout_usage.append([user_id, 
                             user_main.getActionManager().getUsernameReprForUserID(user_id),
                             in_usage, 
                             out_usage_dic[user_id]])
     
     return inout_usage
Exemplo n.º 34
0
    def calcApproxDuration(self, request):
        if request.hasAuthType(request.ADMIN):
            request.checkArgs("user_id")
            loaded_user = user_main.getUserPool().getUserByID(
                request["user_id"])

            admin_obj = request.getAuthNameObj()
            admin_obj.canAccessUser(loaded_user)

        elif request.hasAuthType(request.NORMAL_USER) or request.hasAuthType(
                request.VOIP_USER):
            loaded_user = request.getAuthNameObj()
        else:
            raise request.raiseIncompleteRequest("auth_type")

        return user_main.getActionManager().calcApproxDuration(loaded_user)
Exemplo n.º 35
0
    def searchUser(self,request):
	"""
	    return (count_of_result,user_id_lists)
	"""
	request.needAuthType(request.ADMIN)
	request.checkArgs("conds","from","to","order_by","desc")
	admin_obj=request.getAuthNameObj()
	conds=self.__searchUserFixConds(request["conds"])

	if admin_obj.isGod(): pass
	elif admin_obj.hasPerm("GET USER INFORMATION"):
	    if admin_obj.getPerms()["GET USER INFORMATION"].isRestricted():
		conds["owner_name"]=[admin_obj.getAdminID()]
	else:
	    raise PermissionException(errorText("GENERAL","ACCESS_DENIED"))
		
	return user_main.getActionManager().searchUsers(conds,request["from"],request["to"],request["order_by"],request["desc"],admin_obj)
Exemplo n.º 36
0
    def searchUser(self, request):
        """
            return (count_of_result,user_id_lists)
        """
        request.needAuthType(request.ADMIN)
        request.checkArgs("conds", "from", "to", "order_by", "desc")
        admin_obj = request.getAuthNameObj()
        conds = self.__searchUserFixConds(request["conds"])

        if admin_obj.isGod(): pass
        elif admin_obj.hasPerm("GET USER INFORMATION"):
            if admin_obj.getPerms()["GET USER INFORMATION"].isRestricted():
                conds["owner_name"] = [admin_obj.getUsername()]
        else:
            raise PermissionException(errorText("GENERAL", "ACCESS_DENIED"))

        return user_main.getActionManager().searchUsers(
            conds, request["from"], request["to"], request["order_by"],
            request["desc"], admin_obj)
Exemplo n.º 37
0
    def addNewUsers(self,request):
	request.needAuthType(request.ADMIN)
	request.checkArgs("count","credit","owner_name","group_name","credit_comment")
	requester=request.getAuthNameObj()
	requester.canDo("ADD NEW USER")
	if request["owner_name"]!=requester.getUsername():
	    requester.canDo("CHANGE USERS OWNER")
	try:
	    _count=int(request["count"])
	except ValueError:
	    raise GeneralException(errorText("USER_ACTIONS","COUNT_NOT_INTEGER"))

	try:
	    credit=float(request["credit"])
	except ValueError:
	    raise GeneralException(errorText("USER_ACTIONS","CREDIT_NOT_FLOAT"))
	    
	return user_main.getActionManager().addNewUsers(_count,credit,request["owner_name"],requester.getUsername(),
							request["group_name"],request.getRemoteAddr(),
							request["credit_comment"])
Exemplo n.º 38
0
 def updateEmailAddressAttrQuery(self, user_id, email_address):
     return user_main.getActionManager().updateUserAttrQuery(user_id, "email_address", email_address)
Exemplo n.º 39
0
    def __checkPoolUsageInUsers(self,ippool_obj):
	user_ids=user_main.getActionManager().getUserIDsWithAttr("ippool",ippool_obj.getIPpoolID())
	if len(user_ids)>0:
	    raise GeneralException(errorText("IPPOOL","IPPOOL_USED_IN_USER")%",".join(map(str,user_ids)))
Exemplo n.º 40
0
    def __checkGroupUsageInUsers(self,group_obj):
	user_ids=user_main.getActionManager().getUserIDsWithBasicAttr("group_id",group_obj.getGroupID())
	if len(user_ids)>0:
	    raise GeneralException(errorText("GROUPS","GROUP_USED_IN_USER")%(group_obj.getGroupName(),
							    ",".join(map(str,user_ids))))
Exemplo n.º 41
0
    def __checkChargeUsageInUsers(self,charge_obj,attr_name):
	user_ids=user_main.getActionManager().getUserIDsWithAttr(attr_name,charge_obj.getChargeID())
	if len(user_ids)>0:
	    raise GeneralException(errorText("CHARGES","CHARGE_USED_IN_USER")%(charge_obj.getChargeName(),
							    ",".join(map(str,user_ids))))
Exemplo n.º 42
0
 def deleteEmailAddressAttrQuery(self, user_id):
     return user_main.getActionManager().deleteUserAttrQuery(user_id, "email_address")
Exemplo n.º 43
0
 def insertEmailAddressAttrQuery(self, user_id, email_address):
     return user_main.getActionManager().insertUserAttrQuery(user_id, "email_address", email_address)