Beispiel #1
0
 def __checkPermDependencies(self, admin_obj, perm_name):
     dep_list = perm_loader.getLoader()[perm_name].getDependencies()
     for dep in dep_list:
         if not admin_obj.hasPerm(dep):
             raise GeneralException(
                 errorText("PERMISSION", "DEPENDENCY_NOT_SATISFIED") %
                 (dep, perm_name))
Beispiel #2
0
    def __changePermValue(self,admin_obj,perm_name,perm_value):
	perm_obj=perm_loader.getLoader()[perm_name]
	if perm_obj.getValueType()=="MULTIVALUE":
	    admin_perm_obj=admin_obj.getPerms()[perm_name]
	    if admin_perm_obj.multi_value.hasValue(perm_value):
		raise GeneralException(errorText("PERMISSION","PERMISSION_ALREADY_HAS_VALUE")%(perm_name,perm_value)) 
	    perm_value=admin_perm_obj.multi_value.addNewValue(perm_value)
	elif perm_obj.getValueType()=="NOVALUE":
	    raise GeneralException(errorText("PERMISSION","ALREADY_HAS_PERMISSION")%perm_name) #this is really there's no value to change
	    
	self.__changePermValueDB(admin_obj,perm_name,perm_value)
Beispiel #3
0
 def __loadAdminObj(self, admin_id):
     """
         get admin information from db(including basic info,perms and locks), 
         Create an object of these information, and return the object
     """
     admin_info = self.__getAdminBasicInfoDB(admin_id)
     admin_obj = self.__createAdminObj(admin_info)
     admin_perms = perm_loader.getLoader().getPermsOfAdmin(admin_obj)
     admin_locks = self.__getAdminLocks(admin_id)
     admin_obj.setPerms(admin_perms)
     admin_obj.setLocks(admin_locks)
     return admin_obj
Beispiel #4
0
    def __loadAdminObj(self,admin_id):
	"""
	    get admin information from db(including basic info,perms and locks), 
	    Create an object of these information, and return the object
	"""
	admin_info=self.__getAdminBasicInfoDB(admin_id)
	admin_obj=self.__createAdminObj(admin_info)
	admin_perms=perm_loader.getLoader().getPermsOfAdmin(admin_obj)
	admin_locks=self.__getAdminLocks(admin_id)
	admin_obj.setPerms(admin_perms)
	admin_obj.setLocks(admin_locks)
	return admin_obj
Beispiel #5
0
    def __changePermValue(self, admin_obj, perm_name, perm_value):
        perm_obj = perm_loader.getLoader()[perm_name]
        if perm_obj.getValueType() == "MULTIVALUE":
            admin_perm_obj = admin_obj.getPerms()[perm_name]
            if admin_perm_obj.multi_value.hasValue(perm_value):
                raise GeneralException(
                    errorText("PERMISSION", "PERMISSION_ALREADY_HAS_VALUE") %
                    (perm_name, perm_value))
            perm_value = admin_perm_obj.multi_value.addNewValue(perm_value)
        elif perm_obj.getValueType() == "NOVALUE":
            raise GeneralException(
                errorText("PERMISSION", "ALREADY_HAS_PERMISSION") %
                perm_name)  #there's no value to change

        self.__changePermValueDB(admin_obj, perm_name, perm_value)
Beispiel #6
0
    def getAllPerms(self,request):
	"""
	    return a list of dics of all perms sorted by permission name
	    optional argument category tells handler to return only permission of specified category
	    each dic has "name, description, value_type, category, affected_pages, dependencies" keys
	"""
	request.needAuthType(request.ADMIN)
	request.getAuthNameObj().canDo("CHANGE ADMIN PERMISSIONS")
	all_perms_dic=perm_loader.getLoader().getAllPerms()
	if request.has_key("category"):
	    category=request["category"]
	else:
	    category="all"
	all_perms_list=self.__getPermsListFromPerms(all_perms_dic,category)
	sorted=SortedList(all_perms_list)
	sorted.sortByPostText('["name"]',0)
	return sorted.getList() 
