summaryrefslogtreecommitdiffstats
path: root/ipa-server/ipa-gui
diff options
context:
space:
mode:
authorKevin McCarthy <kmccarth@redhat.com>2007-08-31 10:59:26 -0700
committerKevin McCarthy <kmccarth@redhat.com>2007-08-31 10:59:26 -0700
commit00e299467c9d5c7b44724e45079bb0fdf7e5654b (patch)
treed03be9c47c4ad700d97df7e0d672ede262ba21a0 /ipa-server/ipa-gui
parentc85c8eede36224e72b42153708dd58a9f0610b0d (diff)
downloadfreeipa-00e299467c9d5c7b44724e45079bb0fdf7e5654b.tar.gz
freeipa-00e299467c9d5c7b44724e45079bb0fdf7e5654b.tar.xz
freeipa-00e299467c9d5c7b44724e45079bb0fdf7e5654b.zip
Add account deactivation checkbox.
Fix genModList to lowercase all keys and use CIDict.
Diffstat (limited to 'ipa-server/ipa-gui')
-rw-r--r--ipa-server/ipa-gui/ipagui/controllers.py13
-rw-r--r--ipa-server/ipa-gui/ipagui/forms/user.py1
-rw-r--r--ipa-server/ipa-gui/ipagui/static/css/style.css2
-rw-r--r--ipa-server/ipa-gui/ipagui/templates/usereditform.kid15
-rw-r--r--ipa-server/ipa-gui/ipagui/templates/usernewform.kid15
-rw-r--r--ipa-server/ipa-gui/ipagui/templates/usershow.kid10
6 files changed, 53 insertions, 3 deletions
diff --git a/ipa-server/ipa-gui/ipagui/controllers.py b/ipa-server/ipa-gui/ipagui/controllers.py
index 5771ebe31..5fb4be06b 100644
--- a/ipa-server/ipa-gui/ipagui/controllers.py
+++ b/ipa-server/ipa-gui/ipagui/controllers.py
@@ -28,6 +28,8 @@ password_chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
client = ipa.ipaclient.IPAClient(True)
client.set_principal("test@FREEIPA.ORG")
+user_fields = ['*', 'nsAccountLock']
+
def restrict_post():
if cherrypy.request.method != "POST":
turbogears.flash("This method only accepts posts")
@@ -77,6 +79,8 @@ class Root(controllers.RootController):
new_user.setValue('sn', kw.get('sn'))
new_user.setValue('mail', kw.get('mail'))
new_user.setValue('telephonenumber', kw.get('telephonenumber'))
+ if kw.get('nsAccountLock'):
+ new_user.setValue('nsAccountLock', 'true')
rv = client.add_user(new_user)
turbogears.flash("%s added!" % kw['uid'])
@@ -92,7 +96,7 @@ class Root(controllers.RootController):
if tg_errors:
turbogears.flash("There was a problem with the form!")
- user = client.get_user_by_uid(uid)
+ user = client.get_user_by_uid(uid, user_fields)
user_dict = user.toDict()
# store a copy of the original user for the update later
user_data = b64encode(dumps(user_dict))
@@ -120,6 +124,11 @@ class Root(controllers.RootController):
new_user.setValue('sn', kw.get('sn'))
new_user.setValue('mail', kw.get('mail'))
new_user.setValue('telephonenumber', kw.get('telephonenumber'))
+ if kw.get('nsAccountLock'):
+ new_user.setValue('nsAccountLock', 'true')
+ else:
+ new_user.setValue('nsAccountLock', None)
+
#
# this is a hack until we decide on the policy for names/cn/sn/givenName
#
@@ -161,7 +170,7 @@ class Root(controllers.RootController):
def usershow(self, uid):
"""Retrieve a single user for display"""
try:
- user = client.get_user_by_uid(uid)
+ user = client.get_user_by_uid(uid, user_fields)
return dict(user=user.toDict(), fields=forms.user.UserFields())
except ipaerror.IPAError, e:
turbogears.flash("User show failed: " + str(e))
diff --git a/ipa-server/ipa-gui/ipagui/forms/user.py b/ipa-server/ipa-gui/ipagui/forms/user.py
index 9ce512567..b9b6f33d4 100644
--- a/ipa-server/ipa-gui/ipagui/forms/user.py
+++ b/ipa-server/ipa-gui/ipagui/forms/user.py
@@ -10,6 +10,7 @@ class UserFields():
sn = widgets.TextField(name="sn", label="Last name")
mail = widgets.TextField(name="mail", label="E-mail address")
telephonenumber = widgets.TextField(name="telephonenumber", label="Phone")
+ nsAccountLock = widgets.CheckBox(name="nsAccountLock", label="Account Deactivated")
uid.validator = validators.PlainText(not_empty=True)
userpassword.validator = validators.String(not_empty=True)
diff --git a/ipa-server/ipa-gui/ipagui/static/css/style.css b/ipa-server/ipa-gui/ipagui/static/css/style.css
index 3c260c21b..9ea86ae01 100644
--- a/ipa-server/ipa-gui/ipagui/static/css/style.css
+++ b/ipa-server/ipa-gui/ipagui/static/css/style.css
@@ -122,7 +122,7 @@ body {
}
.formtable th {
- width: 15%;
+ width: 20%;
text-align: right;
}
diff --git a/ipa-server/ipa-gui/ipagui/templates/usereditform.kid b/ipa-server/ipa-gui/ipagui/templates/usereditform.kid
index cef7f116d..dc61f38c5 100644
--- a/ipa-server/ipa-gui/ipagui/templates/usereditform.kid
+++ b/ipa-server/ipa-gui/ipagui/templates/usereditform.kid
@@ -139,6 +139,21 @@
</tr>
</table>
+ <div class="formsection">Account Status</div>
+ <table class="formtable" cellpadding="2" cellspacing="0" border="0">
+ <tr>
+ <th>
+ <label class="fieldlabel" for="${user.nsAccountLock.field_id}"
+ py:content="user.nsAccountLock.label" />:
+ </th>
+ <td>
+ <span py:replace="user.nsAccountLock.display(value_for(user.nsAccountLock))" />
+ <span py:if="tg.errors.get('nsAccountLock')" class="fielderror"
+ py:content="tg.errors.get('nsAccountLock')" />
+ </td>
+ </tr>
+ </table>
+
<table class="formtable" cellpadding="2" cellspacing="0" border="0">
<tr>
<th>
diff --git a/ipa-server/ipa-gui/ipagui/templates/usernewform.kid b/ipa-server/ipa-gui/ipagui/templates/usernewform.kid
index c766327f0..d4863a3df 100644
--- a/ipa-server/ipa-gui/ipagui/templates/usernewform.kid
+++ b/ipa-server/ipa-gui/ipagui/templates/usernewform.kid
@@ -150,6 +150,21 @@
</tr>
</table>
+ <div class="formsection">Account Status</div>
+ <table class="formtable" cellpadding="2" cellspacing="0" border="0">
+ <tr>
+ <th>
+ <label class="fieldlabel" for="${user.nsAccountLock.field_id}"
+ py:content="user.nsAccountLock.label" />:
+ </th>
+ <td>
+ <span py:replace="user.nsAccountLock.display(value_for(user.nsAccountLock))" />
+ <span py:if="tg.errors.get('nsAccountLock')" class="fielderror"
+ py:content="tg.errors.get('nsAccountLock')" />
+ </td>
+ </tr>
+ </table>
+
<table class="formtable" cellpadding="2" cellspacing="0" border="0">
<tr>
<th>
diff --git a/ipa-server/ipa-gui/ipagui/templates/usershow.kid b/ipa-server/ipa-gui/ipagui/templates/usershow.kid
index 2ffd1a4e9..4e73eba35 100644
--- a/ipa-server/ipa-gui/ipagui/templates/usershow.kid
+++ b/ipa-server/ipa-gui/ipagui/templates/usershow.kid
@@ -62,6 +62,16 @@
</tr>
</table>
+ <div class="formsection">Account Status</div>
+ <table class="formtable" cellpadding="2" cellspacing="0" border="0">
+ <tr>
+ <th>
+ <label class="fieldlabel" py:content="fields.nsAccountLock.label" />:
+ </th>
+ <td>${user.get("nsAccountLock")}</td>
+ </tr>
+ </table>
+
<a href="${tg.url('/useredit', uid=user.get('uid'))}">edit</a>
</body>