On September 9, 2020 9:00 pm, Thomas Lamprecht wrote: > On 06.07.20 14:45, Tim Marx wrote: >> Signed-off-by: Tim Marx <t.m...@proxmox.com> >> --- >> * no changes > > Maybe we could merge this into the "/access/permissions" endpoint, maybe with > a > "heurisitic" parameter?
IIRC Dominik wanted to slowly replace the caps with permissions anyway, the caps are just (still) there because that hasn't happened yet. I am also not sure whether tokens are a good fit for the regular Web GUI - the fact that tickets expire and you are not permanently logged in is a feature there IMHO ;) also, permissions has a return schema already, while it does 'match' from a structural point of view (a two-level deep hash), it is something altogether different semantically. TL;DR: iff we really need this, then I'd put it in a separate API call. >> PVE/API2/AccessControl.pm | 29 +++++++++++++++++++++++++++++ >> 1 file changed, 29 insertions(+) >> >> diff --git a/PVE/API2/AccessControl.pm b/PVE/API2/AccessControl.pm >> index fd27786..66319cc 100644 >> --- a/PVE/API2/AccessControl.pm >> +++ b/PVE/API2/AccessControl.pm >> @@ -718,4 +718,33 @@ __PACKAGE__->register_method({ >> return $res; >> }}); >> >> +__PACKAGE__->register_method({ >> + name => 'uicapabilities', >> + path => 'uicapabilities', >> + method => 'GET', >> + description => 'Retrieve user interface capabilities for calling >> user/token.', >> + permissions => { >> + description => "Each user/token is allowed to retrieve their own >> capabilities.", >> + user => 'all', >> + }, >> + parameters => {}, >> + returns => { >> + type => 'object', >> + properties => { >> + cap => { >> + type => 'object', >> + description => 'The user interface capabilities of the calling >> user/token' >> + } >> + }, >> + }, >> + code => sub { >> + my ($param) = @_; >> + >> + my $rpcenv = PVE::RPCEnvironment::get(); >> + my $userid = $rpcenv->get_user(); >> + my $res->{cap} = &$compute_api_permission($rpcenv, $userid); >> + >> + return $res; >> + }}); >> + >> 1; >> -- >> 2.20.1 >> >> _______________________________________________ >> pve-devel mailing list >> pve-de...@pve.proxmox.com >> https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel >> > > > _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel