display assignedRoles for a user in user edition

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1220982 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2011-12-19 22:38:30 +00:00
parent e6b6aa055c
commit bb398aa370
3 changed files with 30 additions and 6 deletions

View File

@ -1,4 +1,7 @@
<script id='redback/user-edit-tmpl' type='text/x-jquery-tmpl'>
<div class="row">
<div class="span10 columns">
<form id="user-create">
<fieldset id="user-create-fieldset">
<div class="clearfix">
@ -57,4 +60,14 @@
<button data-bind="click: save" class="btn" id="user-create-form-register-button">${i18n('save')}</button>
<button class="btn" id="user-create-form-cancel-button">${i18n('cancel')}</button>
</form>
</div>
<div class="span6 columns" id="user-edit-roles-view" style="display:none">
<div class="page-header">
<h3>${$.i18n.prop('effective.roles')}</h3>
</div>
</div>
</div>
</script>

View File

@ -109,3 +109,9 @@
<div id="createUserForm"></div>
</div>
</script>
<script id="user_edit_roles_tmpl" type="text/x-jquery-tmpl">
<ul>
${name}
</ul>
</script>

View File

@ -113,14 +113,8 @@ $(function() {
this.editUserBox=function(user) {
window.redbackModel.createUser=false;
clearUserMessages();
//$("#main-content #user-edit").remove();
$("#main-content").append("<div id='user-edit'></div>");
//$("#main-content #user-edit").attr("data-bind",'template: {name:"redback/user-edit-tmpl",data: user}');
$("#main-content #createUserForm").attr("data-bind",'template: {name:"redback/user-edit-tmpl",data: user}');
//$("#main-content #user-create").remove();
//$("#main-content #user-edit").show();
var viewModel = new userViewModel(user);
ko.applyBindings(viewModel,$("#main-content #createUserForm").get(0));
@ -153,6 +147,17 @@ $(function() {
user.update();
});
$.ajax("restServices/redbackServices/roleManagementService/getEffectivelyAssignedRoles/"+user.username(), {
type: "GET",
async: false,
dataType: 'json',
success: function(data) {
$( "#user-edit-roles-view" ).append( jQuery("#user_edit_roles_tmpl" ).tmpl( data.role ) );
$("#user-edit-roles-view").show();
}
}
);
}
}