2013-11-05 13:02:04 +00:00
|
|
|
[% WRAPPER layout.tt title=(create ? "Add new user" : "Editing user $user.username") %]
|
2010-12-03 09:40:25 +00:00
|
|
|
[% PROCESS common.tt %]
|
|
|
|
|
|
|
|
[% BLOCK roleoption %]
|
2013-02-27 17:33:47 +00:00
|
|
|
<option value="[% role %]"
|
|
|
|
[% checked = false %]
|
|
|
|
[% FOREACH r IN user.userroles %]
|
|
|
|
[% checked = r.role == role %]
|
|
|
|
[% BREAK IF checked %]
|
|
|
|
[% END %]
|
|
|
|
[% IF checked %]
|
2013-09-03 15:35:21 +00:00
|
|
|
selected="selected"
|
2013-02-27 17:33:47 +00:00
|
|
|
[% END %]
|
|
|
|
>[% role %]</option>
|
2010-12-03 09:40:25 +00:00
|
|
|
[% END %]
|
|
|
|
|
2013-11-05 13:02:04 +00:00
|
|
|
<form class="form-horizontal">
|
2013-02-27 17:33:47 +00:00
|
|
|
|
|
|
|
<fieldset>
|
2013-01-22 13:41:02 +00:00
|
|
|
|
2013-02-27 17:33:47 +00:00
|
|
|
[% IF create %]
|
|
|
|
<div class="control-group">
|
|
|
|
<label class="control-label">User name</label>
|
|
|
|
<div class="controls">
|
2013-09-03 15:35:21 +00:00
|
|
|
<input type="text" class="span3" name="username" [% HTML.attributes(value => username) %]/>
|
2013-02-27 17:33:47 +00:00
|
|
|
</div>
|
2012-04-17 14:53:11 +00:00
|
|
|
</div>
|
2013-02-27 17:33:47 +00:00
|
|
|
[% END %]
|
|
|
|
|
|
|
|
<div class="control-group">
|
|
|
|
<label class="control-label">Full name</label>
|
|
|
|
<div class="controls">
|
2013-11-05 13:02:04 +00:00
|
|
|
<input type="text" class="span3" name="fullname" [% HTML.attributes(value => create ? '' : user.fullname) %]/>
|
2013-02-27 17:33:47 +00:00
|
|
|
</div>
|
2012-04-17 14:53:11 +00:00
|
|
|
</div>
|
2013-02-27 17:33:47 +00:00
|
|
|
|
2013-11-05 11:41:10 +00:00
|
|
|
[% IF create || user.type == 'hydra' %]
|
2013-02-27 17:33:47 +00:00
|
|
|
<div class="control-group">
|
|
|
|
<label class="control-label">Password</label>
|
|
|
|
<div class="controls">
|
2013-09-03 15:35:21 +00:00
|
|
|
<input type="password" class="span3" name="password" value=""/>
|
2013-02-27 17:33:47 +00:00
|
|
|
</div>
|
2012-04-17 14:53:11 +00:00
|
|
|
</div>
|
2013-02-27 17:33:47 +00:00
|
|
|
|
|
|
|
<div class="control-group">
|
|
|
|
<label class="control-label">Confirm password</label>
|
|
|
|
<div class="controls">
|
2013-09-03 15:35:21 +00:00
|
|
|
<input type="password" class="span3" name="password2" value=""/>
|
2013-02-27 17:33:47 +00:00
|
|
|
</div>
|
2012-04-17 14:53:11 +00:00
|
|
|
</div>
|
2013-07-09 10:57:34 +00:00
|
|
|
[% END %]
|
2010-12-03 09:40:25 +00:00
|
|
|
|
2013-02-27 17:33:47 +00:00
|
|
|
<div class="control-group">
|
|
|
|
<label class="control-label">Email</label>
|
|
|
|
<div class="controls">
|
2016-01-13 16:32:52 +00:00
|
|
|
<input type="text" class="span3" name="emailaddress" [% IF !create && user.username.search('@') %]disabled="disabled"[% END %] [%+ HTML.attributes(value => user.emailaddress) %]/>
|
2013-02-27 17:33:47 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2013-11-05 11:41:10 +00:00
|
|
|
<div class="control-group">
|
|
|
|
<div class="controls">
|
|
|
|
<label class="checkbox">
|
2013-11-05 13:02:04 +00:00
|
|
|
<input type="checkbox" name="emailonerror" [% IF !create && user.emailonerror; 'checked="checked"'; END %]/>Receive evaluation error notifications
|
2013-11-05 11:41:10 +00:00
|
|
|
</label>
|
2013-02-27 17:33:47 +00:00
|
|
|
</div>
|
2013-11-05 11:41:10 +00:00
|
|
|
</div>
|
2013-02-27 17:33:47 +00:00
|
|
|
|
2016-05-27 10:00:20 +00:00
|
|
|
<div class="control-group">
|
|
|
|
<div class="controls">
|
|
|
|
<label class="checkbox">
|
|
|
|
<input type="checkbox" name="publicdashboard" [% IF !create && user.publicdashboard; 'checked="checked"'; END %]/>Public dashboard
|
|
|
|
</label>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2013-11-05 11:41:10 +00:00
|
|
|
[% IF !create || c.check_user_roles('admin') %]
|
2013-02-27 17:33:47 +00:00
|
|
|
<div class="control-group">
|
|
|
|
<label class="control-label">Roles</label>
|
|
|
|
<div class="controls">
|
2013-11-05 10:18:44 +00:00
|
|
|
<select multiple="multiple" name="roles" class="span3" [% IF !c.check_user_roles('admin') %]disabled="disabled"[% END %]>
|
2013-02-27 17:33:47 +00:00
|
|
|
[% INCLUDE roleoption role="admin" %]
|
2013-10-31 09:02:29 +00:00
|
|
|
[% INCLUDE roleoption role="create-projects" %]
|
2017-12-30 13:28:23 +00:00
|
|
|
[% INCLUDE roleoption role="restart-jobs" %]
|
2019-11-05 18:24:51 +00:00
|
|
|
[% INCLUDE roleoption role="bump-to-front" %]
|
2019-11-05 18:29:36 +00:00
|
|
|
[% INCLUDE roleoption role="cancel-build" %]
|
2013-02-27 17:33:47 +00:00
|
|
|
</select>
|
|
|
|
</div>
|
|
|
|
</div>
|
2012-04-17 14:53:11 +00:00
|
|
|
[% END %]
|
2013-02-27 17:33:47 +00:00
|
|
|
|
2013-11-05 11:41:10 +00:00
|
|
|
[% IF create && !c.check_user_roles('admin') %]
|
2013-02-27 17:33:47 +00:00
|
|
|
<div class="control-group">
|
|
|
|
<div class="controls">
|
|
|
|
<img src="[% c.uri_for('/captcha') %]" alt="CAPTCHA"/>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="control-group">
|
|
|
|
<label class="control-label">Type the digits shown in the image above</label>
|
|
|
|
<div class="controls">
|
2013-09-03 15:35:21 +00:00
|
|
|
<input type="text" class="span3" name="captcha" value=""/>
|
2013-02-27 17:33:47 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
[% END %]
|
|
|
|
|
|
|
|
<div class="form-actions">
|
2013-11-05 13:02:04 +00:00
|
|
|
<button id="submit-user" class="btn btn-primary">
|
2013-02-27 17:33:47 +00:00
|
|
|
<i class="icon-ok icon-white"></i>
|
|
|
|
[%IF create %]Create[% ELSE %]Apply changes[% END %]
|
|
|
|
</button>
|
2013-11-05 10:46:05 +00:00
|
|
|
[% IF !create && c.check_user_roles('admin') && user.type == 'hydra' %]
|
2013-11-05 13:02:04 +00:00
|
|
|
<button id="reset-password" class="btn btn-warning">
|
2013-03-04 14:25:23 +00:00
|
|
|
<i class="icon-trash icon-white"></i>
|
|
|
|
Reset password
|
|
|
|
</button>
|
|
|
|
[% END %]
|
2013-02-27 17:33:47 +00:00
|
|
|
[% IF !create %]
|
2013-11-05 13:02:04 +00:00
|
|
|
<button id="delete-user" class="btn btn-danger">
|
2013-02-27 17:33:47 +00:00
|
|
|
<i class="icon-trash icon-white"></i>
|
|
|
|
Delete this user
|
|
|
|
</button>
|
|
|
|
[% END %]
|
2013-09-03 15:35:21 +00:00
|
|
|
</div>
|
|
|
|
|
|
|
|
</fieldset>
|
2010-12-03 09:40:25 +00:00
|
|
|
|
|
|
|
</form>
|
|
|
|
|
2013-11-05 13:02:04 +00:00
|
|
|
<script>
|
|
|
|
$("#submit-user").click(function() {
|
|
|
|
requestJSON({
|
|
|
|
[% IF create %]
|
|
|
|
url: "[% c.uri_for(c.controller('User').action_for('register')) %]",
|
|
|
|
[% ELSE %]
|
|
|
|
url: "[% c.uri_for(c.controller('User').action_for('edit'), c.req.captures) %]",
|
|
|
|
[% END %]
|
|
|
|
data: $(this).parents("form").serialize(),
|
|
|
|
type: 'PUT',
|
|
|
|
success: backToReferrer
|
|
|
|
});
|
|
|
|
return false;
|
|
|
|
});
|
|
|
|
|
|
|
|
$("#reset-password").click(function() {
|
|
|
|
bootbox.confirm(
|
|
|
|
'Are you sure you want to reset the password for this user?',
|
|
|
|
function(c) {
|
|
|
|
if (!c) return;
|
|
|
|
requestJSON({
|
|
|
|
url: "[% c.uri_for(c.controller('User').action_for('reset_password'), [user.username]) %]",
|
|
|
|
type: 'POST',
|
|
|
|
success: backToReferrer
|
|
|
|
});
|
|
|
|
});
|
|
|
|
return false;
|
|
|
|
});
|
|
|
|
|
|
|
|
$("#delete-user").click(function() {
|
|
|
|
bootbox.confirm(
|
|
|
|
'Are you sure you want to delete this user?',
|
|
|
|
function(c) {
|
|
|
|
if (!c) return;
|
|
|
|
requestJSON({
|
|
|
|
url: "[% c.uri_for(c.controller('User').action_for('edit'), c.req.captures) %]",
|
|
|
|
type: 'DELETE',
|
|
|
|
success: backToReferrer
|
|
|
|
});
|
|
|
|
});
|
|
|
|
return false;
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
2010-12-03 09:40:25 +00:00
|
|
|
[% END %]
|