From: Olivier Lamy Date: Fri, 23 Dec 2011 15:29:45 +0000 (+0000) Subject: start work on role management in webapp-js X-Git-Tag: archiva-1.4-M3~1695 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=03dbd14a0fff12fd3aff30d9a363345d590233c8;p=archiva.git 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 --- diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/index.html b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/index.html index 73fe81d0c..f973acff3 100644 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/index.html +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/index.html @@ -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"); diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/roles.js b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/roles.js new file mode 100644 index 000000000..f28b59216 --- /dev/null +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/roles.js @@ -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); + } + +}); \ No newline at end of file