start work on role management in webapp-js

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1222704 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2011-12-23 15:29:45 +00:00
parent 41fc625ade
commit 03dbd14a0f
2 changed files with 49 additions and 0 deletions

View File

@ -63,6 +63,7 @@
.script("redback/users.js").wait()
.script("redback/redback.js").wait()
.script("redback/register.js").wait()
.script("redback/roles.js").wait()
.script("archiva/main.js");
</script>

View File

@ -0,0 +1,48 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
$(function() {
role = function(name,description){
this.name = name;
this.description = description;
}
displayRolesGrid = function(){
$.ajax("restServices/redbackServices/roleManagementService/allRoles",
{
type: "GET",
async: false,
dataType: 'json',
success: function(data) {
var roles = $.map(data.role, function(item) {
return mapRole(item);
});
}
}
);
}
/**
* @param data Role response from redback rest api
*/
mapRole=function(data) {
return new role(data.name, data.description);
}
});