hooks

package
v0.0.15 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 11, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AfterAppCreateHook

type AfterAppCreateHook func(ctx context.Context, app any) error

type AfterMemberAddHook

type AfterMemberAddHook func(ctx context.Context, member any) error

type AfterMemberRemoveHook added in v0.0.6

type AfterMemberRemoveHook func(ctx context.Context, orgID xid.ID, userID xid.ID, memberName string) error

type AfterMemberRoleChangeHook added in v0.0.6

type AfterMemberRoleChangeHook func(ctx context.Context, orgID xid.ID, userID xid.ID, oldRole string, newRole string) error

type AfterOrganizationCreateHook

type AfterOrganizationCreateHook func(ctx context.Context, org any) error

type AfterOrganizationDeleteHook added in v0.0.6

type AfterOrganizationDeleteHook func(ctx context.Context, orgID xid.ID, orgName string) error

type AfterOrganizationUpdateHook added in v0.0.6

type AfterOrganizationUpdateHook func(ctx context.Context, org any) error

type AfterPermissionEvaluateHook added in v0.0.3

type AfterPermissionEvaluateHook func(ctx context.Context, req *PermissionEvaluateRequest, decision *PermissionDecision) error

type AfterSessionCreateHook

type AfterSessionCreateHook func(ctx context.Context, session *session.Session) error

type AfterSessionRevokeHook

type AfterSessionRevokeHook func(ctx context.Context, sessionID xid.ID) error

type AfterSignInHook

type AfterSignInHook func(ctx context.Context, response *responses.AuthResponse) error

type AfterSignOutHook

type AfterSignOutHook func(ctx context.Context, token string) error

type AfterSignUpHook

type AfterSignUpHook func(ctx context.Context, response *responses.AuthResponse) error

type AfterUserCreateHook

type AfterUserCreateHook func(ctx context.Context, user *user.User) error

type AfterUserDeleteHook

type AfterUserDeleteHook func(ctx context.Context, userID xid.ID) error

type AfterUserUpdateHook

type AfterUserUpdateHook func(ctx context.Context, user *user.User) error

type BeforeAppCreateHook

type BeforeAppCreateHook func(ctx context.Context, req any) error

BeforeAppCreateHook is a hook function type for before app creation.

type BeforeMemberAddHook

type BeforeMemberAddHook func(ctx context.Context, orgID string, userID xid.ID) error

type BeforeOrganizationCreateHook

type BeforeOrganizationCreateHook func(ctx context.Context, req any) error

BeforeOrganizationCreateHook is a hook function type for before organization creation.

type BeforePermissionEvaluateHook added in v0.0.3

type BeforePermissionEvaluateHook func(ctx context.Context, req *PermissionEvaluateRequest) error

type BeforeSessionCreateHook

type BeforeSessionCreateHook func(ctx context.Context, req *session.CreateSessionRequest) error

BeforeSessionCreateHook is a hook function type for before session creation.

type BeforeSessionRevokeHook

type BeforeSessionRevokeHook func(ctx context.Context, token string) error

type BeforeSignInHook

type BeforeSignInHook func(ctx context.Context, req *auth.SignInRequest) error

type BeforeSignOutHook

type BeforeSignOutHook func(ctx context.Context, token string) error

type BeforeSignUpHook

type BeforeSignUpHook func(ctx context.Context, req *auth.SignUpRequest) error

BeforeSignUpHook is a hook function type for before sign up.

type BeforeUserCreateHook

type BeforeUserCreateHook func(ctx context.Context, req *user.CreateUserRequest) error

BeforeUserCreateHook is a hook function type for before user creation.

type BeforeUserDeleteHook

type BeforeUserDeleteHook func(ctx context.Context, userID xid.ID) error

type BeforeUserUpdateHook

type BeforeUserUpdateHook func(ctx context.Context, userID xid.ID, req *user.UpdateUserRequest) error

type HookRegistry

type HookRegistry struct {
	// contains filtered or unexported fields
}

HookRegistry manages all hooks for the authentication system. It is thread-safe and timing-independent - hooks can be registered at any point in the application lifecycle and will always be executed.

func NewHookRegistry

func NewHookRegistry() *HookRegistry

NewHookRegistry creates a new hook registry.

func (*HookRegistry) DisableDebug added in v0.0.3

func (h *HookRegistry) DisableDebug()

DisableDebug disables debug logging.

