[Yanel-commits] rev 32752 - public/yanel/contributions/ajax-components/src/access-policy-editor/java/org/wyona/security/gwt/accesspolicyeditor/client

michi at wyona.com michi at wyona.com
Sun Mar 2 22:25:33 CET 2008


Author: michi
Date: 2008-03-02 22:25:32 +0100 (Sun, 02 Mar 2008)
New Revision: 32752

Added:
   public/yanel/contributions/ajax-components/src/access-policy-editor/java/org/wyona/security/gwt/accesspolicyeditor/client/AsynchronousPolicySetter.java
Modified:
   public/yanel/contributions/ajax-components/src/access-policy-editor/java/org/wyona/security/gwt/accesspolicyeditor/client/AccessPolicyEditor.java
   public/yanel/contributions/ajax-components/src/access-policy-editor/java/org/wyona/security/gwt/accesspolicyeditor/client/AsynchronousPolicyGetter.java
   public/yanel/contributions/ajax-components/src/access-policy-editor/java/org/wyona/security/gwt/accesspolicyeditor/client/PolicyListBoxWidget.java
Log:
saving started and reading use inheritance of policies

Modified: public/yanel/contributions/ajax-components/src/access-policy-editor/java/org/wyona/security/gwt/accesspolicyeditor/client/AccessPolicyEditor.java
===================================================================
--- public/yanel/contributions/ajax-components/src/access-policy-editor/java/org/wyona/security/gwt/accesspolicyeditor/client/AccessPolicyEditor.java	2008-03-02 20:49:08 UTC (rev 32751)
+++ public/yanel/contributions/ajax-components/src/access-policy-editor/java/org/wyona/security/gwt/accesspolicyeditor/client/AccessPolicyEditor.java	2008-03-02 21:25:32 UTC (rev 32752)
@@ -85,8 +85,16 @@
         HorizontalPanel hp = new HorizontalPanel();
         vp.add(hp);
         //vp.add(new Button("Apply Policy"));
-        vp.add(new Button("Save Policy and Exit"));
 
