Skip to content

Commit 6e37f91

Browse files
committed
Reuse implementation.
1 parent 13a73f7 commit 6e37f91

File tree

1 file changed

+2
-31
lines changed

1 file changed

+2
-31
lines changed

deepbox/src/main/java/ch/cyberduck/core/deepbox/DeepboxDirectoryFeature.java

Lines changed: 2 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
* GNU General Public License for more details.
1616
*/
1717

18-
import ch.cyberduck.core.Acl;
1918
import ch.cyberduck.core.LocaleFactory;
2019
import ch.cyberduck.core.Path;
2120
import ch.cyberduck.core.VersionId;
@@ -35,8 +34,6 @@
3534
import java.util.Collections;
3635
import java.util.List;
3736

38-
import static ch.cyberduck.core.deepbox.DeepboxAttributesFinderFeature.CANADDCHILDREN;
39-
4037
public class DeepboxDirectoryFeature implements Directory<VersionId> {
4138
private static final Logger log = LogManager.getLogger(DeepboxDirectoryFeature.class);
4239

@@ -92,36 +89,10 @@ public Path mkdir(final Path folder, final TransferStatus status) throws Backgro
9289

9390
@Override
9491
public void preflight(final Path workdir, final String filename) throws BackgroundException {
95-
if(workdir.isRoot()) {
96-
throw new AccessDeniedException(LocaleFactory.localizedString("Adding files is not permitted in this area", "Deepbox")).withFile(workdir);
97-
}
98-
if(containerService.isCompany(workdir)) {
99-
throw new AccessDeniedException(LocaleFactory.localizedString("Adding files is not permitted at the organisation level", "Deepbox")).withFile(workdir);
100-
}
101-
if(containerService.isDeepbox(workdir)) {
102-
throw new AccessDeniedException(LocaleFactory.localizedString("Adding files is not permitted in this area", "Deepbox")).withFile(workdir);
103-
}
104-
if(containerService.isTrash(workdir)) {
105-
throw new AccessDeniedException(LocaleFactory.localizedString("Adding files is not permitted in this area", "Deepbox")).withFile(workdir);
106-
}
107-
if(containerService.isSharedWithMe(workdir)) {
108-
throw new AccessDeniedException(LocaleFactory.localizedString("Adding files is not permitted in this area", "Deepbox")).withFile(workdir);
109-
}
110-
if(containerService.isBox(workdir)) {
111-
throw new AccessDeniedException(LocaleFactory.localizedString("Adding files is not permitted in the boxes area", "Deepbox")).withFile(workdir);
112-
}
11392
if(containerService.isInbox(workdir)) {
11493
throw new AccessDeniedException(LocaleFactory.localizedString("Adding folders is not permitted in the inbox", "Deepbox")).withFile(workdir);
11594
}
116-
final Acl acl = workdir.attributes().getAcl();
117-
if(Acl.EMPTY == acl) {
118-
// Missing initialization
119-
log.warn("Unknown ACLs on {}", workdir);
120-
return;
121-
}
122-
if(!acl.get(new Acl.CanonicalUser()).contains(CANADDCHILDREN)) {
123-
log.warn("ACL {} for {} does not include {}", acl, workdir, CANADDCHILDREN);
124-
throw new AccessDeniedException(LocaleFactory.localizedString("Adding files is not permitted in this area", "Deepbox")).withFile(workdir);
125-
}
95+
// Same checks as for new file
96+
new DeepboxTouchFeature(session, fileid).preflight(workdir, filename);
12697
}
12798
}

0 commit comments

Comments
 (0)