func (*HookRegistry) EnableDebug added in v0.0.3

func (h *HookRegistry) EnableDebug()

EnableDebug enables verbose debug logging for hook registration and execution.

func (*HookRegistry) ExecuteAfterAppCreate

func (h *HookRegistry) ExecuteAfterAppCreate(ctx context.Context, app any) error

ExecuteAfterAppCreate executes all after app create hooks.

func (*HookRegistry) ExecuteAfterMemberAdd

func (h *HookRegistry) ExecuteAfterMemberAdd(ctx context.Context, member any) error

ExecuteAfterMemberAdd executes all after member add hooks.

func (*HookRegistry) ExecuteAfterMemberRemove added in v0.0.6

func (h *HookRegistry) ExecuteAfterMemberRemove(ctx context.Context, orgID xid.ID, userID xid.ID, memberName string) error

ExecuteAfterMemberRemove executes all after member remove hooks.

func (*HookRegistry) ExecuteAfterMemberRoleChange added in v0.0.6

func (h *HookRegistry) ExecuteAfterMemberRoleChange(ctx context.Context, orgID xid.ID, userID xid.ID, oldRole string, newRole string) error

ExecuteAfterMemberRoleChange executes all after member role change hooks.

func (*HookRegistry) ExecuteAfterOrganizationCreate

func (h *HookRegistry) ExecuteAfterOrganizationCreate(ctx context.Context, org any) error

ExecuteAfterOrganizationCreate executes all after organization create hooks.

func (*HookRegistry) ExecuteAfterOrganizationDelete added in v0.0.6

func (h *HookRegistry) ExecuteAfterOrganizationDelete(ctx context.Context, orgID xid.ID, orgName string) error

ExecuteAfterOrganizationDelete executes all after organization delete hooks.

func (*HookRegistry) ExecuteAfterOrganizationUpdate added in v0.0.6

func (h *HookRegistry) ExecuteAfterOrganizationUpdate(ctx context.Context, org any) error

ExecuteAfterOrganizationUpdate executes all after organization update hooks.

func (*HookRegistry) ExecuteAfterPermissionEvaluate added in v0.0.3

func (h *HookRegistry) ExecuteAfterPermissionEvaluate(ctx context.Context, req *PermissionEvaluateRequest, decision *PermissionDecision) error

ExecuteAfterPermissionEvaluate executes all after permission evaluate hooks.

func (*HookRegistry) ExecuteAfterSessionCreate

func (h *HookRegistry) ExecuteAfterSessionCreate(ctx context.Context, session *session.Session) error

ExecuteAfterSessionCreate executes all after session create hooks.

func (*HookRegistry) ExecuteAfterSessionRevoke

func (h *HookRegistry) ExecuteAfterSessionRevoke(ctx context.Context, sessionID xid.ID) error

ExecuteAfterSessionRevoke executes all after session revoke hooks.

func (*HookRegistry) ExecuteAfterSignIn

func (h *HookRegistry) ExecuteAfterSignIn(ctx context.Context, response *responses.AuthResponse) error

ExecuteAfterSignIn executes all after sign in hooks.

func (*HookRegistry) ExecuteAfterSignOut

func (h *HookRegistry) ExecuteAfterSignOut(ctx context.Context, token string) error

ExecuteAfterSignOut executes all after sign out hooks.

func (*HookRegistry) ExecuteAfterSignUp

func (h *HookRegistry) ExecuteAfterSignUp(ctx context.Context, response *responses.AuthResponse) error

ExecuteAfterSignUp executes all after sign up hooks.

func (*HookRegistry) ExecuteAfterUserCreate

func (h *HookRegistry) ExecuteAfterUserCreate(ctx context.Context, user *user.User) error

ExecuteAfterUserCreate executes all after user create hooks.

func (*HookRegistry) ExecuteAfterUserDelete

func (h *HookRegistry) ExecuteAfterUserDelete(ctx context.Context, userID xid.ID) error

ExecuteAfterUserDelete executes all after user delete hooks.

func (*HookRegistry) ExecuteAfterUserUpdate

func (h *HookRegistry) ExecuteAfterUserUpdate(ctx context.Context, user *user.User) error

ExecuteAfterUserUpdate executes all after user update hooks.

func (*HookRegistry) ExecuteBeforeAppCreate

func (h *HookRegistry) ExecuteBeforeAppCreate(ctx context.Context, req any) error

