Documentation ¶
Index ¶
- func GetRouter(config configuration.Config, command Controller) http.Handler
- func GetRouterWithoutMiddleware(config configuration.Config, command Controller) http.Handler
- func Start(ctx context.Context, config configuration.Config, ctrl Controller) (err error)
- type AdminEndpoints
- type AdminInterface
- type Controller
- type EndpointMethod
- type HealthEndpoints
- type PermissionsCheckEndpoints
- func (this *PermissionsCheckEndpoints) CheckMultiplePermissions(config configuration.Config, router *http.ServeMux, ctrl Controller)
- func (this *PermissionsCheckEndpoints) CheckPermission(config configuration.Config, router *http.ServeMux, ctrl Controller)
- func (this *PermissionsCheckEndpoints) ListAccessibleResourceIds(config configuration.Config, router *http.ServeMux, ctrl Controller)
- type PermissionsCheckInterface
- type PermissionsListEndpoints
- type PermissionsManagementEndpoints
- func (this *PermissionsManagementEndpoints) DeleteResource(config configuration.Config, router *http.ServeMux, ctrl Controller)
- func (this *PermissionsManagementEndpoints) GetResource(config configuration.Config, router *http.ServeMux, ctrl Controller)
- func (this *PermissionsManagementEndpoints) ListResourcesWithAdminPermission(config configuration.Config, router *http.ServeMux, ctrl Controller)
- func (this *PermissionsManagementEndpoints) SetPermission(config configuration.Config, router *http.ServeMux, ctrl Controller)
- type PermissionsManagementInterface
- type SwaggerEndpoints
- type TopicsEndpoints
- func (this *TopicsEndpoints) AdminListResourceIds(config configuration.Config, router *http.ServeMux, ctrl Controller)
- func (this *TopicsEndpoints) AdminLoadFromPermissionSearch(config configuration.Config, router *http.ServeMux, ctrl Controller)
- func (this *TopicsEndpoints) DeleteTopic(config configuration.Config, router *http.ServeMux, ctrl Controller)
- func (this *TopicsEndpoints) GetTopic(config configuration.Config, router *http.ServeMux, ctrl Controller)
- func (this *TopicsEndpoints) ListTopics(config configuration.Config, router *http.ServeMux, ctrl Controller)
- func (this *TopicsEndpoints) SetTopic(config configuration.Config, router *http.ServeMux, ctrl Controller)
- func (this *TopicsEndpoints) SetTopicByPost(config configuration.Config, router *http.ServeMux, ctrl Controller)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetRouter ¶
func GetRouter(config configuration.Config, command Controller) http.Handler
@title Permissions API @version 0.1 @license.name Apache 2.0 @license.url http://www.apache.org/licenses/LICENSE-2.0.html @BasePath / @securityDefinitions.apikey Bearer @in header @name Authorization @description Type "Bearer" followed by a space and JWT token.
func GetRouterWithoutMiddleware ¶ added in v0.0.24
func GetRouterWithoutMiddleware(config configuration.Config, command Controller) http.Handler
func Start ¶
func Start(ctx context.Context, config configuration.Config, ctrl Controller) (err error)
Types ¶
type AdminEndpoints ¶ added in v0.0.9
type AdminEndpoints struct{}
type AdminInterface ¶
type AdminInterface interface { ListTopics(token string, options model.ListOptions) (result []model.Topic, err error, code int) GetTopic(token string, id string) (result model.Topic, err error, code int) RemoveTopic(token string, id string) (err error, code int) SetTopic(token string, topic model.Topic) (result model.Topic, err error, code int) AdminListResourceIds(tokenStr string, topicId string, options model.ListOptions) (ids []string, err error, code int) AdminLoadFromPermissionSearch(req model.AdminLoadPermSearchRequest) (updateCount int, err error, code int) }
type Controller ¶
type Controller interface { PermissionsCheckInterface AdminInterface PermissionsManagementInterface }
type EndpointMethod ¶
type EndpointMethod = func(config configuration.Config, router *http.ServeMux, ctrl Controller)
type HealthEndpoints ¶
type HealthEndpoints struct{}
func (*HealthEndpoints) HealthCheck ¶
func (this *HealthEndpoints) HealthCheck(config configuration.Config, router *http.ServeMux, ctrl Controller)
HealthCheck godoc @Summary health check @Description checks health and reachability of the service @Tags health @Success 200 @Router / [get]
func (*HealthEndpoints) HealthCheck2 ¶
func (this *HealthEndpoints) HealthCheck2(config configuration.Config, router *http.ServeMux, ctrl Controller)
HealthCheck godoc @Summary health check @Description checks health and reachability of the service @Tags health @Success 200 @Router /health [get]
type PermissionsCheckEndpoints ¶
type PermissionsCheckEndpoints struct{}
func (*PermissionsCheckEndpoints) CheckMultiplePermissions ¶
func (this *PermissionsCheckEndpoints) CheckMultiplePermissions(config configuration.Config, router *http.ServeMux, ctrl Controller)
CheckMultiplePermissions godoc @Summary check multiple permissions @Description check multiple permissions @Tags check @Security Bearer @Param topic path string true "Topic Id" @Param ids query string true "Resource Ids, comma seperated" @Param permissions query string false "checked permissions in the form of 'rwxa', defaults to 'r'" @Produce json @Success 200 {object} map[string]bool @Failure 400 @Failure 401 @Failure 500 @Router /check/{topic} [get]
func (*PermissionsCheckEndpoints) CheckPermission ¶
func (this *PermissionsCheckEndpoints) CheckPermission(config configuration.Config, router *http.ServeMux, ctrl Controller)
CheckPermission godoc @Summary check permission @Description check permission @Tags check @Security Bearer @Param topic path string true "Topic Id" @Param id path string true "Resource Id" @Param permissions query string false "checked permissions in the form of 'rwxa', defaults to 'r'" @Produce json @Success 200 {object} bool @Failure 400 @Failure 401 @Failure 500 @Router /check/{topic}/{id} [get]
func (*PermissionsCheckEndpoints) ListAccessibleResourceIds ¶
func (this *PermissionsCheckEndpoints) ListAccessibleResourceIds(config configuration.Config, router *http.ServeMux, ctrl Controller)
ListAccessibleResourceIds godoc @Summary list accessible resource ids @Description list accessible resource ids @Tags accessible, resource @Security Bearer @Param topic path string true "Topic Id" @Param permissions query string false "checked permissions in the form of 'rwxa', defaults to 'r'" @Param limit query integer false "limits size of result; 0 means unlimited" @Param offset query integer false "offset to be used in combination with limit" @Produce json @Success 200 {array} string @Failure 400 @Failure 401 @Failure 500 @Router /accessible/{topic} [get]
type PermissionsCheckInterface ¶
type PermissionsCheckInterface interface { CheckPermission(token string, topicId string, id string, permissions ...model.Permission) (access bool, err error, code int) CheckMultiplePermissions(token string, topicId string, ids []string, permissions ...model.Permission) (access map[string]bool, err error, code int) ListAccessibleResourceIds(token string, topicId string, options model.ListOptions, permissions ...model.Permission) (ids []string, err error, code int) ListComputedPermissions(token string, topic string, ids []string) (result []model.ComputedPermissions, err error, code int) }
type PermissionsListEndpoints ¶ added in v0.0.15
type PermissionsListEndpoints struct{}
func (*PermissionsListEndpoints) ListComputedPermissions ¶ added in v0.0.15
func (this *PermissionsListEndpoints) ListComputedPermissions(config configuration.Config, router *http.ServeMux, ctrl Controller)
ListComputedPermissions godoc @Summary list the computed permissions to resources of the given topic and ids @Description list the computed permissions to resources of the given topic and ids, group and user permissions are merged, unknown ids will get entries in the result @Tags permissions, check, list @Security Bearer @Param topic path string true "Topic Id" @Param ids query string true "Resource Ids, comma seperated" @Produce json @Success 200 {array} model.ComputedPermissions @Failure 400 @Failure 401 @Failure 500 @Router /permissions/{topic} [get]
func (*PermissionsListEndpoints) QueryListComputedPermissions ¶ added in v0.0.15
func (this *PermissionsListEndpoints) QueryListComputedPermissions(config configuration.Config, router *http.ServeMux, ctrl Controller)
QueryListComputedPermissions godoc @Summary list the computed permissions to resources of the given topic and ids @Description list the computed permissions to resources of the given topic and ids, group and user permissions are merged, unknown ids will get entries in the result @Tags permissions, check, list, query @Security Bearer @Param topic path string true "Topic Id" @Param ids body []string true "Resource Ids" @Produce json @Success 200 {array} model.ComputedPermissions @Failure 400 @Failure 401 @Failure 500 @Router /query/permissions/{topic} [post]
type PermissionsManagementEndpoints ¶
type PermissionsManagementEndpoints struct{}
func (*PermissionsManagementEndpoints) DeleteResource ¶ added in v0.0.5
func (this *PermissionsManagementEndpoints) DeleteResource(config configuration.Config, router *http.ServeMux, ctrl Controller)
DeleteResource godoc @Summary delete resource @Description delete resource, requesting user must have admin right on the resource, topic must have NoCqrs=true @Tags manage, resource @Security Bearer @Param topic path string true "Topic Id" @Param id path string true "Resource Id" @Success 200 {object} model.Resource @Failure 400 @Failure 401 @Failure 403 @Failure 500 @Router /manage/{topic}/{id} [delete]
func (*PermissionsManagementEndpoints) GetResource ¶
func (this *PermissionsManagementEndpoints) GetResource(config configuration.Config, router *http.ServeMux, ctrl Controller)
GetResource godoc @Summary get resource @Description get resource, requesting user must have admin right on the resource @Tags manage, resource @Security Bearer @Param topic path string true "Topic Id" @Param id path string true "Resource Id" @Produce json @Success 200 {object} model.Resource @Failure 400 @Failure 401 @Failure 403 @Failure 500 @Router /manage/{topic}/{id} [get]
func (*PermissionsManagementEndpoints) ListResourcesWithAdminPermission ¶
func (this *PermissionsManagementEndpoints) ListResourcesWithAdminPermission(config configuration.Config, router *http.ServeMux, ctrl Controller)
ListResourcesWithAdminPermission godoc @Summary lists resources the user has admin rights to @Description lists resources the user has admin rights to @Tags manage, resource @Security Bearer @Param topic path string true "Topic Id" @Param limit query integer false "limits size of result; 0 means unlimited" @Param offset query integer false "offset to be used in combination with limit" @Produce json @Success 200 {array} model.Resource @Failure 400 @Failure 401 @Failure 403 @Failure 500 @Router /manage/{topic} [get]
func (*PermissionsManagementEndpoints) SetPermission ¶
func (this *PermissionsManagementEndpoints) SetPermission(config configuration.Config, router *http.ServeMux, ctrl Controller)
SetPermission godoc @Summary set resource rights @Description get resource rights, requesting user must have admin right @Tags manage, resource-rights @Security Bearer @Param topic path string true "Topic Id" @Param id path string true "Resource Id" @Param wait query bool false "if set to true, the response will be sent after the corresponding kafka done signal has been received" @Param message body model.ResourcePermissions true "Topic" @Accept json @Produce json @Success 200 {object} model.ResourcePermissions @Failure 400 @Failure 401 @Failure 403 @Failure 500 @Router /manage/{topic}/{id} [put]
type PermissionsManagementInterface ¶
type PermissionsManagementInterface interface { ListResourcesWithAdminPermission(token string, topicId string, options model.ListOptions) (result []model.Resource, err error, code int) GetResource(token string, topicId string, id string) (result model.Resource, err error, code int) RemoveResource(token string, topicId string, id string) (err error, code int) SetPermission(token string, topicId string, id string, permissions model.ResourcePermissions) (result model.ResourcePermissions, err error, code int) }
type SwaggerEndpoints ¶
type SwaggerEndpoints struct{}
func (*SwaggerEndpoints) Swagger ¶
func (this *SwaggerEndpoints) Swagger(config configuration.Config, router *http.ServeMux, ctrl Controller)
type TopicsEndpoints ¶
type TopicsEndpoints struct{}
func (*TopicsEndpoints) AdminListResourceIds ¶ added in v0.0.9
func (this *TopicsEndpoints) AdminListResourceIds(config configuration.Config, router *http.ServeMux, ctrl Controller)
AdminListResourceIds godoc @Summary lists resource ids in topic @Description lists resource ids in topic, requesting user must be in admin group @Tags topics, resources, admin @Security Bearer @Param topic path string true "Topic Id" @Param limit query integer false "limits size of result; 0 means unlimited" @Param offset query integer false "offset to be used in combination with limit" @Produce json @Success 200 {array} string @Failure 400 @Failure 401 @Failure 403 @Failure 500 @Router /admin/resources/{topic} [get]
func (*TopicsEndpoints) AdminLoadFromPermissionSearch ¶ added in v0.0.27
func (this *TopicsEndpoints) AdminLoadFromPermissionSearch(config configuration.Config, router *http.ServeMux, ctrl Controller)
AdminLoadFromPermissionSearch godoc @Summary load rights from permission-search @Description load rights from permission-search, requesting user must have admin right @Tags admin @Security Bearer @Param message body model.AdminLoadPermSearchRequest true "load configuration" @Accept json @Produce json @Success 200 {object} integer "update count" @Failure 400 @Failure 401 @Failure 403 @Failure 500 @Router /admin/load/permission-search [post]
func (*TopicsEndpoints) DeleteTopic ¶
func (this *TopicsEndpoints) DeleteTopic(config configuration.Config, router *http.ServeMux, ctrl Controller)
DeleteTopic godoc @Summary remove topic config @Description remove topic config, requesting user must be admin @Tags topics @Security Bearer @Param id path string true "Topic Id" @Success 200 @Failure 400 @Failure 401 @Failure 403 @Failure 404 @Failure 500 @Router /admin/topics/{id} [delete]
func (*TopicsEndpoints) GetTopic ¶
func (this *TopicsEndpoints) GetTopic(config configuration.Config, router *http.ServeMux, ctrl Controller)
GetTopic godoc @Summary get topic config @Description get topic config, requesting user must be admin @Tags topics @Security Bearer @Param id path string true "Topic Id" @Produce json @Success 200 {object} model.Topic @Failure 400 @Failure 401 @Failure 403 @Failure 404 @Failure 500 @Router /admin/topics/{id} [get]
func (*TopicsEndpoints) ListTopics ¶
func (this *TopicsEndpoints) ListTopics(config configuration.Config, router *http.ServeMux, ctrl Controller)
ListTopics godoc @Summary lists topics with their configuration @Description lists topics with their configuration, requesting user must be admin @Tags topics @Security Bearer @Param limit query integer false "limits size of result; 0 means unlimited" @Param offset query integer false "offset to be used in combination with limit" @Produce json @Success 200 {array} model.Topic @Failure 400 @Failure 401 @Failure 403 @Failure 500 @Router /admin/topics [get]
func (*TopicsEndpoints) SetTopic ¶
func (this *TopicsEndpoints) SetTopic(config configuration.Config, router *http.ServeMux, ctrl Controller)
SetTopic godoc @Summary set topic config @Description set topic config, requesting user must be admin @Tags topics @Accept json @Produce json @Security Bearer @Param id path string true "Topic Id" @Param message body model.Topic true "Topic" @Success 200 {object} model.Topic @Failure 400 @Failure 401 @Failure 403 @Failure 404 @Failure 500 @Router /admin/topics/{id} [put]
func (*TopicsEndpoints) SetTopicByPost ¶
func (this *TopicsEndpoints) SetTopicByPost(config configuration.Config, router *http.ServeMux, ctrl Controller)
SetTopicByPost godoc @Summary set topic config @Description set topic config, requesting user must be admin @Tags topics @Accept json @Produce json @Security Bearer @Param message body model.Topic true "Topic" @Success 200 {object} model.Topic @Success 202 {object} model.Topic @Failure 400 @Failure 401 @Failure 403 @Failure 404 @Failure 500 @Router /admin/topics [POST]