File tree 1 file changed +35
-1
lines changed
packages/backend/src/filesystem
1 file changed +35
-1
lines changed Original file line number Diff line number Diff line change @@ -137,7 +137,7 @@ class FilesystemService extends AdvancedBase {
137
137
matcher : permission => {
138
138
return permission . startsWith ( 'fs:' ) ;
139
139
} ,
140
- checker : async ( actor , permission ) => {
140
+ checker : async ( { actor, permission } ) => {
141
141
if ( ! ( actor . type instanceof UserActorType ) ) {
142
142
return undefined ;
143
143
}
@@ -162,6 +162,40 @@ class FilesystemService extends AdvancedBase {
162
162
return { } ;
163
163
}
164
164
165
+ return undefined ;
166
+ } ,
167
+ } ) ) ;
168
+ svc_permission . register_implicator ( PermissionImplicator . create ( {
169
+ matcher : permission => {
170
+ return permission . startsWith ( 'fs:' ) ;
171
+ } ,
172
+ checker : async ( { actor, permission, recurse } ) => {
173
+ const parts = PermissionUtil . split ( permission ) ;
174
+ if ( parts . length < 3 ) return undefined ;
175
+
176
+ const specified_mode = parts [ 2 ] ;
177
+
178
+ const mode = {
179
+ write : 'read' ,
180
+ read : 'list' ,
181
+ list : 'see' ,
182
+ } [ specified_mode ] ;
183
+
184
+ if ( ! mode ) return undefined ;
185
+
186
+ const perm = await recurse ( actor ,
187
+ PermissionUtil . join (
188
+ parts [ 0 ] ,
189
+ parts [ 1 ] ,
190
+ mode ,
191
+ ...parts . slice ( 3 ) ,
192
+ )
193
+ )
194
+ if ( perm ) {
195
+ console . log ( 'RETURNING IT!' , perm ) ;
196
+ return perm ;
197
+ }
198
+
165
199
return undefined ;
166
200
} ,
167
201
} ) ) ;
You can’t perform that action at this time.
0 commit comments