ExecuteBeforeAppCreate executes all before app create hooks.

func (*HookRegistry) ExecuteBeforeMemberAdd

func (h *HookRegistry) ExecuteBeforeMemberAdd(ctx context.Context, orgID string, userID xid.ID) error

ExecuteBeforeMemberAdd executes all before member add hooks.

func (*HookRegistry) ExecuteBeforeOrganizationCreate

func (h *HookRegistry) ExecuteBeforeOrganizationCreate(ctx context.Context, req any) error

ExecuteBeforeOrganizationCreate executes all before organization create hooks.

func (*HookRegistry) ExecuteBeforePermissionEvaluate added in v0.0.3

func (h *HookRegistry) ExecuteBeforePermissionEvaluate(ctx context.Context, req *PermissionEvaluateRequest) error

ExecuteBeforePermissionEvaluate executes all before permission evaluate hooks.

func (*HookRegistry) ExecuteBeforeSessionCreate

func (h *HookRegistry) ExecuteBeforeSessionCreate(ctx context.Context, req *session.CreateSessionRequest) error

ExecuteBeforeSessionCreate executes all before session create hooks.

func (*HookRegistry) ExecuteBeforeSessionRevoke

func (h *HookRegistry) ExecuteBeforeSessionRevoke(ctx context.Context, token string) error

ExecuteBeforeSessionRevoke executes all before session revoke hooks.

func (*HookRegistry) ExecuteBeforeSignIn

func (h *HookRegistry) ExecuteBeforeSignIn(ctx context.Context, req *auth.SignInRequest) error

ExecuteBeforeSignIn executes all before sign in hooks.

func (*HookRegistry) ExecuteBeforeSignOut

func (h *HookRegistry) ExecuteBeforeSignOut(ctx context.Context, token string) error

ExecuteBeforeSignOut executes all before sign out hooks.

func (*HookRegistry) ExecuteBeforeSignUp

func (h *HookRegistry) ExecuteBeforeSignUp(ctx context.Context, req *auth.SignUpRequest) error

ExecuteBeforeSignUp executes all before sign up hooks.

func (*HookRegistry) ExecuteBeforeUserCreate

func (h *HookRegistry) ExecuteBeforeUserCreate(ctx context.Context, req *user.CreateUserRequest) error

ExecuteBeforeUserCreate executes all before user create hooks.

func (*HookRegistry) ExecuteBeforeUserDelete

func (h *HookRegistry) ExecuteBeforeUserDelete(ctx context.Context, userID xid.ID) error

ExecuteBeforeUserDelete executes all before user delete hooks.

func (*HookRegistry) ExecuteBeforeUserUpdate

func (h *HookRegistry) ExecuteBeforeUserUpdate(ctx context.Context, userID xid.ID, req *user.UpdateUserRequest) error

ExecuteBeforeUserUpdate executes all before user update hooks.

func (*HookRegistry) ExecuteOnAccountDeleted added in v0.0.6

func (h *HookRegistry) ExecuteOnAccountDeleted(ctx context.Context, userID xid.ID) error

func (*HookRegistry) ExecuteOnAccountReactivated added in v0.0.6

func (h *HookRegistry) ExecuteOnAccountReactivated(ctx context.Context, userID xid.ID) error

func (*HookRegistry) ExecuteOnAccountSuspended added in v0.0.6

func (h *HookRegistry) ExecuteOnAccountSuspended(ctx context.Context, userID xid.ID, reason string) error

func (*HookRegistry) ExecuteOnAllSessionsRevoked added in v0.0.6

func (h *HookRegistry) ExecuteOnAllSessionsRevoked(ctx context.Context, userID xid.ID) error

func (*HookRegistry) ExecuteOnCacheInvalidate added in v0.0.3

func (h *HookRegistry) ExecuteOnCacheInvalidate(ctx context.Context, scope string, id xid.ID) error

ExecuteOnCacheInvalidate executes all on cache invalidate hooks.

func (*HookRegistry) ExecuteOnDeviceRemoved added in v0.0.6

func (h *HookRegistry) ExecuteOnDeviceRemoved(ctx context.Context, userID xid.ID, deviceName string) error

func (*HookRegistry) ExecuteOnEmailChangeRequest added in v0.0.6

func (h *HookRegistry) ExecuteOnEmailChangeRequest(ctx context.Context, userID xid.ID, oldEmail, newEmail, confirmationUrl string) error

