]> git.proxmox.com Git - pve-access-control.git/commit - PVE/API2/AccessControl.pm
API/ticket: rework coarse grained permission computation
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Thu, 14 Sep 2017 13:17:09 +0000 (15:17 +0200)
committerWolfgang Bumiller <w.bumiller@proxmox.com>
Wed, 20 Sep 2017 07:33:39 +0000 (09:33 +0200)
commita2c18811d33d7e09765a7b0f09bba47bc9523822
tree5d1c58555275883fe3abc9dc9c6363d5b044c3eb
parentec4141f4edd12647d481759ff6fc6b44789fd830
API/ticket: rework coarse grained permission computation

We accessed methods from PVE::Storage here but did not define a
"use PVE::Storage". This thus only worked if modules if the
PVE::Storage module got pulled in by something else, by luck.
Simply including said use statement is not an option because
pve-storage is already dependent from pve-access-control, and we want
to avoid cyclic dependencies, especially on the perl module level.

The reason the offending module was used in the first place here
stems from the way how this coarse grained permissions are
calculated.
We check all permission object paths for privileges for an user.
So we got all vmids and all storage ids and computed paths from them.
This works, but is overkill and led to this "illegal" module use.

Instead I opt to not generating all possible paths, but just check
the ones configured plus a small required static set of top level
paths - this allows to generalize handling of the special root@pam
and "normal" users.

It has to be noted that this method is in general just intended for a
coarse capability check to allow hiding a few UI elements which are
not generated by backend calls (which are already permission aware).
The real checks get done by each backend call, automatically for
simple ones and semi-automatically for complex ones.
PVE/API2/AccessControl.pm