Exemplo n.º 1
0
def getUserAndMailbox(userdn):
    co, lo, pos = getCoLoPos()

    server = univention.admin.modules.get("asterisk/server")
    univention.admin.modules.init(lo, pos, server)
    objs = server.lookup(co, lo, None)

    checkServers = []
    for obj in objs:
        checkServers.append({
            "label": obj["commonName"],
        })

    MODULE.error('User: server: %s' % len(checkServers))
    if len(checkServers) > 0:
        co, lo = getCoLo()

        user = getUser(co, lo, userdn)

        mailbox = user.get("mailbox")
        if mailbox:
            mailbox = getMailbox(co, lo, mailbox)

        return user, mailbox
    elif len(checkServers) == 0:
        MODULE.error('Fehler gefunden!')
        mailbox = "KeinServer"
        user = "******"
        return user, mailbox
Exemplo n.º 2
0
def getUserAndMailbox(userdn):
	co, lo, pos = getCoLoPos()

	server = univention.admin.modules.get("asterisk/server")
	univention.admin.modules.init(lo, pos, server)
	objs = server.lookup(co, lo, None)

	checkServers = []
	for obj in objs:
			checkServers.append({
				"label": obj["commonName"],
			})

	MODULE.error('User: server: %s' % len(checkServers))
	if len(checkServers) >0 :
		co, lo = getCoLo()

		user = getUser(co, lo, userdn)

		mailbox = user.get("mailbox")
		if mailbox:
			mailbox = getMailbox(co, lo, mailbox)

		return user, mailbox
	elif len(checkServers) == 0 :
		MODULE.error('Fehler gefunden!')
		mailbox = "KeinServer"
		user = "******"
		return user, mailbox
Exemplo n.º 3
0
def getPhones(userdn):
    co, lo = getCoLo()

    user = getUser(co, lo, userdn)

    phones = []
    for dn in user.get("phones", []):
        phones.append(getPhone(co, lo, dn))

    return phones
Exemplo n.º 4
0
def getPhones(userdn):
	co, lo = getCoLo()

	user = getUser(co, lo, userdn)

	phones = []
	for dn in user.get("phones", []):
		phones.append(getPhone(co, lo, dn))

	return phones
Exemplo n.º 5
0
def getUserAndMailbox(userdn):
	co, lo = getCoLo()

	user = getUser(co, lo, userdn)

	mailbox = user.get("mailbox")
	if mailbox:
		mailbox = getMailbox(co, lo, mailbox)

	return user, mailbox
Exemplo n.º 6
0
def changePhoneOrder(userdn, phonedn, change):
    co, lo = getCoLo()

    user = getUser(co, lo, userdn)

    phones = user.get("phones", [])
    i = phones.index(phonedn)
    phones.pop(i)
    if change == -1 and i > 0:
        phones.insert(i - 1, phonedn)
    elif change == 1:
        phones.insert(i + 1, phonedn)

    user["phones"] = phones
    user.modify()
Exemplo n.º 7
0
def changePhoneOrder(userdn, phonedn, change):
	co, lo = getCoLo()

	user = getUser(co, lo, userdn)

	phones = user.get("phones", [])
	i = phones.index(phonedn)
	phones.pop(i)
	if change == -1 and i > 0:
		phones.insert(i-1, phonedn)
	elif change == 1:
		phones.insert(i+1, phonedn)

	user["phones"] = phones
	user.modify()
Exemplo n.º 8
0
    def load(self, request):
        user, mailbox = getUserAndMailbox(self._user_dn)
        raise UMC_Error("Es wurde kein Asterisk-Server angelegt!")
        result = {
            "phones/interval": user["ringdelay"],
            "forwarding/number": user.get("forwarding", ""),
            "mailbox/timeout": user["timeout"],
            "mailbox": False,
        }

        if mailbox:
            result.update({
                "mailbox": True,
                "mailbox/password": mailbox["password"],
                "mailbox/email": mailbox["email"],
            })

        self.finished(request.id, result)
Exemplo n.º 9
0
	def load( self, request ):
		user, mailbox = getUserAndMailbox(self._user_dn)
		raise UMC_Error("Es wurde kein Asterisk-Server angelegt!")
		result = {
			"phones/interval": user["ringdelay"],
			"forwarding/number": user.get("forwarding",""),

			"mailbox/timeout": user["timeout"],
			"mailbox": False,
		}

		if mailbox:
			result.update({
				"mailbox": True,
				"mailbox/password": mailbox["password"],
				"mailbox/email": mailbox["email"],
			})

		self.finished( request.id, result )
Exemplo n.º 10
0
	def load( self, request ):
		user, mailbox = getUserAndMailbox(self._user_dn)

		result = {
			"phones/interval": user["ringdelay"],
			"forwarding/number": user.get("forwarding",""),

			"mailbox/timeout": user["timeout"],
			"mailbox": False,
		}

		if mailbox:
			result.update({
				"mailbox": True,
				"mailbox/password": mailbox["password"],
				"mailbox/email": mailbox["email"],
			})

		request.status = SUCCESS
		self.finished( request.id, result )