ExecuteOnEmailChangeRequest executes all registered hooks for email change requests.

func (*HookRegistry) ExecuteOnEmailChanged added in v0.0.6

func (h *HookRegistry) ExecuteOnEmailChanged(ctx context.Context, userID xid.ID, oldEmail, newEmail string) error

func (*HookRegistry) ExecuteOnNewDeviceDetected added in v0.0.6

func (h *HookRegistry) ExecuteOnNewDeviceDetected(ctx context.Context, userID xid.ID, deviceName, location, ipAddress string) error

ExecuteOnNewDeviceDetected executes all registered hooks for new device detection.

func (*HookRegistry) ExecuteOnNewLocationDetected added in v0.0.6

func (h *HookRegistry) ExecuteOnNewLocationDetected(ctx context.Context, userID xid.ID, location, ipAddress string) error

func (*HookRegistry) ExecuteOnPasswordChanged added in v0.0.6

func (h *HookRegistry) ExecuteOnPasswordChanged(ctx context.Context, userID xid.ID) error

func (*HookRegistry) ExecuteOnPolicyChange added in v0.0.3

func (h *HookRegistry) ExecuteOnPolicyChange(ctx context.Context, policyID xid.ID, action string) error

ExecuteOnPolicyChange executes all on policy change hooks.

func (*HookRegistry) ExecuteOnSuspiciousLoginDetected added in v0.0.6

func (h *HookRegistry) ExecuteOnSuspiciousLoginDetected(ctx context.Context, userID xid.ID, reason, location, ipAddress string) error

func (*HookRegistry) ExecuteOnUsernameChanged added in v0.0.6

func (h *HookRegistry) ExecuteOnUsernameChanged(ctx context.Context, userID xid.ID, oldUsername, newUsername string) error

func (*HookRegistry) GetHookCounts added in v0.0.3

func (h *HookRegistry) GetHookCounts() map[string]int

GetHookCounts returns the count of registered hooks for diagnostics.

func (*HookRegistry) RegisterAfterAppCreate

func (h *HookRegistry) RegisterAfterAppCreate(hook AfterAppCreateHook)

func (*HookRegistry) RegisterAfterMemberAdd

func (h *HookRegistry) RegisterAfterMemberAdd(hook AfterMemberAddHook)

func (*HookRegistry) RegisterAfterMemberRemove added in v0.0.6

func (h *HookRegistry) RegisterAfterMemberRemove(hook AfterMemberRemoveHook)

func (*HookRegistry) RegisterAfterMemberRoleChange added in v0.0.6

func (h *HookRegistry) RegisterAfterMemberRoleChange(hook AfterMemberRoleChangeHook)

func (*HookRegistry) RegisterAfterOrganizationCreate

func (h *HookRegistry) RegisterAfterOrganizationCreate(hook AfterOrganizationCreateHook)

func (*HookRegistry) RegisterAfterOrganizationDelete added in v0.0.6

func (h *HookRegistry) RegisterAfterOrganizationDelete(hook AfterOrganizationDeleteHook)

func (*HookRegistry) RegisterAfterOrganizationUpdate added in v0.0.6

func (h *HookRegistry) RegisterAfterOrganizationUpdate(hook AfterOrganizationUpdateHook)

func (*HookRegistry) RegisterAfterPermissionEvaluate added in v0.0.3

func (h *HookRegistry) RegisterAfterPermissionEvaluate(hook AfterPermissionEvaluateHook)

RegisterAfterPermissionEvaluate registers an after permission evaluate hook.

func (*HookRegistry) RegisterAfterSessionCreate

func (h *HookRegistry) RegisterAfterSessionCreate(hook AfterSessionCreateHook)

func (*HookRegistry) RegisterAfterSessionRevoke

func (h *HookRegistry) RegisterAfterSessionRevoke(hook AfterSessionRevokeHook)

func (*HookRegistry) RegisterAfterSignIn

func (h *HookRegistry) RegisterAfterSignIn(hook AfterSignInHook)

func (*HookRegistry) RegisterAfterSignOut

func (h *HookRegistry) RegisterAfterSignOut(hook AfterSignOutHook)

func (*HookRegistry) RegisterAfterSignUp

func (h *HookRegistry) RegisterAfterSignUp(hook AfterSignUpHook)

