Documentation
¶
Index ¶
- Constants
- func EmbedPermissionsClientIntoRouter(client Client, router http.Handler, prefix string, ...) http.Handler
- func GenerateGoFileWithSwaggoCommentsForEmbeddedPermissionsClient(packageName string, prefix string, location string, topicList []string, ...) error
- func NewTestClient(ctx context.Context) (client *controller.Controller, err error)
- func NewTokenProvider(authEndpoint string, authClientId string, authClientSecret string) func() (string, error)
- func NewUserTokenProvider(authEndpoint string, authClientId string, authClientSecret string, ...) func() (string, error)
- type Client
- type ClientImpl
- func (this *ClientImpl) AdminListResourceIds(token string, topicId string, options ListOptions) (ids []string, err error, code int)
- func (this *ClientImpl) AdminLoadFromPermissionSearch(req model.AdminLoadPermSearchRequest) (updateCount int, err error, code int)
- func (this *ClientImpl) CheckMultiplePermissions(token string, topicId string, ids []string, permissions ...Permission) (access map[string]bool, err error, code int)
- func (this *ClientImpl) CheckPermission(token string, topicId string, id string, permissions ...Permission) (access bool, err error, code int)
- func (this *ClientImpl) Export(token string, options model.ImportExportOptions) (result model.ImportExport, err error, code int)
- func (this *ClientImpl) GetResource(token string, topicId string, id string) (result Resource, err error, code int)
- func (this *ClientImpl) GetTopic(token string, id string) (result Topic, err error, code int)
- func (this *ClientImpl) Import(token string, importModel model.ImportExport, ...) (err error, code int)
- func (this *ClientImpl) ListAccessibleResourceIds(token string, topicId string, options ListOptions, permissions ...Permission) (ids []string, err error, code int)
- func (this *ClientImpl) ListComputedPermissions(token string, topicId string, ids []string) (result []model.ComputedPermissions, err error, code int)
- func (this *ClientImpl) ListResourcesWithAdminPermission(token string, topicId string, options ListOptions) (result []Resource, err error, code int)
- func (this *ClientImpl) ListTopics(token string, options ListOptions) (result []Topic, err error, code int)
- func (this *ClientImpl) RemoveResource(token string, topicId string, id string) (err error, code int)
- func (this *ClientImpl) RemoveTopic(token string, id string) (err error, code int)
- func (this *ClientImpl) SetPermission(token string, topicId string, id string, permissions ResourcePermissions) (result ResourcePermissions, err error, code int)
- func (this *ClientImpl) SetTopic(token string, topic Topic) (result Topic, err error, code int)
- type GetOptions
- type GroupPermissions
- type ImportExport
- type ImportExportOptions
- type ListOptions
- type OpenidToken
- type Permission
- type PermissionList
- type PermissionsMap
- type Resource
- type ResourcePermissions
- type Topic
Constants ¶
const Administrate = model.Administrate // user may delete resource; user may change resource rights (e.g. delete device)
const ClientVersion = model.ClientVersion
const Execute = model.Execute //user may use the resource (e.g. cmd to device; read device data; read database)
const InternalAdminToken = `` /* 727-byte string literal not displayed */
InternalAdminToken is expired and invalid. but because this service does not validate the received tokens, it may be used by trusted internal services which are within the same network (kubernetes cluster). requests with this token may not be routed over an ingres with token validation
const Read = model.Read //user may read the resource (metadata) (e.g. read device name)
const Write = model.Write //user may write the resource (metadata)(e.g. rename device)
Variables ¶
This section is empty.
Functions ¶
func EmbedPermissionsClientIntoRouter ¶ added in v0.0.24
func GenerateGoFileWithSwaggoCommentsForEmbeddedPermissionsClient ¶ added in v0.0.32
func GenerateGoFileWithSwaggoCommentsForEmbeddedPermissionsClient(packageName string, prefix string, location string, topicList []string, pathFilter func(method string, path string) bool) error
GenerateGoFileWithSwaggoCommentsForEmbeddedPermissionsClient generates a go file with swaggo comments needed to generate swagger documentation - location: defines where the new go file should be generated (containing the file-name e.g. "../generated_permissions.go") - packageName: sets the package name of the generated file - prefix: is the prefix before the permission endpoints. may have "/" prefix und suffix (e.g. "/permissions/"). default = "permissions" - topicList: replaces endpoints with {topic} placeholder with explicit endpoints; may be nil to keep placeholder - pathFilter:
- function to filter undesired endpoints (like DELETE endpoints)
- may be nil to allow all endpoints
- pathFilter should return true to allow the endpoint
- no guarantee if the input path contains placeholders like {topic} and {id}, or if the placeholder is replaced
- the input path contains the prefix parameter to ensure compatibility with EmbedPermissionsClientIntoRouter
func NewTestClient ¶
func NewTestClient(ctx context.Context) (client *controller.Controller, err error)
func NewTokenProvider ¶
Types ¶
type Client ¶
type Client interface {
api.Controller
}
type ClientImpl ¶ added in v0.0.11
type ClientImpl struct {
// contains filtered or unexported fields
}
func New ¶
func New(serverUrl string) (client *ClientImpl)
func (*ClientImpl) AdminListResourceIds ¶ added in v0.0.11
func (this *ClientImpl) AdminListResourceIds(token string, topicId string, options ListOptions) (ids []string, err error, code int)
func (*ClientImpl) AdminLoadFromPermissionSearch ¶ added in v0.0.27
func (this *ClientImpl) AdminLoadFromPermissionSearch(req model.AdminLoadPermSearchRequest) (updateCount int, err error, code int)
AdminLoadFromPermissionSearch is not supported by the client because this request should never be automated
func (*ClientImpl) CheckMultiplePermissions ¶ added in v0.0.11
func (this *ClientImpl) CheckMultiplePermissions(token string, topicId string, ids []string, permissions ...Permission) (access map[string]bool, err error, code int)
func (*ClientImpl) CheckPermission ¶ added in v0.0.11
func (this *ClientImpl) CheckPermission(token string, topicId string, id string, permissions ...Permission) (access bool, err error, code int)
func (*ClientImpl) Export ¶ added in v0.0.28
func (this *ClientImpl) Export(token string, options model.ImportExportOptions) (result model.ImportExport, err error, code int)
func (*ClientImpl) GetResource ¶ added in v0.0.11
func (*ClientImpl) Import ¶ added in v0.0.28
func (this *ClientImpl) Import(token string, importModel model.ImportExport, options model.ImportExportOptions) (err error, code int)
func (*ClientImpl) ListAccessibleResourceIds ¶ added in v0.0.11
func (this *ClientImpl) ListAccessibleResourceIds(token string, topicId string, options ListOptions, permissions ...Permission) (ids []string, err error, code int)
func (*ClientImpl) ListComputedPermissions ¶ added in v0.0.15
func (this *ClientImpl) ListComputedPermissions(token string, topicId string, ids []string) (result []model.ComputedPermissions, err error, code int)
func (*ClientImpl) ListResourcesWithAdminPermission ¶ added in v0.0.11
func (this *ClientImpl) ListResourcesWithAdminPermission(token string, topicId string, options ListOptions) (result []Resource, err error, code int)
func (*ClientImpl) ListTopics ¶ added in v0.0.11
func (this *ClientImpl) ListTopics(token string, options ListOptions) (result []Topic, err error, code int)
func (*ClientImpl) RemoveResource ¶ added in v0.0.11
func (this *ClientImpl) RemoveResource(token string, topicId string, id string) (err error, code int)
RemoveResource removes a resource only admins may remove resources
func (*ClientImpl) RemoveTopic ¶ added in v0.0.11
func (this *ClientImpl) RemoveTopic(token string, id string) (err error, code int)
func (*ClientImpl) SetPermission ¶ added in v0.0.11
func (this *ClientImpl) SetPermission(token string, topicId string, id string, permissions ResourcePermissions) (result ResourcePermissions, err error, code int)
SetPermission sets the permissions of a resource. resource initialization needs to be done by an admin; user tokens may update their rights but may not create the initial resource
type GetOptions ¶ added in v0.0.11
type GetOptions = model.GetOptions
type GroupPermissions ¶ added in v0.0.11
type GroupPermissions = model.GroupPermissions
type ImportExport ¶ added in v0.0.28
type ImportExport = model.ImportExport
type ImportExportOptions ¶ added in v0.0.28
type ImportExportOptions = model.ImportExportOptions
type ListOptions ¶ added in v0.0.11
type ListOptions = model.ListOptions
type OpenidToken ¶
type Permission ¶ added in v0.0.11
type Permission = model.Permission
type PermissionList ¶ added in v0.0.11
type PermissionList = model.PermissionList
type PermissionsMap ¶ added in v0.0.11
type PermissionsMap = model.PermissionsMap
type ResourcePermissions ¶ added in v0.0.11
type ResourcePermissions = model.ResourcePermissions