]> source.dussan.org Git - archiva.git/commitdiff
start work on role management in webapp-js
authorOlivier Lamy <olamy@apache.org>
Fri, 23 Dec 2011 15:29:45 +0000 (15:29 +0000)
committerOlivier Lamy <olamy@apache.org>
Fri, 23 Dec 2011 15:29:45 +0000 (15:29 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1222704 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/index.html
archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/roles.js [new file with mode: 0644]

index 73fe81d0c6a3b1a492b8ab0dac1a8203d0e160fe..f973acff3e610ce2ec5d0b05f8b4fa8b1181ca3d 100644 (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>
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 (file)
index 0000000..f28b592
--- /dev/null
@@ -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