kubeapps
kubeapps copied to clipboard
New package repository API endpoint to provide repositories permissions
Summary New package repository API endpoint to provide a summary of user's permission on repositories CRDs
Background and rationale
Currently UI is making multiple 'canI' calls to retrieve which permissions the user has related to repositories.
Everything is grouped in the TS function getRepositoriesPermissions
.
The resources involved are different per plugin: Helm is about kubeapps.com
and apprepositories
, Carvel is about packaging.carvel.dev
and packagerepositories
, etc.
The current setup is inefficient, as multiple canI
calls are performed at the same time. And also UI has to know the resource names, groups, verbs...from the underlying K8s.
Description Add a new API endpoint in package repository API that will provide permissions for the current user:
- Per plugin
- For the specified namespace
- For the global namespace
- For verbs
- list
- update
- create
- delete
- get
Input for the request:
- Namespace
- Auth token in header
Response of the request: Similar to the structure in TS.
interface IResourcePermission {
list: boolean;
create: boolean;
update: boolean;
delete: boolean;
get: boolean;
namespace: string;
}
interface IPackageRepositoryPermission {
global: IResourcePermission;
namespaced: IResourcePermission;
plugin: Plugin;
}
Acceptance criteria
- Implemented new API endpoint in core and plugins for repositories to return permissions of the user to operate with package repositories resources.
Additional context See comment in the originating PR #5480.