func (*HookRegistry) RegisterAfterUserCreate

func (h *HookRegistry) RegisterAfterUserCreate(hook AfterUserCreateHook)

func (*HookRegistry) RegisterAfterUserDelete

func (h *HookRegistry) RegisterAfterUserDelete(hook AfterUserDeleteHook)

func (*HookRegistry) RegisterAfterUserUpdate

func (h *HookRegistry) RegisterAfterUserUpdate(hook AfterUserUpdateHook)

func (*HookRegistry) RegisterBeforeAppCreate

func (h *HookRegistry) RegisterBeforeAppCreate(hook BeforeAppCreateHook)

RegisterBeforeAppCreate registers a hook to be called before app creation.

func (*HookRegistry) RegisterBeforeMemberAdd

func (h *HookRegistry) RegisterBeforeMemberAdd(hook BeforeMemberAddHook)

func (*HookRegistry) RegisterBeforeOrganizationCreate

func (h *HookRegistry) RegisterBeforeOrganizationCreate(hook BeforeOrganizationCreateHook)

RegisterBeforeOrganizationCreate registers a hook to be called before organization creation.

func (*HookRegistry) RegisterBeforePermissionEvaluate added in v0.0.3

func (h *HookRegistry) RegisterBeforePermissionEvaluate(hook BeforePermissionEvaluateHook)

RegisterBeforePermissionEvaluate registers a before permission evaluate hook.

func (*HookRegistry) RegisterBeforeSessionCreate

func (h *HookRegistry) RegisterBeforeSessionCreate(hook BeforeSessionCreateHook)

RegisterBeforeSessionCreate registers a hook to be called before session creation.

func (*HookRegistry) RegisterBeforeSessionRevoke

func (h *HookRegistry) RegisterBeforeSessionRevoke(hook BeforeSessionRevokeHook)

func (*HookRegistry) RegisterBeforeSignIn

func (h *HookRegistry) RegisterBeforeSignIn(hook BeforeSignInHook)

func (*HookRegistry) RegisterBeforeSignOut

func (h *HookRegistry) RegisterBeforeSignOut(hook BeforeSignOutHook)

func (*HookRegistry) RegisterBeforeSignUp

func (h *HookRegistry) RegisterBeforeSignUp(hook BeforeSignUpHook)

RegisterBeforeSignUp registers a hook to be called before sign up.

func (*HookRegistry) RegisterBeforeUserCreate

func (h *HookRegistry) RegisterBeforeUserCreate(hook BeforeUserCreateHook)

RegisterBeforeUserCreate registers a hook to be called before user creation.

func (*HookRegistry) RegisterBeforeUserDelete

func (h *HookRegistry) RegisterBeforeUserDelete(hook BeforeUserDeleteHook)

func (*HookRegistry) RegisterBeforeUserUpdate

func (h *HookRegistry) RegisterBeforeUserUpdate(hook BeforeUserUpdateHook)

func (*HookRegistry) RegisterOnAccountDeleted added in v0.0.6

func (h *HookRegistry) RegisterOnAccountDeleted(hook OnAccountDeletedHook)

func (*HookRegistry) RegisterOnAccountReactivated added in v0.0.6

func (h *HookRegistry) RegisterOnAccountReactivated(hook OnAccountReactivatedHook)

func (*HookRegistry) RegisterOnAccountSuspended added in v0.0.6

func (h *HookRegistry) RegisterOnAccountSuspended(hook OnAccountSuspendedHook)

func (*HookRegistry) RegisterOnAllSessionsRevoked added in v0.0.6

func (h *HookRegistry) RegisterOnAllSessionsRevoked(hook OnAllSessionsRevokedHook)

func (*HookRegistry) RegisterOnCacheInvalidate added in v0.0.3

func (h *HookRegistry) RegisterOnCacheInvalidate(hook OnCacheInvalidateHook)

RegisterOnCacheInvalidate registers an on cache invalidate hook.

func (*HookRegistry) RegisterOnDeviceRemoved added in v0.0.6

func (h *HookRegistry) RegisterOnDeviceRemoved(hook OnDeviceRemovedHook)

func (*HookRegistry) RegisterOnEmailChangeRequest added in v0.0.6

func (h *HookRegistry) RegisterOnEmailChangeRequest(hook OnEmailChangeRequestHook)

RegisterOnEmailChangeRequest registers a hook to be called when an email change is requested.