Beispiel #7
0
 def getAllPerms(self, request):
     """
         return a list of dics of all perms sorted by permission name
         optional argument category tells handler to return only permission of specified category
         each dic has "name, description, value_type, category, affected_pages, dependencies" keys
     """
     request.needAuthType(request.ADMIN)
     request.getAuthNameObj().canDo("CHANGE ADMIN PERMISSIONS")
     all_perms_dic = perm_loader.getLoader().getAllPerms()
     if request.has_key("category"):
         category = request["category"]
     else:
         category = "all"
     all_perms_list = self.__getPermsListFromPerms(all_perms_dic, category)
     sorted = SortedList(all_perms_list)
     sorted.sortByPostText('["name"]', 0)
     return sorted.getList()
Beispiel #8
0
def init():
    perm_loader.getLoader().registerPerm("LIMIT MAIL DOMAIN", LimitMailDomain)
Beispiel #9
0
def init():
    perm_loader.getLoader().registerPerm("CHARGE ACCESS",ChargeAccess)
Beispiel #10
0
def init():
    perm_loader.getLoader().registerPerm("SEE REALTIME SNAPSHOTS",
                                         SeeRealTimeSnapShots)
Beispiel #11
0
def init():
    perm_loader.getLoader().registerPerm("CLEAR USER",ClearUser)
def init():
    perm_loader.getLoader().registerPerm("CHANGE IBS DEFINITIONS", ChangeIbsDefinitions)
Beispiel #13
0
def init():
    perm_loader.getLoader().registerPerm("DELETE USER", DeleteUser)
Beispiel #14
0
 def __changePermissionCheckInput(self, admin_username, perm_name,
                                  perm_value):
     self.__checkAdminUsernameAndPerm(admin_username, perm_name)
     perm_loader.getLoader()[perm_name].checkNewValue(perm_value)
Beispiel #15
0
def init():
    perm_loader.getLoader().registerPerm("CHANGE USER CREDIT",ChangeUserCredit)
Beispiel #16
0
def init():
    perm_loader.getLoader().registerPerm("CLEAR USER", ClearUser)
Beispiel #17
0
def init():
    perm_loader.getLoader().registerPerm("VIEW MESSAGES",ViewMessages)
Beispiel #18
0
def init():
    perm_loader.getLoader().registerPerm("KILL USER",KillUser)
Beispiel #19
0
def init():
    perm_loader.getLoader().registerPerm("CHANGE USERS OWNER",ChangeUsersOwner)
Beispiel #20
0
def init():
    perm_loader.getLoader().registerPerm("CHANGE BANDWIDTH MANAGER",ChangeBandwidthManager)
Beispiel #21
0
def init():
    perm_loader.getLoader().registerPerm("NO DEPOSIT LIMIT",NoDepositLimit)
Beispiel #22
0
def init():
    perm_loader.getLoader().registerPerm("ADD NEW GROUP",AddNewGroup)
Beispiel #23
0
def init():
    perm_loader.getLoader().registerPerm("ADD NEW ADMIN",AddNewAdmin)
Beispiel #24
0
def init():
    perm_loader.getLoader().registerPerm("SEE VOIP TARIFF", SeeVoIPTariff)
Beispiel #25
0
def init():
    perm_loader.getLoader().registerPerm("SEE VOIP TARIFF",SeeVoIPTariff)
Beispiel #26
0
 def __checkAdminUsernameAndPerm(self, admin_username, perm_name):
     """
         check if admin_username and perm are valid
     """
     admin_main.getLoader().checkAdminName(admin_username)
     perm_loader.getLoader().checkPermName(perm_name)
Beispiel #27
0
def init():
    perm_loader.getLoader().registerPerm("ADD NEW USER",AddNewUser)
def init():
    perm_loader.getLoader().registerPerm("CHANGE ADMIN PASSWORD",ChangeAdminPassword)
Beispiel #29
0
def init():
    perm_loader.getLoader().registerPerm("CHANGE RAS",ChangeRas)
Beispiel #30
0
def init():
    perm_loader.getLoader().registerPerm("CHANGE ADMIN PASSWORD",
                                         ChangeAdminPassword)
Beispiel #31
0
def init():
    perm_loader.getLoader().registerPerm("CHANGE USER CREDIT",ChangeUserCredit)
Beispiel #32
0
def init():
    perm_loader.getLoader().registerPerm("ADD NEW GROUP",AddNewGroup)
Beispiel #33
0
def init():
    perm_loader.getLoader().registerPerm("SEE ADMIN PERMISSIONS",SeeAdminPermissions)
