Fix parameters to assume role.

This commit is contained in:
David Kocher
2026-05-09 10:13:19 +02:00
parent 14161e2c19
commit 654598c868
4 changed files with 6 additions and 10 deletions
@@ -116,10 +116,6 @@ public class CteraAttributesFinderFeature extends DAVAttributesFinderFeature {
* @throws AccessDeniedException ACLs do not contain role
*/
protected static void assumeRole(final Path file, final Acl.Role role) throws BackgroundException {
assumeRole(file, file.getName(), role);
}
protected static void assumeRole(final Path file, final String filename, final Acl.Role role) throws BackgroundException {
final Acl acl = file.attributes().getAcl();
if(acl == Acl.EMPTY) {
log.warn("Missing ACL for {}", file);
@@ -134,11 +130,11 @@ public class CteraAttributesFinderFeature extends DAVAttributesFinderFeature {
log.warn("ACL {} for {} does not include {}", acl, file, role);
if(role == READPERMISSION) {
throw new AccessDeniedException(MessageFormat.format(LocaleFactory.localizedString("Download {0} failed", "Error"),
filename)).withFile(file);
file.getName())).withFile(file);
}
if(role == WRITEPERMISSION) {
throw new AccessDeniedException(MessageFormat.format(LocaleFactory.localizedString("Upload {0} failed", "Error"),
filename)).withFile(file);
file.getName())).withFile(file);
}
if(role == DELETEPERMISSION) {
throw new AccessDeniedException(MessageFormat.format(
@@ -146,7 +142,7 @@ public class CteraAttributesFinderFeature extends DAVAttributesFinderFeature {
}
if(role == CREATEDIRECTORIESPERMISSION) {
throw new AccessDeniedException(MessageFormat.format(LocaleFactory.localizedString("Cannot create folder {0}", "Error"),
filename)).withFile(file);
file.getName())).withFile(file);
}
throw new AccessDeniedException(MessageFormat.format(
LocaleFactory.localizedString("Cannot create {0}", "Error"), file.getName())).withFile(file);
@@ -37,7 +37,7 @@ public class CteraCopyFeature extends DAVCopyFeature {
assumeRole(target, WRITEPERMISSION);
// no createfilespermission required for now
if(source.isDirectory()) {
assumeRole(target.getParent(), target.getName(), CREATEDIRECTORIESPERMISSION);
assumeRole(target, CREATEDIRECTORIESPERMISSION);
}
}
}
@@ -40,7 +40,7 @@ public class CteraDirectoryFeature extends DAVDirectoryFeature {
if(!validate(filename.get())) {
throw new InvalidFilenameException(MessageFormat.format(LocaleFactory.localizedString("Cannot create folder {0}", "Error"), filename));
}
assumeRole(workdir, filename.get(), CREATEDIRECTORIESPERMISSION);
}
assumeRole(workdir, CREATEDIRECTORIESPERMISSION);
}
}
@@ -44,7 +44,7 @@ public class CteraMoveFeature extends DAVMoveFeature {
assumeRole(target, WRITEPERMISSION);
// no createfilespermission required for now
if(source.isDirectory()) {
assumeRole(target.getParent(), target.getName(), CREATEDIRECTORIESPERMISSION);
assumeRole(target, CREATEDIRECTORIESPERMISSION);
}
}
}