[pve-devel] [PATCH v1 manager 4/5] change 'root at pam' checks with 'SuperUser' capability check

Thomas Lamprecht t.lamprecht at proxmox.com
Fri Feb 25 13:24:01 CET 2022


On 25/02/2022 11:13, Dominik Csapak wrote:
>>> -        enableFn: rec => caps.access['User.Modify'] && rec.data.userid !== 'root at pam',
>>> +        enableFn: rec => caps.access['User.Modify'] && !caps.access.SuperUser,
>> no rationale given for the different way of accessing - I'll leave it to
>> more JS affine reviewers to decide whether this is sensible or not, but
>> please provide the reason WHY this doesn't use `caps.access['SuperUser']`
> 
> just to give the reason:
> 
> eslint complains if we use foo['bar'] when we could use foo.bar
> 
> we prefer 'dot-notation' (so foo.bar.baz) for objects, but in
> all other cases of the caps object that does not work because
> the keys themselves contain a '.'

one just add a comment to tell eslint to ignore that one in that case
though, else this may always look a bit weird to people reading over the
code by accident.





More information about the pve-devel mailing list