mirror of
https://github.com/portainer/portainer.git
synced 2025-08-05 05:45:22 +02:00
fix(swagger): fix swagger api docs endpoint(s) rename to environment(s) EE-1661 (#5629)
* fix swagger api docs endpoint(s) rename to environment(s)
This commit is contained in:
parent
d911c50f1b
commit
dd808bb7bd
111 changed files with 376 additions and 376 deletions
|
@ -103,9 +103,9 @@ func AuthorizedTeamManagement(teamID portainer.TeamID, context *RestrictedReques
|
|||
return false
|
||||
}
|
||||
|
||||
// authorizedEndpointAccess ensure that the user can access the specified endpoint.
|
||||
// authorizedEndpointAccess ensure that the user can access the specified environment(endpoint).
|
||||
// It will check if the user is part of the authorized users or part of a team that is
|
||||
// listed in the authorized teams of the endpoint and the associated group.
|
||||
// listed in the authorized teams of the environment(endpoint) and the associated group.
|
||||
func authorizedEndpointAccess(endpoint *portainer.Endpoint, endpointGroup *portainer.EndpointGroup, userID portainer.UserID, memberships []portainer.TeamMembership) bool {
|
||||
groupAccess := AuthorizedAccess(userID, memberships, endpointGroup.UserAccessPolicies, endpointGroup.TeamAccessPolicies)
|
||||
if !groupAccess {
|
||||
|
@ -114,7 +114,7 @@ func authorizedEndpointAccess(endpoint *portainer.Endpoint, endpointGroup *porta
|
|||
return true
|
||||
}
|
||||
|
||||
// authorizedEndpointGroupAccess ensure that the user can access the specified endpoint group.
|
||||
// authorizedEndpointGroupAccess ensure that the user can access the specified environment(endpoint) group.
|
||||
// It will check if the user is part of the authorized users or part of a team that is
|
||||
// listed in the authorized teams.
|
||||
func authorizedEndpointGroupAccess(endpointGroup *portainer.EndpointGroup, userID portainer.UserID, memberships []portainer.TeamMembership) bool {
|
||||
|
@ -123,7 +123,7 @@ func authorizedEndpointGroupAccess(endpointGroup *portainer.EndpointGroup, userI
|
|||
|
||||
// AuthorizedRegistryAccess ensure that the user can access the specified registry.
|
||||
// It will check if the user is part of the authorized users or part of a team that is
|
||||
// listed in the authorized teams for a specified endpoint,
|
||||
// listed in the authorized teams for a specified environment(endpoint),
|
||||
func AuthorizedRegistryAccess(registry *portainer.Registry, user *portainer.User, teamMemberships []portainer.TeamMembership, endpointID portainer.EndpointID) bool {
|
||||
if user.Role == portainer.AdministratorRole {
|
||||
return true
|
||||
|
|
|
@ -36,16 +36,16 @@ func NewRequestBouncer(dataStore portainer.DataStore, jwtService portainer.JWTSe
|
|||
}
|
||||
}
|
||||
|
||||
// PublicAccess defines a security check for public API endpoints.
|
||||
// No authentication is required to access these endpoints.
|
||||
// PublicAccess defines a security check for public API environments(endpoints).
|
||||
// No authentication is required to access these environments(endpoints).
|
||||
func (bouncer *RequestBouncer) PublicAccess(h http.Handler) http.Handler {
|
||||
h = mwSecureHeaders(h)
|
||||
return h
|
||||
}
|
||||
|
||||
// AdminAccess defines a security check for API endpoints that require an authorization check.
|
||||
// Authentication is required to access these endpoints.
|
||||
// The administrator role is required to use these endpoints.
|
||||
// AdminAccess defines a security check for API environments(endpoints) that require an authorization check.
|
||||
// Authentication is required to access these environments(endpoints).
|
||||
// The administrator role is required to use these environments(endpoints).
|
||||
// The request context will be enhanced with a RestrictedRequestContext object
|
||||
// that might be used later to inside the API operation for extra authorization validation
|
||||
// and resource filtering.
|
||||
|
@ -56,8 +56,8 @@ func (bouncer *RequestBouncer) AdminAccess(h http.Handler) http.Handler {
|
|||
return h
|
||||
}
|
||||
|
||||
// RestrictedAccess defines a security check for restricted API endpoints.
|
||||
// Authentication is required to access these endpoints.
|
||||
// RestrictedAccess defines a security check for restricted API environments(endpoints).
|
||||
// Authentication is required to access these environments(endpoints).
|
||||
// The request context will be enhanced with a RestrictedRequestContext object
|
||||
// that might be used later to inside the API operation for extra authorization validation
|
||||
// and resource filtering.
|
||||
|
@ -68,8 +68,8 @@ func (bouncer *RequestBouncer) RestrictedAccess(h http.Handler) http.Handler {
|
|||
return h
|
||||
}
|
||||
|
||||
// AuthenticatedAccess defines a security check for restricted API endpoints.
|
||||
// Authentication is required to access these endpoints.
|
||||
// AuthenticatedAccess defines a security check for restricted API environments(endpoints).
|
||||
// Authentication is required to access these environments(endpoints).
|
||||
// The request context will be enhanced with a RestrictedRequestContext object
|
||||
// that might be used later to inside the API operation for extra authorization validation
|
||||
// and resource filtering.
|
||||
|
@ -80,8 +80,8 @@ func (bouncer *RequestBouncer) AuthenticatedAccess(h http.Handler) http.Handler
|
|||
}
|
||||
|
||||
// AuthorizedEndpointOperation retrieves the JWT token from the request context and verifies
|
||||
// that the user can access the specified endpoint.
|
||||
// An error is returned when access to the endpoint is denied or if the user do not have the required
|
||||
// that the user can access the specified environment(endpoint).
|
||||
// An error is returned when access to the environments(endpoints) is denied or if the user do not have the required
|
||||
// authorization to execute the operation.
|
||||
func (bouncer *RequestBouncer) AuthorizedEndpointOperation(r *http.Request, endpoint *portainer.Endpoint) error {
|
||||
tokenData, err := RetrieveTokenData(r)
|
||||
|
@ -110,7 +110,7 @@ func (bouncer *RequestBouncer) AuthorizedEndpointOperation(r *http.Request, endp
|
|||
return nil
|
||||
}
|
||||
|
||||
// AuthorizedEdgeEndpointOperation verifies that the request was received from a valid Edge endpoint
|
||||
// AuthorizedEdgeEndpointOperation verifies that the request was received from a valid Edge environment(endpoint)
|
||||
func (bouncer *RequestBouncer) AuthorizedEdgeEndpointOperation(r *http.Request, endpoint *portainer.Endpoint) error {
|
||||
if endpoint.Type != portainer.EdgeAgentOnKubernetesEnvironment && endpoint.Type != portainer.EdgeAgentOnDockerEnvironment {
|
||||
return errors.New("Invalid environment type")
|
||||
|
@ -138,9 +138,9 @@ func (bouncer *RequestBouncer) mwAuthenticatedUser(h http.Handler) http.Handler
|
|||
}
|
||||
|
||||
// mwCheckPortainerAuthorizations will verify that the user has the required authorization to access
|
||||
// a specific API endpoint.
|
||||
// a specific API environment(endpoint).
|
||||
// If the administratorOnly flag is specified, this will prevent non-admin
|
||||
// users from accessing the endpoint.
|
||||
// users from accessing the environment(endpoint).
|
||||
func (bouncer *RequestBouncer) mwCheckPortainerAuthorizations(next http.Handler, administratorOnly bool) http.Handler {
|
||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
tokenData, err := RetrieveTokenData(r)
|
||||
|
|
|
@ -80,8 +80,8 @@ func FilterRegistries(registries []portainer.Registry, user *portainer.User, tea
|
|||
return filteredRegistries
|
||||
}
|
||||
|
||||
// FilterEndpoints filters endpoints based on user role and team memberships.
|
||||
// Non administrator users only have access to authorized endpoints (can be inherited via endoint groups).
|
||||
// FilterEndpoints filters environments(endpoints) based on user role and team memberships.
|
||||
// Non administrator users only have access to authorized environments(endpoints) (can be inherited via endoint groups).
|
||||
func FilterEndpoints(endpoints []portainer.Endpoint, groups []portainer.EndpointGroup, context *RestrictedRequestContext) []portainer.Endpoint {
|
||||
filteredEndpoints := endpoints
|
||||
|
||||
|
@ -100,8 +100,8 @@ func FilterEndpoints(endpoints []portainer.Endpoint, groups []portainer.Endpoint
|
|||
return filteredEndpoints
|
||||
}
|
||||
|
||||
// FilterEndpointGroups filters endpoint groups based on user role and team memberships.
|
||||
// Non administrator users only have access to authorized endpoint groups.
|
||||
// FilterEndpointGroups filters environment(endpoint) groups based on user role and team memberships.
|
||||
// Non administrator users only have access to authorized environment(endpoint) groups.
|
||||
func FilterEndpointGroups(endpointGroups []portainer.EndpointGroup, context *RestrictedRequestContext) []portainer.EndpointGroup {
|
||||
filteredEndpointGroups := endpointGroups
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue