mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Creates an update_entry api call, aliases update_user and update_group to it.
This commit is contained in:
@@ -78,6 +78,12 @@ class IPAClient:
|
||||
result = self.transport.get_entry_by_cn(cn,sattrs)
|
||||
return entity.Entity(result)
|
||||
|
||||
def update_entry(self,entry):
|
||||
"""Update a entry."""
|
||||
|
||||
result = self.transport.update_entry(entry.origDataDict(), entry.toDict())
|
||||
return result
|
||||
|
||||
# User support
|
||||
def get_user_by_uid(self,uid,sattrs=None):
|
||||
"""Get a specific user by uid. If sattrs is set then only those
|
||||
|
||||
@@ -118,6 +118,20 @@ class RPCClient:
|
||||
|
||||
return ipautil.unwrap_binary_data(result)
|
||||
|
||||
def update_entry(self,oldentry,newentry):
|
||||
"""Update an existing entry. oldentry and newentry are dicts of attributes"""
|
||||
server = self.setup_server()
|
||||
|
||||
try:
|
||||
result = server.update_entry(ipautil.wrap_binary_data(oldentry),
|
||||
ipautil.wrap_binary_data(newentry))
|
||||
except xmlrpclib.Fault, fault:
|
||||
raise ipaerror.gen_exception(fault.faultCode, fault.faultString)
|
||||
except socket.error, (value, msg):
|
||||
raise xmlrpclib.Fault(value, msg)
|
||||
|
||||
return ipautil.unwrap_binary_data(result)
|
||||
|
||||
|
||||
# User support
|
||||
|
||||
|
||||
@@ -62,8 +62,7 @@ class DelegationController(IPAController):
|
||||
aci_entry = client.get_aci_entry(['dn'])
|
||||
aci_entry.setValue('aci', new_aci.export_to_string())
|
||||
|
||||
# TODO - add a client.update_entry() call instead
|
||||
client.update_group(aci_entry)
|
||||
client.update_entry(aci_entry)
|
||||
except ipaerror.IPAError, e:
|
||||
turbogears.flash("Delgate add failed: " + str(e))
|
||||
return dict(form=delegate_new_form, delegate=kw,
|
||||
|
||||
@@ -343,6 +343,10 @@ class IPAServer:
|
||||
filter = "(cn=" + cn + ")"
|
||||
return self.__get_sub_entry(self.basedn, filter, sattrs, opts)
|
||||
|
||||
def update_entry (self, oldentry, newentry, opts=None):
|
||||
"""Update an entry in LDAP"""
|
||||
return self.__update_entry(oldentry, newentry, opts)
|
||||
|
||||
# User support
|
||||
|
||||
def __is_user_unique(self, uid, opts):
|
||||
@@ -586,9 +590,7 @@ class IPAServer:
|
||||
|
||||
return new_dict
|
||||
|
||||
def update_user (self, olduser, newuser, opts=None):
|
||||
"""Update a user in LDAP"""
|
||||
return self.__update_entry(olduser, newuser, opts)
|
||||
update_user = update_entry
|
||||
|
||||
def mark_user_deleted (self, uid, opts=None):
|
||||
"""Mark a user as inactive in LDAP. We aren't actually deleting
|
||||
@@ -987,9 +989,7 @@ class IPAServer:
|
||||
|
||||
return failed
|
||||
|
||||
def update_group (self, oldgroup, newgroup, opts=None):
|
||||
"""Update a group in LDAP"""
|
||||
return self.__update_entry(oldgroup, newgroup, opts)
|
||||
update_group = update_entry
|
||||
|
||||
def delete_group (self, group_dn, opts=None):
|
||||
"""Delete a group
|
||||
|
||||
@@ -320,6 +320,7 @@ def handler(req, profiling=False):
|
||||
h.register_function(f.get_aci_entry)
|
||||
h.register_function(f.get_entry_by_dn)
|
||||
h.register_function(f.get_entry_by_cn)
|
||||
h.register_function(f.update_entry)
|
||||
h.register_function(f.get_user_by_uid)
|
||||
h.register_function(f.get_user_by_principal)
|
||||
h.register_function(f.get_users_by_manager)
|
||||
|
||||
Reference in New Issue
Block a user