Commit 6eeff38d authored by Matija Obreza's avatar Matija Obreza

Fix: ACL for roles

- Make folders publicly readable
parent 7f566b0c
...@@ -187,12 +187,8 @@ public class PermissionController { ...@@ -187,12 +187,8 @@ public class PermissionController {
* *
* @param term the term * @param term the term
* @return the map * @return the map
* @deprecated Will be deprecated in 1.7
*/ */
@Deprecated private Map<String, Long> acUser(@RequestParam("term") final String term) {
// TODO remove
@GetMapping(value = "/autocompleteuser", produces = MediaType.APPLICATION_JSON_VALUE)
public Map<String, Long> acUser(@RequestParam("term") final String term) {
final Map<String, Long> userIds = new HashMap<>(); final Map<String, Long> userIds = new HashMap<>();
for (final User user : userService.autocompleteUser(term, 10)) { for (final User user : userService.autocompleteUser(term, 10)) {
userIds.put(user.getEmail(), user.getId()); userIds.put(user.getEmail(), user.getId());
...@@ -205,12 +201,8 @@ public class PermissionController { ...@@ -205,12 +201,8 @@ public class PermissionController {
* *
* @param term the term * @param term the term
* @return the map * @return the map
* @deprecated Will be deprecated in 1.7
*/ */
@Deprecated private Map<String, Long> acRole(@RequestParam("term") final String term) {
// TODO remove
@GetMapping(value = "/autocompleterole", produces = MediaType.APPLICATION_JSON_VALUE)
public Map<String, Long> acRole(@RequestParam("term") final String term) {
final Map<String, Long> roleSids = new HashMap<>(); final Map<String, Long> roleSids = new HashMap<>();
final List<UserRole> matchingRoles = Arrays.stream(UserRole.values()).filter(role -> role.name().toLowerCase().startsWith(term.toLowerCase())).collect(Collectors.toList()); final List<UserRole> matchingRoles = Arrays.stream(UserRole.values()).filter(role -> role.name().toLowerCase().startsWith(term.toLowerCase())).collect(Collectors.toList());
...@@ -227,12 +219,8 @@ public class PermissionController { ...@@ -227,12 +219,8 @@ public class PermissionController {
* *
* @param term the term * @param term the term
* @return the map * @return the map
* @deprecated Will be deprecated in 1.7
*/ */
@Deprecated private Map<String, Long> acOauthClient(@RequestParam("term") final String term) {
// TODO remove
@GetMapping(value = "/autocomplete-oauth-client", produces = MediaType.APPLICATION_JSON_VALUE)
public Map<String, Long> acOauthClient(@RequestParam("term") final String term) {
final Map<String, Long> oauthMap = new HashMap<>(); final Map<String, Long> oauthMap = new HashMap<>();
for (final OAuthClient client : clientDetailsService.autocompleteClients(term, 10)) { for (final OAuthClient client : clientDetailsService.autocompleteClients(term, 10)) {
oauthMap.put(client.getTitle(), client.getId()); oauthMap.put(client.getTitle(), client.getId());
......
...@@ -86,6 +86,7 @@ public class ApplicationUpgrades implements InitializingBean { ...@@ -86,6 +86,7 @@ public class ApplicationUpgrades implements InitializingBean {
for (RepositoryFolder repositoryFolder : repositoryService.getFolders(Paths.get("/"))) { for (RepositoryFolder repositoryFolder : repositoryService.getFolders(Paths.get("/"))) {
LOG.warn("Making {} publicly readable", repositoryFolder.getPath()); LOG.warn("Making {} publicly readable", repositoryFolder.getPath());
aclService.addCreatorPermissions(repositoryFolder); aclService.addCreatorPermissions(repositoryFolder);
aclService.makePubliclyReadable(repositoryFolder, true);
repositoryService.listPaths(repositoryFolder.getFolderPath()).forEach(subFolder -> { repositoryService.listPaths(repositoryFolder.getFolderPath()).forEach(subFolder -> {
aclService.addCreatorPermissions(subFolder); aclService.addCreatorPermissions(subFolder);
......
...@@ -92,7 +92,7 @@ ...@@ -92,7 +92,7 @@
<select class="required form-control" name="uuid" id="" title="roles"> <select class="required form-control" name="uuid" id="" title="roles">
<option disabled="disabled" selected="selected">SELECT ROLE</option> <option disabled="disabled" selected="selected">SELECT ROLE</option>
<c:forEach var="role" items="${roles}"> <c:forEach var="role" items="${roles}">
<option value="${role}"><c:out value="${role}"/></option> <option value="ROLE_${role}"><c:out value="${role}"/></option>
</c:forEach> </c:forEach>
<option value="ANONYMOUS"><c:out value="Anonymous"/></option> <option value="ANONYMOUS"><c:out value="Anonymous"/></option>
</select> </select>
...@@ -145,13 +145,14 @@ ...@@ -145,13 +145,14 @@
beforeSend: function (xhr) { beforeSend: function (xhr) {
}, },
success: function (respObject) { /* success: function (respObject) {
window.location.reload(); window.location.reload();
console.log(respObject); console.log(respObject);
}, }, */
error: function (jqXHR, textStatus, errorThrown) { error: function (jqXHR, textStatus, errorThrown) {
console.log(textStatus); console.log(textStatus);
console.log(errorThrown); console.log(errorThrown);
window.location.reload();
} }
}); });
}); });
...@@ -177,13 +178,14 @@ ...@@ -177,13 +178,14 @@
beforeSend: function (xhr) { beforeSend: function (xhr) {
}, },
success: function (respObject) { /* success: function (respObject) {
window.location.reload(); window.location.reload();
console.log(respObject); console.log(respObject);
}, }, */
error: function (jqXHR, textStatus, errorThrown) { error: function (jqXHR, textStatus, errorThrown) {
console.log(textStatus); console.log(textStatus);
console.log(errorThrown); console.log(errorThrown);
window.location.reload();
} }
}); });
}); });
...@@ -214,13 +216,14 @@ ...@@ -214,13 +216,14 @@
beforeSend : function(xhr) { beforeSend : function(xhr) {
}, },
success : function(respObject) { /* success : function(respObject) {
window.location.reload(); window.location.reload();
console.log(respObject); console.log(respObject);
}, }, */
error: function(jqXHR, textStatus, errorThrown) { error: function(jqXHR, textStatus, errorThrown) {
console.log(textStatus); console.log(textStatus);
console.log(errorThrown); console.log(errorThrown);
window.location.reload();
} }
}); });
}); });
...@@ -253,13 +256,14 @@ ...@@ -253,13 +256,14 @@
beforeSend : function(xhr) { beforeSend : function(xhr) {
}, },
success : function(respObject) { /* success : function(respObject) {
window.location.reload(); window.location.reload();
console.log(respObject); console.log(respObject);
}, }, */
error: function(jqXHR, textStatus, errorThrown) { error: function(jqXHR, textStatus, errorThrown) {
console.log(textStatus); console.log(textStatus);
console.log(errorThrown); console.log(errorThrown);
window.location.reload();
} }
}); });
}); });
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment