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 8910abc8b96bab2c8539e4dee09ec27602a4e1df
2 files changed +3 -3
admin/src/FileForm.ts
+2 -2
@@ -182,8 +182,8 @@ export default function FileForm({ file, addToBar, statusApi, accounts, saved }:
182 const dontShow = [perm, ...onlyTruthy(_.map(show, (v,k) => !v && k))]
183 const others = _.difference(Object.keys(defaultPerms), dontShow)
184 let inherit = file.inherited?.[perm] ?? defaultPerms[perm]
185 - if (typeof inherit === 'string' && _.get(show, inherit) === false) // if it's false, then inherit is a perm
186 - inherit = _.get(values, inherit) ?? _.get(defaultPerms, inherit)! // ...and defaultPerms have it all
185 + if (typeof inherit === 'string' && _.get(show, inherit) === false) // is 'inherit' referring another permission that is not displayed?
186 + inherit = _.get(values, inherit) ?? _.get(defaultPerms, inherit)! // then show its value instead
187 return {
188 comp: WhoField,
189 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...