+        // Save Button
+        final String savePolicyUrl = savePolicyURL;
+        Button saveButton = new Button("Save Policy and Exit", new ClickListener() {
+            public void onClick(Widget sender) {
+                final AsynchronousPolicySetter aps = new AsynchronousPolicySetter(savePolicyUrl);
+            }
+        });
+        vp.add(saveButton);
+
         // Cancel Button
         final String cancelUrl = cancelURL;
         Button cancelButton = new Button("Cancel", new ClickListener() {
@@ -166,7 +174,11 @@
                     } else {
                         policyIdentities = apg.getIdentities();
                         // "Redraw" Listbox
-                        policyLBW.set(visibleItemCount, policyIdentities);
+                        policyLBW.setIdentities(visibleItemCount, policyIdentities);
+
+                        boolean useInheritedPolicies = apg.getUseInheritedPolicies();
+                        policyLBW.setInheritRightsFlag(useInheritedPolicies);
+
                         this.cancel();
                         Window.alert("Policy has been loaded!");
                     }

Modified: public/yanel/contributions/ajax-components/src/access-policy-editor/java/org/wyona/security/gwt/accesspolicyeditor/client/AsynchronousPolicyGetter.java
===================================================================
--- public/yanel/contributions/ajax-components/src/access-policy-editor/java/org/wyona/security/gwt/accesspolicyeditor/client/AsynchronousPolicyGetter.java	2008-03-02 20:49:08 UTC (rev 32751)
+++ public/yanel/contributions/ajax-components/src/access-policy-editor/java/org/wyona/security/gwt/accesspolicyeditor/client/AsynchronousPolicyGetter.java	2008-03-02 21:25:32 UTC (rev 32752)
@@ -31,6 +31,7 @@
  */
 public class AsynchronousPolicyGetter extends AsynchronousAgent {
 
+    boolean useInheritedPolicies = true;
     Vector identities = new Vector();
 
     /**
@@ -49,6 +50,16 @@
         //Window.alert("Root element: " + rootElement.getTagName());
 
 	// TODO: Parse inherit rights from parent
+        String useInheritedPoliciesString = rootElement.getAttribute("use-inherited-policies");
+        if (useInheritedPoliciesString == null) {
+            useInheritedPolicies = true;
+        } else {
+            if (useInheritedPoliciesString.equals("false")) {
+                useInheritedPolicies = false;
+            } else {
+                useInheritedPolicies = true;
+            }
+        }
 
         // TODO: Parse rights and use labels for formatting, e.g. "u: (Read,Write) benjamin", "u: (Read,-) susi"
 
@@ -85,6 +96,13 @@
     }
 
     /**
+     * Get flag use-inherited-policies
+     */
+    public boolean getUseInheritedPolicies() {
+        return useInheritedPolicies;
+    }
+
+    /**
      *
      */
     private Element getFirstChildElement(Element parent, String name) {

Added: public/yanel/contributions/ajax-components/src/access-policy-editor/java/org/wyona/security/gwt/accesspolicyeditor/client/AsynchronousPolicySetter.java
===================================================================
--- public/yanel/contributions/ajax-components/src/access-policy-editor/java/org/wyona/security/gwt/accesspolicyeditor/client/AsynchronousPolicySetter.java	                        (rev 0)
+++ public/yanel/contributions/ajax-components/src/access-policy-editor/java/org/wyona/security/gwt/accesspolicyeditor/client/AsynchronousPolicySetter.java	2008-03-02 21:25:32 UTC (rev 32752)
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2008 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.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.
+ */
+package org.wyona.security.gwt.accesspolicyeditor.client;
+
+/*
+import org.wyona.yanel.gwt.client.AsynchronousAgent;
+
+import com.google.gwt.http.client.Request;
+import com.google.gwt.http.client.Response;
+import com.google.gwt.xml.client.Element;
+import com.google.gwt.xml.client.NodeList;
+import com.google.gwt.xml.client.XMLParser;
+
+import java.util.Vector;
+*/
+
+import com.google.gwt.user.client.Window;
+
+/**
+ *
+ */
+public class AsynchronousPolicySetter {
+//public class AsynchronousPolicySetter extends AsynchronousAgent {
+
+    /**
+     *
+     */
+    public AsynchronousPolicySetter(String url) {
+        //super(url);
+        Window.alert("Save policy to: " + url);
+    }
+}

Modified: public/yanel/contributions/ajax-components/src/access-policy-editor/java/org/wyona/security/gwt/accesspolicyeditor/client/PolicyListBoxWidget.java
===================================================================
--- public/yanel/contributions/ajax-components/src/access-policy-editor/java/org/wyona/security/gwt/accesspolicyeditor/client/PolicyListBoxWidget.java	2008-03-02 20:49:08 UTC (rev 32751)
+++ public/yanel/contributions/ajax-components/src/access-policy-editor/java/org/wyona/security/gwt/accesspolicyeditor/client/PolicyListBoxWidget.java	2008-03-02 21:25:32 UTC (rev 32752)
@@ -58,7 +58,7 @@
 
         lb = new ListBox(true);
         lb.addClickListener(this);
-        set(visibleItemCount, identities);
+        setIdentities(visibleItemCount, identities);
         vp.add(lb);
 
         readCB = new CheckBox("Read");
@@ -72,7 +72,7 @@
     /**
      *
      */
-    public void set(int visibleItemCount, String[] identities) {
+    public void setIdentities(int visibleItemCount, String[] identities) {
         lb.clear();
         lb.setVisibleItemCount(visibleItemCount);
         if (identities != null) {
@@ -87,6 +87,14 @@
     /**
      *
      */
+    public void setInheritRightsFlag(boolean useInheritedPolicies) {
+        Window.alert("Set inherit rights checkbox: " + useInheritedPolicies);
+        //policyInheritanceCB.setChecked(useInheritedPolicies);
+    }
+
+    /**
+     *
+     */
     public ListBox getListBox() {
         return lb;
     }



More information about the Yanel-commits mailing list