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

michi at wyona.com michi at wyona.com
Tue Mar 11 01:38:24 CET 2008


Author: michi
Date: 2008-03-11 01:38:24 +0100 (Tue, 11 Mar 2008)
New Revision: 33210

Modified:
   public/yanel/contributions/ajax-components/src/access-policy-editor/java/org/wyona/security/gwt/accesspolicyeditor/client/PolicyListBoxWidget.java
Log:
add and removed rights fixed

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-11 00:24:38 UTC (rev 33209)
+++ public/yanel/contributions/ajax-components/src/access-policy-editor/java/org/wyona/security/gwt/accesspolicyeditor/client/PolicyListBoxWidget.java	2008-03-11 00:38:24 UTC (rev 33210)
@@ -197,10 +197,10 @@
                     Right[] currentRights = getRights(selectedIdentity);
                     String[] newRights;
                     if (readCB.isChecked()) {
-                        Window.alert("Add Read right from selected identity " + selectedIdentity + " from policy");
+                        Window.alert("Add Read right of selected identity " + selectedIdentity + " to policy");
                         newRights = addRight(currentRights, READ_RIGHT);
                     } else {
-                        Window.alert("Remove Read right from selected identity " + selectedIdentity + " from policy");
+                        Window.alert("Remove Read right of selected identity " + selectedIdentity + " from policy");
                         newRights = removeRight(currentRights, READ_RIGHT);
                     }
                     setSelectedListItem(newRights);
@@ -208,10 +208,10 @@
                     Right[] currentRights = getRights(selectedIdentity);
                     String[] newRights;
                     if (writeCB.isChecked()) {
-                        Window.alert("Add Write right from selected identity " + selectedIdentity + " from policy");
+                        Window.alert("Add Write right of selected identity " + selectedIdentity + " to policy");
                         newRights = addRight(currentRights, WRITE_RIGHT);
                     } else {
-                        Window.alert("Remove Write right from selected identity " + selectedIdentity + " from policy");
+                        Window.alert("Remove Write right of selected identity " + selectedIdentity + " from policy");
                         newRights = removeRight(currentRights, WRITE_RIGHT);
                     }
                     setSelectedListItem(newRights);
@@ -315,13 +315,15 @@
         // Copy all current rights
         Vector newRights = new Vector();
         for (int i = 0; i < currentRights.length; i++) {
-            newRights.add(currentRights[i].getId());
+            if (currentRights[i].getPermission()) {
+                newRights.add(currentRights[i].getId());
+            }
         }
 
         // Add new right if it doesn't exist yet
         boolean hasRightAlready = false;
         for (int i = 0; i < currentRights.length; i++) {
-            if (currentRights[i].getId().equals(right)) {
+            if (currentRights[i].getId().equals(right) && currentRights[i].getPermission()) {
                 hasRightAlready = true;
                 break;
             }
@@ -342,7 +344,7 @@
     private String[] removeRight(Right[] currentRights, String right) {
         Vector newRights = new Vector();
         for (int i = 0; i < currentRights.length; i++) {
-            if (!currentRights[i].getId().equals(right)) {
+            if (!currentRights[i].getId().equals(right) && currentRights[i].getPermission()) {
                 newRights.add(currentRights[i].getId());
             }
         }



More information about the Yanel-commits mailing list