Help us shape the future of Go! Take the 2026 Go Developer Survey

store

package
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Overview

Package store provides SCIM Store implementations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// BaseURL is the base URL for SCIM resources.
	BaseURL string

	// DefaultRole is the default role for new group members.
	DefaultRole string

	// TrustProvisionedEmail marks emails written through SCIM as verified.
	// Enable it only when the identity provider is trusted to assert email
	// ownership: a verified email lets a later social login with the same
	// address link to the provisioned user automatically. When false (the
	// default), provisioned and changed emails are unverified, and social
	// login refuses to link rather than creating a second identity.
	TrustProvisionedEmail bool
}

Config holds configuration for the Ent store.

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig returns the default store configuration.

type EntStore

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

EntStore implements the scim.Store interface using Ent ORM.

func NewEntStore

func NewEntStore(client *ent.Client, config *Config) *EntStore

NewEntStore creates a new Ent-backed SCIM store.

func (*EntStore) AddMemberToGroup

func (s *EntStore) AddMemberToGroup(ctx context.Context, groupID, userID string) error

AddMemberToGroup adds a user to a group. Adding an existing member is a no-op; re-adding a deactivated member reactivates the membership.

func (*EntStore) CreateGroup

func (s *EntStore) CreateGroup(ctx context.Context, scimGroup *scim.Group) (*scim.Group, error)

CreateGroup creates a new group.

func (*EntStore) CreateUser

func (s *EntStore) CreateUser(ctx context.Context, scimUser *scim.User) (*scim.User, error)

CreateUser creates a new user as a human principal.

func (*EntStore) DeleteGroup

func (s *EntStore) DeleteGroup(ctx context.Context, id string) error

DeleteGroup deletes a group.

func (*EntStore) DeleteUser

func (s *EntStore) DeleteUser(ctx context.Context, id string) error

DeleteUser deletes a user together with its group memberships and the records that belong only to it.

func (*EntStore) GetGroupByDisplayName

func (s *EntStore) GetGroupByDisplayName(ctx context.Context, displayName string) (*scim.Group, error)

GetGroupByDisplayName retrieves a group by displayName.

func (*EntStore) GetGroupByExternalID

func (s *EntStore) GetGroupByExternalID(ctx context.Context, externalID string) (*scim.Group, error)

GetGroupByExternalID retrieves a group by externalId.

func (*EntStore) GetGroupByID

func (s *EntStore) GetGroupByID(ctx context.Context, id string) (*scim.Group, error)

GetGroupByID retrieves a group by SCIM ID.

func (*EntStore) GetGroupsForUser

func (s *EntStore) GetGroupsForUser(ctx context.Context, userID string) ([]scim.GroupRef, error)

GetGroupsForUser returns all groups a user belongs to.

func (*EntStore) GetMembersForGroup

func (s *EntStore) GetMembersForGroup(ctx context.Context, groupID string) ([]scim.MemberRef, error)

GetMembersForGroup returns all human members of a group.

func (*EntStore) GetUserByExternalID

func (s *EntStore) GetUserByExternalID(ctx context.Context, externalID string) (*scim.User, error)

GetUserByExternalID retrieves a user by externalId. SystemForge does not store externalId, so this always reports not found.

func (*EntStore) GetUserByID

func (s *EntStore) GetUserByID(ctx context.Context, id string) (*scim.User, error)

GetUserByID retrieves a user by SCIM ID.

func (*EntStore) GetUserByUserName

func (s *EntStore) GetUserByUserName(ctx context.Context, userName string) (*scim.User, error)

GetUserByUserName retrieves a user by userName (email). userName is not case-exact (RFC 7643 section 4.1.1), so the match ignores case.

func (*EntStore) ListGroups

func (s *EntStore) ListGroups(ctx context.Context, opts scim.ListOptions) ([]*scim.Group, int, error)

ListGroups lists groups with filtering and pagination.

func (*EntStore) ListUsers

func (s *EntStore) ListUsers(ctx context.Context, opts scim.ListOptions) ([]*scim.User, int, error)

ListUsers lists users with filtering and pagination.

func (*EntStore) RemoveMemberFromGroup

func (s *EntStore) RemoveMemberFromGroup(ctx context.Context, groupID, userID string) error

RemoveMemberFromGroup removes a user from a group.

func (*EntStore) UpdateGroup

func (s *EntStore) UpdateGroup(ctx context.Context, id string, scimGroup *scim.Group) (*scim.Group, error)

UpdateGroup updates an existing group.

func (*EntStore) UpdateUser

func (s *EntStore) UpdateUser(ctx context.Context, id string, scimUser *scim.User) (*scim.User, error)

UpdateUser updates an existing user.

Jump to

Keyboard shortcuts

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