|
15 | 15 | * GNU General Public License for more details. |
16 | 16 | */ |
17 | 17 |
|
18 | | -import ch.cyberduck.core.Acl; |
19 | 18 | import ch.cyberduck.core.LocaleFactory; |
20 | 19 | import ch.cyberduck.core.Path; |
21 | 20 | import ch.cyberduck.core.VersionId; |
|
35 | 34 | import java.util.Collections; |
36 | 35 | import java.util.List; |
37 | 36 |
|
38 | | -import static ch.cyberduck.core.deepbox.DeepboxAttributesFinderFeature.CANADDCHILDREN; |
39 | | - |
40 | 37 | public class DeepboxDirectoryFeature implements Directory<VersionId> { |
41 | 38 | private static final Logger log = LogManager.getLogger(DeepboxDirectoryFeature.class); |
42 | 39 |
|
@@ -92,36 +89,10 @@ public Path mkdir(final Path folder, final TransferStatus status) throws Backgro |
92 | 89 |
|
93 | 90 | @Override |
94 | 91 | 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 | | - } |
113 | 92 | if(containerService.isInbox(workdir)) { |
114 | 93 | throw new AccessDeniedException(LocaleFactory.localizedString("Adding folders is not permitted in the inbox", "Deepbox")).withFile(workdir); |
115 | 94 | } |
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); |
126 | 97 | } |
127 | 98 | } |
0 commit comments