Beispiel #34
0
def init():
    perm_loader.getLoader().registerPerm("CHANGE IPPOOL", ChangeIPpool)
Beispiel #35
0
 def __createAdminPermsFromRawPerms(self, raw_perms):
     return perm_loader.getLoader().getPermsOfAdminFromRawPermList(
         raw_perms)
Beispiel #36
0
def init():
    perm_loader.getLoader().registerPerm("ACCESS ALL CHARGES",ListAllCharges)
Beispiel #37
0
def init():
    perm_loader.getLoader().registerPerm("LIST IPPOOL",ListIPpool)
Beispiel #38
0
def init():
    perm_loader.getLoader().registerPerm("SEE ONLINE USERS",SeeOnlineUsers)
Beispiel #39
0
def init():
    perm_loader.getLoader().registerPerm("SEE CREDIT CHANGES",
                                         SeeCreditChanges)
Beispiel #40
0
def init():
    perm_loader.getLoader().registerPerm("DELETE ADMIN", DeleteAdmin)
Beispiel #41
0
def init():
    perm_loader.getLoader().registerPerm("SEE CREDIT CHANGES",SeeCreditChanges)
Beispiel #42
0
def init():
    perm_loader.getLoader().registerPerm("CHANGE ADMIN INFO", ChangeAdminInfo)
Beispiel #43
0
    def __checkAdminUsernameAndPerm(self,admin_username,perm_name):
	"""
	    check if admin_username and perm are valid
	"""
	admin_main.getLoader().checkAdminName(admin_username)
	perm_loader.getLoader().checkPermName(perm_name)
Beispiel #44
0
def init():
    perm_loader.getLoader().registerPerm("CHANGE CHARGE",ChangeCharge)
Beispiel #45
0
    def __changePermissionCheckInput(self,admin_username,perm_name,perm_value):
	self.__checkAdminUsernameAndPerm(admin_username,perm_name)
    	perm_loader.getLoader()[perm_name].checkNewValue(perm_value)
Beispiel #46
0
def init():
    perm_loader.getLoader().registerPerm("CHANGE IBS DEFINITIONS",
                                         ChangeIbsDefinitions)
Beispiel #47
0
def init():
    perm_loader.getLoader().registerPerm("KILL USER", KillUser)
Beispiel #48
0
def init():
    perm_loader.getLoader().registerPerm("SEE ADMIN INFO", SeeAdminInfo)
def init():
    perm_loader.getLoader().registerPerm("CHANGE BANDWIDTH MANAGER",ChangeBandwidthManager)
Beispiel #50
0
def init():
    perm_loader.getLoader().registerPerm("ADD NEW USER", AddNewUser)
Beispiel #51
0
    def __createAdminPermsFromRawPerms(self,raw_perms):
	return perm_loader.getLoader().getPermsOfAdminFromRawPermList(raw_perms)
Beispiel #52
0
    def __checkPermDependencies(self,admin_obj,perm_name):
	dep_list=perm_loader.getLoader()[perm_name].getDependencies()
	for dep in dep_list:
	    if not admin_obj.hasPerm(dep):
		raise GeneralException(errorText("PERMISSION","DEPENDENCY_NOT_SATISFIED")%(dep,perm_name))
Beispiel #53
0
def init():
    perm_loader.getLoader().registerPerm("CHANGE VOIP TARIFF",ChangeVoIPTariff)
Beispiel #54
0
def init():
    perm_loader.getLoader().registerPerm("CHANGE VOIP USER ATTRIBUTES",
                                         ChangeNormalUserAttrs)
Beispiel #55
0
def init():
    perm_loader.getLoader().registerPerm("POST MESSAGES", PostMessages)
Beispiel #56
0
def init():
    perm_loader.getLoader().registerPerm("CHANGE VOIP TARIFF",ChangeVoIPTariff)
Beispiel #57
0
def init():
    perm_loader.getLoader().registerPerm("CHANGE ADMIN DEPOSIT",ChangeAdminDeposit)
Beispiel #58
0
def init():
    perm_loader.getLoader().registerPerm("CHANGE IPPOOL",ChangeIPpool)
Beispiel #59
0
def init():
    perm_loader.getLoader().registerPerm("SEE CONNETION LOGS",SeeConnectionLogs)