mirror of
https://github.com/portainer/portainer.git
synced 2025-07-21 22:39:41 +02:00
fix(rbac): add specific authorization for Storidge management
This commit is contained in:
parent
4349f5803c
commit
a2d29df21b
7 changed files with 12 additions and 9 deletions
|
@ -164,6 +164,7 @@ func (store *Store) Init() error {
|
||||||
portainer.OperationPortainerWebhookList: true,
|
portainer.OperationPortainerWebhookList: true,
|
||||||
portainer.OperationPortainerWebhookCreate: true,
|
portainer.OperationPortainerWebhookCreate: true,
|
||||||
portainer.OperationPortainerWebhookDelete: true,
|
portainer.OperationPortainerWebhookDelete: true,
|
||||||
|
portainer.OperationIntegrationStoridgeAdmin: true,
|
||||||
portainer.EndpointResourcesAccess: true,
|
portainer.EndpointResourcesAccess: true,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@ func NewHandler(bouncer *security.RequestBouncer) *Handler {
|
||||||
bouncer.RestrictedAccess(httperror.LoggerHandler(h.proxyRequestsToAzureAPI)))
|
bouncer.RestrictedAccess(httperror.LoggerHandler(h.proxyRequestsToAzureAPI)))
|
||||||
h.PathPrefix("/{id}/docker").Handler(
|
h.PathPrefix("/{id}/docker").Handler(
|
||||||
bouncer.RestrictedAccess(httperror.LoggerHandler(h.proxyRequestsToDockerAPI)))
|
bouncer.RestrictedAccess(httperror.LoggerHandler(h.proxyRequestsToDockerAPI)))
|
||||||
h.PathPrefix("/{id}/extensions/storidge").Handler(
|
h.PathPrefix("/{id}/storidge").Handler(
|
||||||
bouncer.RestrictedAccess(httperror.LoggerHandler(h.proxyRequestsToStoridgeAPI)))
|
bouncer.RestrictedAccess(httperror.LoggerHandler(h.proxyRequestsToStoridgeAPI)))
|
||||||
return h
|
return h
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,6 +53,6 @@ func (handler *Handler) proxyRequestsToStoridgeAPI(w http.ResponseWriter, r *htt
|
||||||
}
|
}
|
||||||
|
|
||||||
id := strconv.Itoa(endpointID)
|
id := strconv.Itoa(endpointID)
|
||||||
http.StripPrefix("/"+id+"/extensions/storidge", proxy).ServeHTTP(w, r)
|
http.StripPrefix("/"+id+"/storidge", proxy).ServeHTTP(w, r)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,7 +71,7 @@ func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||||
switch {
|
switch {
|
||||||
case strings.Contains(r.URL.Path, "/docker/"):
|
case strings.Contains(r.URL.Path, "/docker/"):
|
||||||
http.StripPrefix("/api/endpoints", h.EndpointProxyHandler).ServeHTTP(w, r)
|
http.StripPrefix("/api/endpoints", h.EndpointProxyHandler).ServeHTTP(w, r)
|
||||||
case strings.Contains(r.URL.Path, "/extensions/storidge"):
|
case strings.Contains(r.URL.Path, "/storidge/"):
|
||||||
http.StripPrefix("/api/endpoints", h.EndpointProxyHandler).ServeHTTP(w, r)
|
http.StripPrefix("/api/endpoints", h.EndpointProxyHandler).ServeHTTP(w, r)
|
||||||
case strings.Contains(r.URL.Path, "/azure/"):
|
case strings.Contains(r.URL.Path, "/azure/"):
|
||||||
http.StripPrefix("/api/endpoints", h.EndpointProxyHandler).ServeHTTP(w, r)
|
http.StripPrefix("/api/endpoints", h.EndpointProxyHandler).ServeHTTP(w, r)
|
||||||
|
|
|
@ -1223,6 +1223,8 @@ const (
|
||||||
OperationPortainerWebhookCreate Authorization = "PortainerWebhookCreate"
|
OperationPortainerWebhookCreate Authorization = "PortainerWebhookCreate"
|
||||||
OperationPortainerWebhookDelete Authorization = "PortainerWebhookDelete"
|
OperationPortainerWebhookDelete Authorization = "PortainerWebhookDelete"
|
||||||
|
|
||||||
|
OperationIntegrationStoridgeAdmin Authorization = "IntegrationStoridgeAdmin"
|
||||||
|
|
||||||
OperationDockerUndefined Authorization = "DockerUndefined"
|
OperationDockerUndefined Authorization = "DockerUndefined"
|
||||||
OperationDockerAgentUndefined Authorization = "DockerAgentUndefined"
|
OperationDockerAgentUndefined Authorization = "DockerAgentUndefined"
|
||||||
OperationPortainerUndefined Authorization = "PortainerUndefined"
|
OperationPortainerUndefined Authorization = "PortainerUndefined"
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
angular.module('extension.storidge')
|
angular.module('extension.storidge')
|
||||||
.factory('Storidge', ['$resource', 'API_ENDPOINT_ENDPOINTS', 'EndpointProvider', function StoridgeFactory($resource, API_ENDPOINT_ENDPOINTS, EndpointProvider) {
|
.factory('Storidge', ['$resource', 'API_ENDPOINT_ENDPOINTS', 'EndpointProvider', function StoridgeFactory($resource, API_ENDPOINT_ENDPOINTS, EndpointProvider) {
|
||||||
'use strict';
|
'use strict';
|
||||||
return $resource(API_ENDPOINT_ENDPOINTS + '/:endpointId/extensions/storidge/:resource/:id/:action', {
|
return $resource(API_ENDPOINT_ENDPOINTS + '/:endpointId/storidge/:resource/:id/:action', {
|
||||||
endpointId: EndpointProvider.endpointID
|
endpointId: EndpointProvider.endpointID
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -24,18 +24,18 @@
|
||||||
admin-access="!applicationState.application.authentication || isAdmin"
|
admin-access="!applicationState.application.authentication || isAdmin"
|
||||||
offline-mode="endpointState.OfflineMode"
|
offline-mode="endpointState.OfflineMode"
|
||||||
></docker-sidebar-content>
|
></docker-sidebar-content>
|
||||||
<li class="sidebar-title" ng-if="applicationState.endpoint.mode && applicationState.endpoint.extensions.length > 0">
|
<li class="sidebar-title" authorization="IntegrationStoridgeAdmin" ng-if="applicationState.endpoint.mode && applicationState.endpoint.extensions.length > 0">
|
||||||
<span>Integrations</span>
|
<span>Integrations</span>
|
||||||
</li>
|
</li>
|
||||||
<li class="sidebar-list" ng-if="applicationState.endpoint.mode && applicationState.endpoint.extensions.indexOf('storidge') !== -1 && applicationState.endpoint.mode.provider === 'DOCKER_SWARM_MODE' && applicationState.endpoint.mode.role === 'MANAGER'">
|
<li authorization="IntegrationStoridgeAdmin" class="sidebar-list" ng-if="applicationState.endpoint.mode && applicationState.endpoint.extensions.indexOf('storidge') !== -1 && applicationState.endpoint.mode.provider === 'DOCKER_SWARM_MODE' && applicationState.endpoint.mode.role === 'MANAGER'">
|
||||||
<a ui-sref="storidge.cluster" ui-sref-active="active">Storidge <span class="menu-icon fa fa-bolt fa-fw"></span></a>
|
<a ui-sref="storidge.cluster" ui-sref-active="active">Storidge <span class="menu-icon fa fa-bolt fa-fw"></span></a>
|
||||||
<div class="sidebar-sublist" ng-if="toggle && ($state.current.name === 'storidge.cluster' || $state.current.name === 'storidge.profiles' || $state.current.name === 'storidge.monitor' || $state.current.name === 'storidge.profiles.new' || $state.current.name === 'storidge.profiles.profile' || $state.current.name === 'storidge.drives' || $state.current.name === 'storidge.drives.drive')">
|
<div class="sidebar-sublist" ng-if="toggle && ($state.current.name === 'storidge.cluster' || $state.current.name === 'storidge.profiles' || $state.current.name === 'storidge.monitor' || $state.current.name === 'storidge.profiles.new' || $state.current.name === 'storidge.profiles.profile' || $state.current.name === 'storidge.drives' || $state.current.name === 'storidge.drives.drive' || $state.current.name === 'storidge.cluster.node')">
|
||||||
<a ui-sref="storidge.monitor" ui-sref-active="active">Monitor</a>
|
<a ui-sref="storidge.monitor" ui-sref-active="active">Monitor</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="sidebar-sublist" ng-if="toggle && ($state.current.name === 'storidge.cluster' || $state.current.name === 'storidge.profiles' || $state.current.name === 'storidge.monitor' || $state.current.name === 'storidge.profiles.new' || $state.current.name === 'storidge.profiles.profile' || $state.current.name === 'storidge.drives' || $state.current.name === 'storidge.drives.drive')">
|
<div class="sidebar-sublist" ng-if="toggle && ($state.current.name === 'storidge.cluster' || $state.current.name === 'storidge.profiles' || $state.current.name === 'storidge.monitor' || $state.current.name === 'storidge.profiles.new' || $state.current.name === 'storidge.profiles.profile' || $state.current.name === 'storidge.drives' || $state.current.name === 'storidge.drives.drive' || $state.current.name === 'storidge.cluster.node')">
|
||||||
<a ui-sref="storidge.profiles" ui-sref-active="active">Profiles</a>
|
<a ui-sref="storidge.profiles" ui-sref-active="active">Profiles</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="sidebar-sublist" ng-if="toggle && ($state.current.name === 'storidge.cluster' || $state.current.name === 'storidge.profiles' || $state.current.name === 'storidge.monitor' || $state.current.name === 'storidge.profiles.new' || $state.current.name === 'storidge.profiles.profile' || $state.current.name === 'storidge.drives' || $state.current.name === 'storidge.drives.drive')">
|
<div class="sidebar-sublist" ng-if="toggle && ($state.current.name === 'storidge.cluster' || $state.current.name === 'storidge.profiles' || $state.current.name === 'storidge.monitor' || $state.current.name === 'storidge.profiles.new' || $state.current.name === 'storidge.profiles.profile' || $state.current.name === 'storidge.drives' || $state.current.name === 'storidge.drives.drive' || $state.current.name === 'storidge.cluster.node')">
|
||||||
<a ui-sref="storidge.drives" ui-sref-active="active">Drives</a>
|
<a ui-sref="storidge.drives" ui-sref-active="active">Drives</a>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue