mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
define Self-Service as editting your own record.
This has the side-effect of removing the realm from Loggin in as. This can be changed by using user_name instead of display_name in master.kid.
This commit is contained in:
@@ -12,7 +12,8 @@ class IPA_User(object):
|
||||
|
||||
def __init__(self, user_name):
|
||||
self.user_name = user_name
|
||||
self.display_name = user_name
|
||||
(principal, realm) = user_name.split('@')
|
||||
self.display_name = principal
|
||||
self.permissions = None
|
||||
self.groups = None
|
||||
return
|
||||
|
||||
@@ -241,7 +241,7 @@ class UserController(IPAController):
|
||||
|
||||
@expose("ipagui.templates.useredit")
|
||||
@identity.require(identity.not_anonymous())
|
||||
def edit(self, uid, tg_errors=None):
|
||||
def edit(self, uid=None, principal=None, tg_errors=None):
|
||||
"""Displays the edit user form"""
|
||||
if tg_errors:
|
||||
turbogears.flash("There were validation errors.<br/>" +
|
||||
@@ -250,7 +250,14 @@ class UserController(IPAController):
|
||||
client = self.get_ipaclient()
|
||||
|
||||
try:
|
||||
user = client.get_user_by_uid(uid, user_fields)
|
||||
if uid is not None:
|
||||
user = client.get_user_by_uid(uid, user_fields)
|
||||
elif principal is not None:
|
||||
principal = principal + "@" + ipa.config.config.default_realm
|
||||
user = client.get_user_by_principal(principal, user_fields)
|
||||
else:
|
||||
turbogears.flash("User edit failed: No uid or principal provided")
|
||||
raise turbogears.redirect('/')
|
||||
user_dict = user.toDict()
|
||||
# Edit shouldn't fill in the password field.
|
||||
if user_dict.has_key('userpassword'):
|
||||
@@ -291,6 +298,8 @@ class UserController(IPAController):
|
||||
return dict(form=user_edit_form, user=user_dict,
|
||||
user_groups=user_groups_dicts)
|
||||
except ipaerror.IPAError, e:
|
||||
if uid is None:
|
||||
uid = principal
|
||||
turbogears.flash("User edit failed: " + str(e))
|
||||
raise turbogears.redirect('/user/show', uid=uid)
|
||||
|
||||
|
||||
@@ -79,7 +79,7 @@
|
||||
</ul>
|
||||
<ul>
|
||||
<li><a href="${tg.url('/')}">Manage Policy</a></li>
|
||||
<li><a href="${tg.url('/')}">Self Service</a></li>
|
||||
<li><a href="${tg.url('/user/edit/', principal=tg.identity.user.display_name)}">Self Service</a></li>
|
||||
</ul>
|
||||
<ul>
|
||||
<li><a href="${tg.url('/delegate/list')}">Delegations</a></li>
|
||||
|
||||
Reference in New Issue
Block a user