if not owner don't show the "read for all" option or include it in the update sent...
authorfstamatelopoulos <devnull@localhost>
Wed, 18 Mar 2009 14:22:31 +0000 (14:22 +0000)
committerfstamatelopoulos <devnull@localhost>
Wed, 18 Mar 2009 14:22:31 +0000 (14:22 +0000)
gss/src/gr/ebs/gss/client/FilePropertiesDialog.java

index 6e2421f..a94e0b5 100644 (file)
@@ -281,14 +281,17 @@ public class FilePropertiesDialog extends DialogBox {
                        }\r
 \r
                });\r
-               permForAll.add(new Label("Read For All:"));\r
-               permForAll.add(readForAll);\r
-               permForAll.setSpacing(8);\r
-               permForAll.addStyleName("gwt-TabPanelBottom");\r
                permPanel.add(permList);\r
                permPanel.add(permButtons);\r
-               permPanel.add(permForAll);\r
-               permPanel.add(readForAllNote);\r
+               //only show the read for all perm if the user is the owner\r
+               if (file.getOwner().equals(GSS.get().getCurrentUserResource().getUsername())) {\r
+                       permForAll.add(new Label("Read For All:"));\r
+                       permForAll.add(readForAll);\r
+                       permForAll.setSpacing(8);\r
+                       permForAll.addStyleName("gwt-TabPanelBottom");\r
+                       permPanel.add(permForAll);\r
+                       permPanel.add(readForAllNote);\r
+               }\r
 \r
                VersionsList verList = new VersionsList(this, images, bodies);\r
                verPanel.add(verList);\r
@@ -314,8 +317,6 @@ public class FilePropertiesDialog extends DialogBox {
 \r
                        }\r
 \r
-\r
-\r
                });\r
                HTML removeAllVersion = new HTML("<span>Remove all previous versions?</span>");\r
                vPanel2.add(removeAllVersion);\r
@@ -396,7 +397,9 @@ public class FilePropertiesDialog extends DialogBox {
                JSONObject json = new JSONObject();\r
                json.put("name", new JSONString(name.getText()));\r
                json.put("versioned", JSONBoolean.getInstance(versioned.isChecked()));\r
-               json.put("readForAll", JSONBoolean.getInstance(readForAll.isChecked()));\r
+               //only update the read for all perm if the user is the owner\r
+               if (file.getOwner().equals(GSS.get().getCurrentUserResource().getUsername()))\r
+                       json.put("readForAll", JSONBoolean.getInstance(readForAll.isChecked()));\r
                JSONArray perma = new JSONArray();\r
                int i=0;\r
                for(PermissionHolder p : perms){\r