func (*HookRegistry) RegisterOnEmailChanged added in v0.0.6

func (h *HookRegistry) RegisterOnEmailChanged(hook OnEmailChangedHook)

func (*HookRegistry) RegisterOnNewDeviceDetected added in v0.0.6

func (h *HookRegistry) RegisterOnNewDeviceDetected(hook OnNewDeviceDetectedHook)

RegisterOnNewDeviceDetected registers a hook to be called when a new device is detected.

func (*HookRegistry) RegisterOnNewLocationDetected added in v0.0.6

func (h *HookRegistry) RegisterOnNewLocationDetected(hook OnNewLocationDetectedHook)

func (*HookRegistry) RegisterOnPasswordChanged added in v0.0.6

func (h *HookRegistry) RegisterOnPasswordChanged(hook OnPasswordChangedHook)

func (*HookRegistry) RegisterOnPolicyChange added in v0.0.3

func (h *HookRegistry) RegisterOnPolicyChange(hook OnPolicyChangeHook)

RegisterOnPolicyChange registers an on policy change hook.

func (*HookRegistry) RegisterOnSuspiciousLoginDetected added in v0.0.6

func (h *HookRegistry) RegisterOnSuspiciousLoginDetected(hook OnSuspiciousLoginDetectedHook)

func (*HookRegistry) RegisterOnUsernameChanged added in v0.0.6

func (h *HookRegistry) RegisterOnUsernameChanged(hook OnUsernameChangedHook)

type OnAccountDeletedHook added in v0.0.6

type OnAccountDeletedHook func(ctx context.Context, userID xid.ID) error

type OnAccountReactivatedHook added in v0.0.6

type OnAccountReactivatedHook func(ctx context.Context, userID xid.ID) error

type OnAccountSuspendedHook added in v0.0.6

type OnAccountSuspendedHook func(ctx context.Context, userID xid.ID, reason string) error

type OnAllSessionsRevokedHook added in v0.0.6

type OnAllSessionsRevokedHook func(ctx context.Context, userID xid.ID) error

type OnCacheInvalidateHook added in v0.0.3

type OnCacheInvalidateHook func(ctx context.Context, scope string, id xid.ID) error

type OnDeviceRemovedHook added in v0.0.6

type OnDeviceRemovedHook func(ctx context.Context, userID xid.ID, deviceName string) error

type OnEmailChangeRequestHook added in v0.0.6

type OnEmailChangeRequestHook func(ctx context.Context, userID xid.ID, oldEmail, newEmail, confirmationUrl string) error

OnEmailChangeRequestHook is a hook function type for when an email change is requested.

type OnEmailChangedHook added in v0.0.6

type OnEmailChangedHook func(ctx context.Context, userID xid.ID, oldEmail, newEmail string) error

type OnNewDeviceDetectedHook added in v0.0.6

type OnNewDeviceDetectedHook func(ctx context.Context, userID xid.ID, deviceName, location, ipAddress string) error

OnNewDeviceDetectedHook is a hook function type for when a new device is detected.

type OnNewLocationDetectedHook added in v0.0.6

type OnNewLocationDetectedHook func(ctx context.Context, userID xid.ID, location, ipAddress string) error

type OnPasswordChangedHook added in v0.0.6

type OnPasswordChangedHook func(ctx context.Context, userID xid.ID) error

type OnPolicyChangeHook added in v0.0.3

type OnPolicyChangeHook func(ctx context.Context, policyID xid.ID, action string) error

type OnSuspiciousLoginDetectedHook added in v0.0.6

type OnSuspiciousLoginDetectedHook func(ctx context.Context, userID xid.ID, reason, location, ipAddress string) error

type OnUsernameChangedHook added in v0.0.6

type OnUsernameChangedHook func(ctx context.Context, userID xid.ID, oldUsername, newUsername string) error

type PermissionDecision added in v0.0.3

type PermissionDecision struct {
	Allowed          bool
	MatchedPolicies  []string
	EvaluationTimeMs float64
	CacheHit         bool
	Error            string
}

PermissionDecision is passed to after permission evaluate hook.

type PermissionEvaluateRequest added in v0.0.3

type PermissionEvaluateRequest struct {
	UserID       xid.ID
	ResourceType string
	ResourceID   string
	Action       string
	Context      map[string]any
}

PermissionEvaluateRequest is passed to before/after permission evaluate hooks.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL