Revision 4d869bf1
b/runtime.properties | ||
---|---|---|
1 |
loginUrl=/im/login?next=/ui
|
|
1 |
loginUrl=/im/login?next= |
|
2 | 2 |
CLOUDBAR_ACTIVE_SERVICE = pithos |
3 | 3 |
CLOUDBAR_LOCATION = /static/im/cloudbar/ |
4 | 4 |
CLOUDBAR_SERVICES = /im/get_services |
b/src/gr/grnet/pithos/web/client/FilePermissionsDialog.java | ||
---|---|---|
49 | 49 |
import com.google.gwt.event.dom.client.KeyCodes; |
50 | 50 |
import com.google.gwt.http.client.Response; |
51 | 51 |
import com.google.gwt.http.client.URL; |
52 |
import com.google.gwt.http.client.UrlBuilder; |
|
53 |
import com.google.gwt.i18n.client.Dictionary; |
|
52 | 54 |
import com.google.gwt.resources.client.ImageResource; |
53 | 55 |
import com.google.gwt.user.client.Command; |
54 | 56 |
import com.google.gwt.user.client.Window; |
... | ... | |
77 | 79 |
|
78 | 80 |
private TextBox path; |
79 | 81 |
|
82 |
private Dictionary otherProperties = Dictionary.getDictionary("otherProperties"); |
|
83 |
|
|
80 | 84 |
/** |
81 | 85 |
* An image bundle for this widgets images. |
82 | 86 |
*/ |
... | ... | |
148 | 152 |
private VerticalPanel createSharingPanel() { |
149 | 153 |
VerticalPanel permPanel = new VerticalPanel(); |
150 | 154 |
|
151 |
permList = new PermissionsList(images, file.getPermissions(), file.getOwner(), false); |
|
155 |
permList = new PermissionsList(images, file.getPermissions(), file.getOwner(), false, new Command() { |
|
156 |
|
|
157 |
@Override |
|
158 |
public void execute() { |
|
159 |
accept(); |
|
160 |
} |
|
161 |
}); |
|
152 | 162 |
permPanel.add(permList); |
153 | 163 |
|
154 | 164 |
HorizontalPanel permButtons = new HorizontalPanel(); |
... | ... | |
241 | 251 |
} |
242 | 252 |
|
243 | 253 |
void showLinkIfPublished() { |
244 |
if (file.isPublished()) { |
|
245 |
path.setText(Window.Location.getHost() + file.getPublicUri()); |
|
254 |
if (file.isShared()) { |
|
255 |
UrlBuilder b = Window.Location.createUrlBuilder(); |
|
256 |
if (file.isPublished()) { |
|
257 |
b.setPath(file.getPublicUri()); |
|
258 |
path.setText(b.buildString()); |
|
259 |
} |
|
260 |
else { |
|
261 |
b.setPath(app.getApiPath() + file.getOwner() + file.getUri()); |
|
262 |
path.setText(GWT.getModuleBaseURL() + "?goto=" + b.buildString()); |
|
263 |
} |
|
246 | 264 |
pathPanel.setVisible(true); |
247 | 265 |
} |
248 | 266 |
else { |
... | ... | |
255 | 273 |
*/ |
256 | 274 |
@Override |
257 | 275 |
protected void accept() { |
258 |
final Map<String, Boolean[]> perms = (permList.hasChanges() ? permList.getPermissions() : null); |
|
259 |
|
|
260 | 276 |
Boolean published = null; |
261 | 277 |
if (readForAll.getValue() != file.isPublished()) |
262 | 278 |
if (file.getOwner().equals(app.getUsername())) |
263 | 279 |
published = readForAll.getValue(); |
264 |
updateMetaData(app.getApiPath(), app.getUsername(), file.getUri() + "?update=", published, perms);
|
|
280 |
updateMetaData(app.getApiPath(), app.getUsername(), file.getUri() + "?update=", published, permList.getPermissions());
|
|
265 | 281 |
} |
266 | 282 |
|
267 | 283 |
protected void updateMetaData(String api, String owner, final String path, final Boolean published, final Map<String, Boolean[]> newPermissions) { |
b/src/gr/grnet/pithos/web/client/FolderPermissionsDialog.java | ||
---|---|---|
119 | 119 |
|
120 | 120 |
VerticalPanel permPanel = new VerticalPanel(); |
121 | 121 |
FilePermissionsDialog.Images images = GWT.create(FilePermissionsDialog.Images.class); |
122 |
permList = new PermissionsList(images, folder.getPermissions(), folder.getOwner(), false); |
|
122 |
permList = new PermissionsList(images, folder.getPermissions(), folder.getOwner(), false, null);
|
|
123 | 123 |
permPanel.add(permList); |
124 | 124 |
|
125 | 125 |
HorizontalPanel permButtons = new HorizontalPanel(); |
b/src/gr/grnet/pithos/web/client/PermissionsList.java | ||
---|---|---|
43 | 43 |
import com.google.gwt.event.dom.client.ClickHandler; |
44 | 44 |
import com.google.gwt.event.logical.shared.ValueChangeEvent; |
45 | 45 |
import com.google.gwt.event.logical.shared.ValueChangeHandler; |
46 |
import com.google.gwt.user.client.Command; |
|
46 | 47 |
import com.google.gwt.user.client.ui.AbstractImagePrototype; |
47 | 48 |
import com.google.gwt.user.client.ui.CheckBox; |
48 | 49 |
import com.google.gwt.user.client.ui.Composite; |
... | ... | |
67 | 68 |
protected boolean hasChanges = false; |
68 | 69 |
|
69 | 70 |
private boolean readonly = false; |
71 |
|
|
72 |
Command changePermissionsCallback; |
|
70 | 73 |
|
71 |
public PermissionsList(final Images theImages, Map<String, Boolean[]> thePermissions, String theOwner, boolean inheritsPermissions){ |
|
74 |
public PermissionsList(final Images theImages, Map<String, Boolean[]> thePermissions, String theOwner, boolean inheritsPermissions, Command _changePermissionsCallback){ |
|
75 |
changePermissionsCallback = _changePermissionsCallback; |
|
72 | 76 |
images = theImages; |
73 | 77 |
owner = theOwner; |
74 | 78 |
permissions = new HashMap<String, Boolean[]>(thePermissions); |
... | ... | |
103 | 107 |
permissions.put(user, new Boolean[] {Boolean.valueOf(read), Boolean.valueOf(write)}); |
104 | 108 |
hasChanges = true; |
105 | 109 |
updatePermissionTable(); |
110 |
if (changePermissionsCallback != null) |
|
111 |
changePermissionsCallback.execute(); |
|
106 | 112 |
} |
107 | 113 |
|
108 | 114 |
/** |
... | ... | |
141 | 147 |
Boolean[] ps = permissions.get(user); |
142 | 148 |
ps[0] = booleanValueChangeEvent.getValue(); |
143 | 149 |
hasChanges = true; |
150 |
if (changePermissionsCallback != null) |
|
151 |
changePermissionsCallback.execute(); |
|
144 | 152 |
} |
145 | 153 |
}); |
146 | 154 |
write.addValueChangeHandler(new ValueChangeHandler<Boolean>() { |
... | ... | |
149 | 157 |
Boolean[] ps = permissions.get(user); |
150 | 158 |
ps[1] = booleanValueChangeEvent.getValue(); |
151 | 159 |
hasChanges = true; |
160 |
if (changePermissionsCallback != null) |
|
161 |
changePermissionsCallback.execute(); |
|
152 | 162 |
} |
153 | 163 |
}); |
154 | 164 |
PushButton removeButton = new PushButton(AbstractImagePrototype.create(images.delete()).createImage(), new ClickHandler() { |
... | ... | |
157 | 167 |
permissions.remove(user); |
158 | 168 |
updatePermissionTable(); |
159 | 169 |
hasChanges = true; |
170 |
if (changePermissionsCallback != null) |
|
171 |
changePermissionsCallback.execute(); |
|
160 | 172 |
} |
161 | 173 |
}); |
162 | 174 |
permTable.setWidget(i, 3, removeButton); |
b/src/gr/grnet/pithos/web/client/Pithos.java | ||
---|---|---|
536 | 536 |
} |
537 | 537 |
username = authSplit[0]; |
538 | 538 |
token = authSplit[1]; |
539 |
return true; |
|
540 | 539 |
} |
541 |
|
|
542 |
Cookies.setCookie(otherProperties.get("authCookie"), username + conf.cookieSeparator() + token, null, "", "/", false); |
|
540 |
else |
|
541 |
Cookies.setCookie(otherProperties.get("authCookie"), username + conf.cookieSeparator() + token, null, "", "/", false); |
|
542 |
|
|
543 |
String gotoUrl = Window.Location.getParameter("goto"); |
|
544 |
if (gotoUrl != null && gotoUrl.length() > 0) { |
|
545 |
Window.Location.assign(gotoUrl + "?X-Auth-Token=" + token); |
|
546 |
return false; |
|
547 |
} |
|
543 | 548 |
return true; |
544 | 549 |
} |
545 | 550 |
|
... | ... | |
548 | 553 |
*/ |
549 | 554 |
protected void authenticateUser() { |
550 | 555 |
Dictionary otherProperties = Dictionary.getDictionary("otherProperties"); |
551 |
Window.Location.assign(otherProperties.get("loginUrl")); |
|
556 |
Window.Location.assign(otherProperties.get("loginUrl") + Window.Location.getHref());
|
|
552 | 557 |
} |
553 | 558 |
|
554 | 559 |
protected void fetchAccount(final Command callback) { |
b/src/gr/grnet/pithos/web/client/foldertree/File.java | ||
---|---|---|
228 | 228 |
this.owner = _owner; |
229 | 229 |
published = false; |
230 | 230 |
publicUri = null; |
231 |
permissions.clear(); |
|
231 | 232 |
for (Header h : response.getHeaders()) { |
232 | 233 |
if (h == null) |
233 | 234 |
continue; //IE bug. h cannot be null in the general case |
b/src/gr/grnet/pithos/web/public/index.html | ||
---|---|---|
66 | 66 |
</script> |
67 | 67 |
<script> |
68 | 68 |
var otherProperties = { |
69 |
loginUrl: "/im/login?next=/ui",
|
|
69 |
loginUrl: "/im/login?next=", |
|
70 | 70 |
authCookie: "_pithos2_a" |
71 | 71 |
} |
72 | 72 |
</script> |
Also available in: Unified diff