mirror of
https://github.com/portainer/portainer.git
synced 2025-07-30 18:59:41 +02:00
feat(registries): Registry browser for non-admins [EE-2459] (#6549)
* feat(registries): allow non-admin users to see environment registries * remove unused function * fix error message * fix test * fix imports order * feat(registry): check access first, add parameters name * use registryID * fix(sidebar): allow standard users to see endpoint registries view Co-authored-by: LP B <xAt0mZ@users.noreply.github.com>
This commit is contained in:
parent
77e48bfb74
commit
f9f937f844
15 changed files with 226 additions and 202 deletions
|
@ -2,12 +2,13 @@ import { TeamAccessViewModel, UserAccessViewModel } from 'Portainer/models/acces
|
|||
|
||||
class DockerRegistryAccessController {
|
||||
/* @ngInject */
|
||||
constructor($async, $state, Notifications, EndpointService, GroupService) {
|
||||
constructor($async, $state, Notifications, EndpointService, GroupService, RegistryService) {
|
||||
this.$async = $async;
|
||||
this.$state = $state;
|
||||
this.Notifications = Notifications;
|
||||
this.EndpointService = EndpointService;
|
||||
this.GroupService = GroupService;
|
||||
this.RegistryService = RegistryService;
|
||||
|
||||
this.updateAccess = this.updateAccess.bind(this);
|
||||
this.filterUsers = this.filterUsers.bind(this);
|
||||
|
@ -35,10 +36,10 @@ class DockerRegistryAccessController {
|
|||
const endpointGroupTeams = this.endpointGroup.TeamAccessPolicies;
|
||||
|
||||
return users.filter((userOrTeam) => {
|
||||
const userRole = userOrTeam instanceof UserAccessViewModel && (endpointUsers[userOrTeam.Id] || endpointGroupUsers[userOrTeam.Id]);
|
||||
const teamRole = userOrTeam instanceof TeamAccessViewModel && (endpointTeams[userOrTeam.Id] || endpointGroupTeams[userOrTeam.Id]);
|
||||
const userAccess = userOrTeam instanceof UserAccessViewModel && (endpointUsers[userOrTeam.Id] || endpointGroupUsers[userOrTeam.Id]);
|
||||
const teamAccess = userOrTeam instanceof TeamAccessViewModel && (endpointTeams[userOrTeam.Id] || endpointGroupTeams[userOrTeam.Id]);
|
||||
|
||||
return userRole || teamRole;
|
||||
return userAccess || teamAccess;
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -51,7 +52,7 @@ class DockerRegistryAccessController {
|
|||
endpointId: this.$state.params.endpointId,
|
||||
registryId: this.$state.params.id,
|
||||
};
|
||||
this.registry = await this.EndpointService.registry(this.state.endpointId, this.state.registryId);
|
||||
this.registry = await this.RegistryService.registry(this.state.registryId, this.state.endpointId);
|
||||
this.registryEndpointAccesses = this.registry.RegistryAccesses[this.state.endpointId] || {};
|
||||
this.endpointGroup = await this.GroupService.group(this.endpoint.GroupId);
|
||||
} catch (err) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue