On 25/02/2022 11:13, Dominik Csapak wrote:
>>> -        enableFn: rec => caps.access['User.Modify'] && rec.data.userid !== 
>>> 'root@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.


_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to