fix(http): update volume browsing validation (#3416)

pull/3423/head
Anthony Lapenna 5 years ago committed by GitHub
parent c2e1129804
commit badb6ee50f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -432,22 +432,24 @@ func (transport *Transport) restrictedResourceOperation(request *http.Request, r
return nil, err
}
user, err := transport.userService.User(tokenData.ID)
if err != nil {
return nil, err
}
if volumeBrowseRestrictionCheck {
settings, err := transport.settingsService.Settings()
if err != nil {
return nil, err
}
if rbacExtension != nil && !settings.AllowVolumeBrowserForRegularUsers {
// Return access denied for all roles except endpoint-administrator
_, userCanBrowse := user.EndpointAuthorizations[transport.endpoint.ID][portainer.OperationDockerAgentBrowseList]
if rbacExtension != nil && !settings.AllowVolumeBrowserForRegularUsers && !userCanBrowse {
return responseutils.WriteAccessDeniedResponse()
}
}
user, err := transport.userService.User(tokenData.ID)
if err != nil {
return nil, err
}
endpointResourceAccess := false
_, ok := user.EndpointAuthorizations[transport.endpoint.ID][portainer.EndpointResourcesAccess]
if ok {

Loading…
Cancel
Save