repositories

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BunRolePermissionRepository

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

func NewBunRolePermissionRepository

func NewBunRolePermissionRepository(db bun.IDB) *BunRolePermissionRepository

func (*BunRolePermissionRepository) AddRolePermission

func (r *BunRolePermissionRepository) AddRolePermission(ctx context.Context, roleID string, permissionID string, grantedByUserID *string) error

func (*BunRolePermissionRepository) AssignUserRole

func (r *BunRolePermissionRepository) AssignUserRole(ctx context.Context, userID string, roleID string, assignedByUserID *string, expiresAt *time.Time) error

func (*BunRolePermissionRepository) CountRoleAssignmentsByPermissionID

func (r *BunRolePermissionRepository) CountRoleAssignmentsByPermissionID(ctx context.Context, permissionID string) (int, error)

func (*BunRolePermissionRepository) CountUserAssignmentsByRoleID

func (r *BunRolePermissionRepository) CountUserAssignmentsByRoleID(ctx context.Context, roleID string) (int, error)

func (*BunRolePermissionRepository) CreatePermission

func (r *BunRolePermissionRepository) CreatePermission(ctx context.Context, permission *types.Permission) error

func (*BunRolePermissionRepository) CreateRole

func (r *BunRolePermissionRepository) CreateRole(ctx context.Context, role *types.Role) error

func (*BunRolePermissionRepository) DeletePermission

func (r *BunRolePermissionRepository) DeletePermission(ctx context.Context, permissionID string) (bool, error)

func (*BunRolePermissionRepository) DeleteRole

func (r *BunRolePermissionRepository) DeleteRole(ctx context.Context, roleID string) (bool, error)

func (*BunRolePermissionRepository) GetAllPermissions

func (r *BunRolePermissionRepository) GetAllPermissions(ctx context.Context) ([]types.Permission, error)

func (*BunRolePermissionRepository) GetAllRoles

func (r *BunRolePermissionRepository) GetAllRoles(ctx context.Context) ([]types.Role, error)

func (*BunRolePermissionRepository) GetPermissionByID

func (r *BunRolePermissionRepository) GetPermissionByID(ctx context.Context, permissionID string) (*types.Permission, error)

func (*BunRolePermissionRepository) GetRoleByID

func (r *BunRolePermissionRepository) GetRoleByID(ctx context.Context, roleID string) (*types.Role, error)

func (*BunRolePermissionRepository) GetRolePermissions

func (r *BunRolePermissionRepository) GetRolePermissions(ctx context.Context, roleID string) ([]types.UserPermissionInfo, error)

func (*BunRolePermissionRepository) RemoveRolePermission

func (r *BunRolePermissionRepository) RemoveRolePermission(ctx context.Context, roleID string, permissionID string) error

func (*BunRolePermissionRepository) RemoveUserRole

func (r *BunRolePermissionRepository) RemoveUserRole(ctx context.Context, userID string, roleID string) error

func (*BunRolePermissionRepository) ReplaceRolePermissions

func (r *BunRolePermissionRepository) ReplaceRolePermissions(ctx context.Context, roleID string, permissionIDs []string, grantedByUserID *string) error

func (*BunRolePermissionRepository) ReplaceUserRoles

func (r *BunRolePermissionRepository) ReplaceUserRoles(ctx context.Context, userID string, roleIDs []string, assignedByUserID *string) error

func (*BunRolePermissionRepository) UpdatePermission

func (r *BunRolePermissionRepository) UpdatePermission(ctx context.Context, permissionID string, description *string) (bool, error)

func (*BunRolePermissionRepository) UpdateRole

func (r *BunRolePermissionRepository) UpdateRole(ctx context.Context, roleID string, name *string, description *string) (bool, error)

type BunUserAccessRepository

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

func NewBunUserAccessRepository

func NewBunUserAccessRepository(db bun.IDB) *BunUserAccessRepository

func (*BunUserAccessRepository) GetUserEffectivePermissions

func (r *BunUserAccessRepository) GetUserEffectivePermissions(ctx context.Context, userID string) ([]types.UserPermissionInfo, error)

func (*BunUserAccessRepository) GetUserRoles

func (r *BunUserAccessRepository) GetUserRoles(ctx context.Context, userID string) ([]types.UserRoleInfo, error)

func (*BunUserAccessRepository) GetUserWithPermissionsByID

func (r *BunUserAccessRepository) GetUserWithPermissionsByID(ctx context.Context, userID string) (*types.UserWithPermissions, error)

func (*BunUserAccessRepository) GetUserWithRolesByID

func (r *BunUserAccessRepository) GetUserWithRolesByID(ctx context.Context, userID string) (*types.UserWithRoles, error)

type RolePermissionRepository

type RolePermissionRepository interface {
	CreateRole(ctx context.Context, role *types.Role) error
	GetAllRoles(ctx context.Context) ([]types.Role, error)
	GetRoleByID(ctx context.Context, roleID string) (*types.Role, error)
	UpdateRole(ctx context.Context, roleID string, name *string, description *string) (bool, error)
	DeleteRole(ctx context.Context, roleID string) (bool, error)
	GetAllPermissions(ctx context.Context) ([]types.Permission, error)
	GetPermissionByID(ctx context.Context, permissionID string) (*types.Permission, error)
	CreatePermission(ctx context.Context, permission *types.Permission) error
	UpdatePermission(ctx context.Context, permissionID string, description *string) (bool, error)
	DeletePermission(ctx context.Context, permissionID string) (bool, error)
	GetRolePermissions(ctx context.Context, roleID string) ([]types.UserPermissionInfo, error)
	ReplaceRolePermissions(ctx context.Context, roleID string, permissionIDs []string, grantedByUserID *string) error
	AddRolePermission(ctx context.Context, roleID string, permissionID string, grantedByUserID *string) error
	RemoveRolePermission(ctx context.Context, roleID string, permissionID string) error
	ReplaceUserRoles(ctx context.Context, userID string, roleIDs []string, assignedByUserID *string) error
	AssignUserRole(ctx context.Context, userID string, roleID string, assignedByUserID *string, expiresAt *time.Time) error
	RemoveUserRole(ctx context.Context, userID string, roleID string) error
	CountUserAssignmentsByRoleID(ctx context.Context, roleID string) (int, error)
	CountRoleAssignmentsByPermissionID(ctx context.Context, permissionID string) (int, error)
}

type UserAccessRepository

type UserAccessRepository interface {
	GetUserRoles(ctx context.Context, userID string) ([]types.UserRoleInfo, error)
	GetUserEffectivePermissions(ctx context.Context, userID string) ([]types.UserPermissionInfo, error)
	GetUserWithRolesByID(ctx context.Context, userID string) (*types.UserWithRoles, error)
	GetUserWithPermissionsByID(ctx context.Context, userID string) (*types.UserWithPermissions, error)
}

Jump to

Keyboard shortcuts

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