mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Add more fields to the IPA Policy form
This commit is contained in:
@@ -2,14 +2,20 @@ import turbogears
|
||||
from turbogears import validators, widgets
|
||||
|
||||
class IPAPolicyFields():
|
||||
searchlimit = widgets.TextField(name="searchlimit", label="Search Time Limit", attrs=dict(size=6,maxlength=6))
|
||||
searchlimit = widgets.TextField(name="searchlimit", label="Search Time Limit (sec.)", attrs=dict(size=6,maxlength=6))
|
||||
maxuidlength = widgets.TextField(name="maxuidlength", label="Max. UID Length", attrs=dict(size=3,maxlength=3))
|
||||
passwordnotif = widgets.TextField(name="passwordnotif", label="Password Expiration Notification (days)", attrs=dict(size=3,maxlength=3))
|
||||
homedir = widgets.TextField(name="homedir", label="Root for Home Directories")
|
||||
defaultshell = widgets.TextField(name="defaultshell", label="Default shell")
|
||||
defaultgroup = widgets.TextField(name="defaultgroup", label="Default Users group")
|
||||
|
||||
class IPAPolicyValidator(validators.Schema):
|
||||
searchlimit = validators.Number(not_empty=True)
|
||||
maxuidlength = validators.Number(not_empty=True)
|
||||
passwordnotif = validators.Number(not_empty=True)
|
||||
homedir = validators.String(not_empty=True)
|
||||
defaultshell = validators.String(not_empty=True)
|
||||
defaultgroup = validators.String(not_empty=True)
|
||||
|
||||
class IPAPolicyForm(widgets.Form):
|
||||
params = ['ipapolicy_fields']
|
||||
|
||||
@@ -39,6 +39,9 @@ class IPAPolicyController(IPAController):
|
||||
ipapolicy['searchlimit'] = 2
|
||||
ipapolicy['maxuidlength'] = 3
|
||||
ipapolicy['passwordnotif'] = 4
|
||||
ipapolicy['homedir'] = "/home"
|
||||
ipapolicy['defaultgroup'] = "ipausers"
|
||||
ipapolicy['defaultshell'] = "/bin/bash"
|
||||
return dict(ipapolicy=ipapolicy,fields=ipagui.forms.ipapolicy.IPAPolicyFields())
|
||||
|
||||
@expose("ipagui.templates.ipapolicyedit")
|
||||
@@ -55,6 +58,9 @@ class IPAPolicyController(IPAController):
|
||||
ipapolicy_dict['searchlimit'] = 2
|
||||
ipapolicy_dict['maxuidlength'] = 3
|
||||
ipapolicy_dict['passwordnotif'] = 4
|
||||
ipapolicy_dict['homedir'] = "/home"
|
||||
ipapolicy_dict['defaultgroup'] = "ipausers"
|
||||
ipapolicy_dict['defaultshell'] = "/bin/bash"
|
||||
return dict(form=ipapolicy_edit_form, ipapolicy=ipapolicy_dict)
|
||||
except ipaerror.IPAError, e:
|
||||
turbogears.flash("IPA Policy edit failed: " + str(e) + "<br/>" + str(e.detail))
|
||||
|
||||
@@ -46,6 +46,10 @@ from ipagui.helpers import ipahelper
|
||||
py:content="tg.errors.get('passwordnotif')" />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<h2 class="formsection">Password Policy</h2>
|
||||
<table class="formtable" cellpadding="2" cellspacing="0" border="0">
|
||||
<tr>
|
||||
<th>
|
||||
<label class="fieldlabel" py:content="ipapolicy_fields.maxuidlength.label" />:
|
||||
@@ -56,6 +60,36 @@ from ipagui.helpers import ipahelper
|
||||
py:content="tg.errors.get('maxuidlength')" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
<label class="fieldlabel" py:content="ipapolicy_fields.homedir.label" />:
|
||||
</th>
|
||||
<td>
|
||||
<span py:replace="ipapolicy_fields.homedir.display(value_for(ipapolicy_fields.homedir))" />
|
||||
<span py:if="tg.errors.get('homedir')" class="fielderror"
|
||||
py:content="tg.errors.get('homedir')" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
<label class="fieldlabel" py:content="ipapolicy_fields.defaultshell.label" />:
|
||||
</th>
|
||||
<td>
|
||||
<span py:replace="ipapolicy_fields.defaultshell.display(value_for(ipapolicy_fields.defaultshell))" />
|
||||
<span py:if="tg.errors.get('defaultshell')" class="fielderror"
|
||||
py:content="tg.errors.get('defaultshell')" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
<label class="fieldlabel" py:content="ipapolicy_fields.defaultgroup.label" />:
|
||||
</th>
|
||||
<td>
|
||||
<span py:replace="ipapolicy_fields.defaultgroup.display(value_for(ipapolicy_fields.defaultgroup))" />
|
||||
<span py:if="tg.errors.get('defaultgroup')" class="fielderror"
|
||||
py:content="tg.errors.get('defaultgroup')" />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
|
||||
|
||||
@@ -34,12 +34,33 @@ edit_url = tg.url('/ipapolicy/edit')
|
||||
</th>
|
||||
<td>${ipapolicy.get("passwordnotif")}</td>
|
||||
</tr>
|
||||
</table>
|
||||
<h2 class="formsection">User Settings</h2>
|
||||
<table class="formtable" cellpadding="2" cellspacing="0" border="0">
|
||||
<tr>
|
||||
<th>
|
||||
<label class="fieldlabel" py:content="fields.maxuidlength.label" />:
|
||||
</th>
|
||||
<td>${ipapolicy.get("maxuidlength")}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
<label class="fieldlabel" py:content="fields.homedir.label" />:
|
||||
</th>
|
||||
<td>${ipapolicy.get("homedir")}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
<label class="fieldlabel" py:content="fields.defaultshell.label" />:
|
||||
</th>
|
||||
<td>${ipapolicy.get("defaultshell")}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
<label class="fieldlabel" py:content="fields.defaultgroup.label" />:
|
||||
</th>
|
||||
<td>${ipapolicy.get("defaultgroup")}</td>
|
||||
</tr>
|
||||
</table>
|
||||
<hr />
|
||||
<input class="submitbutton" type="button"
|
||||
|
||||
Reference in New Issue
Block a user