Documentation
¶
Index ¶
- Constants
- Variables
- func AutoApproveSession(ctx context.Context, sessionID string)
- func Deny(ctx context.Context, permission PermissionRequest)
- func GetService() *permissionService
- func Grant(ctx context.Context, permission PermissionRequest)
- func GrantPersistant(ctx context.Context, permission PermissionRequest)
- func InitService() error
- func IsAutoApproved(ctx context.Context, sessionID string) bool
- func Request(ctx context.Context, opts CreatePermissionRequest) bool
- func SubscribeToRequests(ctx context.Context) <-chan pubsub.Event[PermissionRequest]
- func SubscribeToResponses(ctx context.Context) <-chan pubsub.Event[PermissionResponse]
- type CreatePermissionRequest
- type PermissionRequest
- type PermissionResponse
- type Service
Constants ¶
Variables ¶
View Source
var ErrorPermissionDenied = errors.New("permission denied")
Functions ¶
func AutoApproveSession ¶
func Deny ¶
func Deny(ctx context.Context, permission PermissionRequest)
func GetService ¶
func GetService() *permissionService
func Grant ¶
func Grant(ctx context.Context, permission PermissionRequest)
func GrantPersistant ¶
func GrantPersistant(ctx context.Context, permission PermissionRequest)
func InitService ¶
func InitService() error
func SubscribeToRequests ¶
func SubscribeToRequests(ctx context.Context) <-chan pubsub.Event[PermissionRequest]
func SubscribeToResponses ¶
func SubscribeToResponses(ctx context.Context) <-chan pubsub.Event[PermissionResponse]
Types ¶
type CreatePermissionRequest ¶
type PermissionRequest ¶
type PermissionResponse ¶
type PermissionResponse struct {
Request PermissionRequest
Granted bool
}
type Service ¶
type Service interface {
pubsub.Subscriber[PermissionRequest]
SubscribeToResponseEvents(ctx context.Context) <-chan pubsub.Event[PermissionResponse]
GrantPersistant(ctx context.Context, permission PermissionRequest)
Grant(ctx context.Context, permission PermissionRequest)
Deny(ctx context.Context, permission PermissionRequest)
Request(ctx context.Context, opts CreatePermissionRequest) bool
AutoApproveSession(ctx context.Context, sessionID string)
IsAutoApproved(ctx context.Context, sessionID string) bool
}
Click to show internal directories.
Click to hide internal directories.