mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Use posixAccount instead of person to identify users
Add output_for_cli to service-find
This commit is contained in:
@@ -88,7 +88,7 @@ class ldap(CrudBackend):
|
|||||||
attribute = attribute.lower()
|
attribute = attribute.lower()
|
||||||
object_type = None
|
object_type = None
|
||||||
if attribute == "uid": # User
|
if attribute == "uid": # User
|
||||||
object_type = "person"
|
object_type = "posixAccount"
|
||||||
elif attribute == "cn": # Group
|
elif attribute == "cn": # Group
|
||||||
object_type = "posixGroup"
|
object_type = "posixGroup"
|
||||||
elif attribute == "krbprincipalname": # Service
|
elif attribute == "krbprincipalname": # Service
|
||||||
|
|||||||
@@ -168,7 +168,7 @@ def get_user_by_uid(uid, sattrs):
|
|||||||
"""Get a specific user's entry."""
|
"""Get a specific user's entry."""
|
||||||
# FIXME: should accept a container to look in
|
# FIXME: should accept a container to look in
|
||||||
# uid = self.__safe_filter(uid)
|
# uid = self.__safe_filter(uid)
|
||||||
searchfilter = "(&(uid=%s)(objectclass=person))" % uid
|
searchfilter = "(&(uid=%s)(objectclass=posixAccount))" % uid
|
||||||
|
|
||||||
return get_sub_entry("cn=accounts," + api.env.basedn, searchfilter, sattrs)
|
return get_sub_entry("cn=accounts," + api.env.basedn, searchfilter, sattrs)
|
||||||
|
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ class passwd(frontend.Command):
|
|||||||
else:
|
else:
|
||||||
principal = principal
|
principal = principal
|
||||||
|
|
||||||
dn = ldap.find_entry_dn("krbprincipalname", principal, "person")
|
dn = ldap.find_entry_dn("krbprincipalname", principal, "posixAccount")
|
||||||
|
|
||||||
# FIXME: we need a way to prompt for passwords using getpass
|
# FIXME: we need a way to prompt for passwords using getpass
|
||||||
kw['newpass'] = "password"
|
kw['newpass'] = "password"
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ class service_add(crud.Add):
|
|||||||
|
|
||||||
def output_to_cli(self, ret):
|
def output_to_cli(self, ret):
|
||||||
if ret:
|
if ret:
|
||||||
print "Service added"
|
print "Service added"
|
||||||
|
|
||||||
api.register(service_add)
|
api.register(service_add)
|
||||||
|
|
||||||
@@ -146,7 +146,7 @@ class service_find(crud.Find):
|
|||||||
def execute(self, principal, **kw):
|
def execute(self, principal, **kw):
|
||||||
ldap = self.api.Backend.ldap
|
ldap = self.api.Backend.ldap
|
||||||
|
|
||||||
kw['filter'] = "&(objectclass=krbPrincipalAux)(!(objectClass=person))(!(|(krbprincipalname=kadmin/*)(krbprincipalname=K/M@*)(krbprincipalname=krbtgt/*)))"
|
kw['filter'] = "&(objectclass=krbPrincipalAux)(!(objectClass=posixAccount))(!(|(krbprincipalname=kadmin/*)(krbprincipalname=K/M@*)(krbprincipalname=krbtgt/*)))"
|
||||||
kw['krbprincipalname'] = principal
|
kw['krbprincipalname'] = principal
|
||||||
|
|
||||||
object_type = ldap.get_object_type("krbprincipalname")
|
object_type = ldap.get_object_type("krbprincipalname")
|
||||||
@@ -193,5 +193,11 @@ class service_show(crud.Get):
|
|||||||
dn = ldap.find_entry_dn("krbprincipalname", principal)
|
dn = ldap.find_entry_dn("krbprincipalname", principal)
|
||||||
# FIXME: should kw contain the list of attributes to display?
|
# FIXME: should kw contain the list of attributes to display?
|
||||||
return ldap.retrieve(dn)
|
return ldap.retrieve(dn)
|
||||||
|
def output_for_cli(self, service):
|
||||||
|
if not service:
|
||||||
|
return
|
||||||
|
|
||||||
|
for a in service.keys():
|
||||||
|
print "%s: %s" % (a, service[a])
|
||||||
|
|
||||||
api.register(service_show)
|
api.register(service_show)
|
||||||
|
|||||||
Reference in New Issue
Block a user