[Yanel-commits] rev 45576 - in public/yanel/trunk/src/resources/user-mgmt: . htdocs src/java/org/wyona/yanel/impl/resources src/java/org/wyona/yanel/impl/resources/usermgmt

michi at wyona.com michi at wyona.com
Wed Nov 18 14:40:34 CET 2009


Author: michi
Date: 2009-11-18 14:40:34 +0100 (Wed, 18 Nov 2009)
New Revision: 45576

Added:
   public/yanel/trunk/src/resources/user-mgmt/htdocs/view-group.jelly
   public/yanel/trunk/src/resources/user-mgmt/resource-view-group.xml
   public/yanel/trunk/src/resources/user-mgmt/src/java/org/wyona/yanel/impl/resources/usermgmt/
   public/yanel/trunk/src/resources/user-mgmt/src/java/org/wyona/yanel/impl/resources/usermgmt/ViewGroupResource.java
Log:
view group resource started

Added: public/yanel/trunk/src/resources/user-mgmt/htdocs/view-group.jelly
===================================================================
--- public/yanel/trunk/src/resources/user-mgmt/htdocs/view-group.jelly	                        (rev 0)
+++ public/yanel/trunk/src/resources/user-mgmt/htdocs/view-group.jelly	2009-11-18 13:40:34 UTC (rev 45576)
@@ -0,0 +1,26 @@
+<?xml version="1.0"?>
+<j:jelly xmlns:j="jelly:core">
+  <html xmlns="http://www.w3.org/1999/xhtml">
+    <body>
+      <h1>View Group: ${resource.getParameterAsString('groupID')}</h1>
+      <p>${resource.getErrorMessages()}</p>
+      <table>
+        <tr>
+          <td>ID:</td><td>&#160;</td><td>${resource.getParameterAsString('groupID')}</td>
+        </tr>
+        <tr>
+          <td>Name:</td><td></td><td>${resource.getGroup().getName()}</td>
+        </tr>
+        <tr>
+          <td>Members:</td>
+          <td></td>
+          <td>
+            <ul>
+              <li>TODO</li>
+            </ul>
+          </td>
+        </tr>
+      </table>
+    </body>
+  </html>
+</j:jelly>

Added: public/yanel/trunk/src/resources/user-mgmt/resource-view-group.xml
===================================================================
--- public/yanel/trunk/src/resources/user-mgmt/resource-view-group.xml	                        (rev 0)
+++ public/yanel/trunk/src/resources/user-mgmt/resource-view-group.xml	2009-11-18 13:40:34 UTC (rev 45576)
@@ -0,0 +1,15 @@
+<?xml version="1.0"?>
+
+<resource xmlns="http://www.wyona.org/yanel/1.0"
+  name="view-group"
+  namespace="http://www.wyona.org/yanel/resource/1.0"
+  class="org.wyona.yanel.impl.resources.usermgmt.ViewGroupResource"
+  >
+<description>
+View group
+</description>
+
+<rtd>
+  <property name="xslt"/>
+</rtd>
+</resource>

Added: public/yanel/trunk/src/resources/user-mgmt/src/java/org/wyona/yanel/impl/resources/usermgmt/ViewGroupResource.java
===================================================================
--- public/yanel/trunk/src/resources/user-mgmt/src/java/org/wyona/yanel/impl/resources/usermgmt/ViewGroupResource.java	                        (rev 0)
+++ public/yanel/trunk/src/resources/user-mgmt/src/java/org/wyona/yanel/impl/resources/usermgmt/ViewGroupResource.java	2009-11-18 13:40:34 UTC (rev 45576)
@@ -0,0 +1,57 @@
+/*
+ * Copyright 2006 Wyona
+ *
+ *  Licensed 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.wyona.org/licenses/APACHE-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.
+ */
+
+package org.wyona.yanel.impl.resources.usermgmt;
+
+import org.apache.log4j.Category;
+
+import org.wyona.security.core.api.AccessManagementException;
+import org.wyona.security.core.api.Group;
+import org.wyona.security.core.api.GroupManager;
+import org.wyona.yanel.impl.resources.usecase.ExecutableUsecaseResource;
+import org.wyona.yanel.impl.resources.usecase.UsecaseException;
+
+/**
+ * View group (id, name, members, etc.)
+ */
+public class ViewGroupResource extends ExecutableUsecaseResource {
+
+    private static Category log = Category.getInstance(ViewGroupResource.class);
+    
+    private static final String PARAM_GROUP_ID = "groupID";
+
+    public void execute() throws UsecaseException {
+        try {
+            String id = getParameterAsString(PARAM_GROUP_ID);
+            if (log.isDebugEnabled()) {
+                log.debug("deleting group: " + id);
+            }
+            GroupManager groupManager = getRealm().getIdentityManager().getGroupManager();
+            groupManager.removeGroup(id);
+            addInfoMessage("Group " + id + " deleted successfully.");
+        } catch (AccessManagementException e) {
+            log.error(e, e);
+            throw new UsecaseException(e.getMessage(), e);
+        }
+    }
+    
+    public Group getGroup() throws AccessManagementException {
+        String id = getParameterAsString(PARAM_GROUP_ID);
+        GroupManager groupManager = getRealm().getIdentityManager().getGroupManager();
+        Group group = groupManager.getGroup(id);
+        return group;
+    }
+}



More information about the Yanel-commits mailing list