group

package
v0.7.10 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Enabled  State = "enabled"
	Disabled State = "disabled"

	MemberPermission = schema.MembershipPermission
	AdminPermission  = schema.DeletePermission
)

Variables

View Source
var (
	ErrNotExist              = errors.New("group doesn't exist")
	ErrInvalidUUID           = errors.New("invalid syntax of uuid")
	ErrInvalidID             = errors.New("group id is invalid")
	ErrConflict              = errors.New("group already exist")
	ErrInvalidDetail         = errors.New("invalid group detail")
	ErrListingGroupRelations = errors.New("error while listing relations")
	ErrFetchingUsers         = errors.New("error while fetching users")
	ErrFetchingGroups        = errors.New("error while fetching groups")
)

Functions

This section is empty.

Types

type AuthnService

type AuthnService interface {
	GetPrincipal(ctx context.Context, via ...authenticate.ClientAssertion) (authenticate.Principal, error)
}

type Filter

type Filter struct {
	OrganizationID string
	State          State
}

type Group

type Group struct {
	ID             string
	Name           string
	Title          string
	OrganizationID string `json:"orgId"`
	Metadata       metadata.Metadata
	State          State
	CreatedAt      time.Time
	UpdatedAt      time.Time
}

type PolicyService added in v0.7.5

type PolicyService interface {
	Create(ctx context.Context, policy policy.Policy) (policy.Policy, error)
}

type RelationService

type RelationService interface {
	Create(ctx context.Context, rel relation.Relation) (relation.Relation, error)
	ListRelations(ctx context.Context, rel relation.Relation) ([]relation.Relation, error)
	LookupSubjects(ctx context.Context, rel relation.Relation) ([]string, error)
	LookupResources(ctx context.Context, rel relation.Relation) ([]string, error)
	Delete(ctx context.Context, rel relation.Relation) error
}

type Repository

type Repository interface {
	Create(ctx context.Context, grp Group) (Group, error)
	GetByID(ctx context.Context, id string) (Group, error)
	GetByIDs(ctx context.Context, groupIDs []string, flt Filter) ([]Group, error)
	List(ctx context.Context, flt Filter) ([]Group, error)
	UpdateByID(ctx context.Context, toUpdate Group) (Group, error)
	ListGroupRelations(ctx context.Context, objectId, subjectType, role string) ([]relation.Relation, error)
	SetState(ctx context.Context, id string, state State) error
	Delete(ctx context.Context, id string) error
}

type Service

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

func NewService

func NewService(repository Repository, relationService RelationService,
	authnService AuthnService, policyService PolicyService) *Service

func (Service) AddMember

func (s Service) AddMember(ctx context.Context, groupID string, principal authenticate.Principal) error

AddMember adds a subject(user) to group as member

func (Service) AddUsers

func (s Service) AddUsers(ctx context.Context, groupID string, userIDs []string) error

func (Service) Create

func (s Service) Create(ctx context.Context, grp Group) (Group, error)

func (Service) Delete

func (s Service) Delete(ctx context.Context, id string) error

func (Service) Disable

func (s Service) Disable(ctx context.Context, id string) error

func (Service) Enable

func (s Service) Enable(ctx context.Context, id string) error

func (Service) Get

func (s Service) Get(ctx context.Context, id string) (Group, error)

func (Service) GetByIDs added in v0.7.6

func (s Service) GetByIDs(ctx context.Context, ids []string) ([]Group, error)

func (Service) List

func (s Service) List(ctx context.Context, flt Filter) ([]Group, error)

func (Service) ListByOrganization

func (s Service) ListByOrganization(ctx context.Context, id string) ([]Group, error)

ListByOrganization will be useful for nested groups but we don't do that at the moment so it will not be directly used

func (Service) ListByUser

func (s Service) ListByUser(ctx context.Context, userId string, flt Filter) ([]Group, error)

func (Service) RemoveUsers

func (s Service) RemoveUsers(ctx context.Context, groupID string, userIDs []string) error

RemoveUsers removes users from a group as members

func (Service) Update

func (s Service) Update(ctx context.Context, grp Group) (Group, error)

type State

type State string

func (State) String

func (s State) String() string

Jump to

Keyboard shortcuts

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