access

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AssignSystemRoleByEmailCommand

type AssignSystemRoleByEmailCommand struct {
	Email     string
	FullName  string
	Role      entity.SystemRole
	GrantedBy string
}

AssignSystemRoleByEmailCommand represents the command to assign a system role by email.

type AssignSystemRoleCommand

type AssignSystemRoleCommand struct {
	UserID    string
	Role      entity.SystemRole
	GrantedBy string
}

AssignSystemRoleCommand represents the command to assign a system role.

type RecordAccessCommand

type RecordAccessCommand struct {
	UserID     string
	EntityType entity.AccessEntityType
	EntityID   string
}

RecordAccessCommand contains data for recording a resource access.

type RevokeSystemRoleCommand

type RevokeSystemRoleCommand struct {
	UserID    string
	RevokedBy string
}

RevokeSystemRoleCommand represents the command to revoke a system role.

type SystemRoleUseCase

type SystemRoleUseCase interface {
	// ListUsersWithSystemRoles lists all users that have system roles.
	ListUsersWithSystemRoles(ctx context.Context) ([]*entity.SystemRoleWithUser, error)

	// AssignRole assigns a system role to a user.
	AssignRole(ctx context.Context, cmd AssignSystemRoleCommand) (*entity.SystemRoleAssignment, error)

	// AssignRoleByEmail assigns a system role to a user identified by email.
	// Creates a shadow user if the email doesn't exist.
	AssignRoleByEmail(ctx context.Context, cmd AssignSystemRoleByEmailCommand) (*entity.SystemRoleWithUser, error)

	// RevokeRole revokes a user's system role.
	RevokeRole(ctx context.Context, cmd RevokeSystemRoleCommand) error

	// GetUserSystemRole gets a user's system role.
	GetUserSystemRole(ctx context.Context, userID string) (*entity.SystemRoleAssignment, error)
}

SystemRoleUseCase defines the input port for system role operations.

type UserAccessHistoryUseCase

type UserAccessHistoryUseCase interface {
	// RecordTenantAccess records that a user accessed a tenant.
	RecordTenantAccess(ctx context.Context, userID, tenantID string) error

	// RecordWorkspaceAccess records that a user accessed a workspace.
	RecordWorkspaceAccess(ctx context.Context, userID, workspaceID string) error

	// GetRecentTenantIDs returns the IDs of recently accessed tenants for a user.
	GetRecentTenantIDs(ctx context.Context, userID string) ([]string, error)

	// GetRecentWorkspaceIDs returns the IDs of recently accessed workspaces for a user.
	GetRecentWorkspaceIDs(ctx context.Context, userID string) ([]string, error)
}

UserAccessHistoryUseCase defines the interface for user access history operations.

Jump to

Keyboard shortcuts

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