fix: admin/fs: option "inherit" in permissions always displays "Anyone" unless the permission is set to inherit
Massimo Melina committed
May 28, 2024 at 23:02 UTC
515b3f607bb6d78732ba10648ae34e81607f704f
2 files changed
+3
-3
admin/src/FileForm.ts
+2
-2
@@ -190,8 +190,8 @@ export default function FileForm({ file, addToBar, statusApi, accounts, saved }:
190
const dontShow = [perm, ...onlyTruthy(_.map(show, (v,k) => !v && k))]
191
const others = _.difference(Object.keys(defaultPerms), dontShow)
192
let inherit = file.inherited?.[perm] ?? defaultPerms[perm]
193
- if (typeof inherit === 'string' && _.get(show, inherit) === false) // if it's false, then inherit is a perm
194
- inherit = _.get(values, inherit) ?? _.get(defaultPerms, inherit)! // ...and defaultPerms have it all
193
+ if (typeof inherit === 'string' && _.get(show, inherit) === false) // is 'inherit' referring another permission that is not displayed?
194
+ inherit = _.get(values, inherit) ?? _.get(defaultPerms, inherit)! // then show its value instead
195
return {
196
comp: WhoField,
197
k: perm, sm: 6, xl: 4,
src/api.vfs.ts
+1
-1
@@ -36,7 +36,7 @@ const apis: ApiHandlers = {
36
: { size: source ? -1 : undefined }
37
if (copyStats.mtime && Number(copyStats.mtime) === Number(copyStats.ctime))
38
delete copyStats.mtime
39
- const inherited = node.parent && permsFromParent(node.parent, node.original || node)
39
+ const inherited = node.parent && permsFromParent(node.parent, {})
40
const byMasks = node.original && _.pickBy(node, (v,k) =>
41
v !== (node.original as any)[k] // something is changing me...
42
&& !(inherited && k in inherited) // ...and it's not inheritance...