service

package
v0.7.21 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2025 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const MAX_INT = math.MaxInt

Variables

This section is empty.

Functions

func CheckFilterRoles

func CheckFilterRoles(userRoles []*graph.Role, searchfilterRoles []*graph.RoleInput) bool

func FilterInvites

func FilterInvites(invites []db.Invite, s *string, filterRoles []*graph.RoleInput) ([]db.Invite, int)

func GeneratePaginationLimits

func GeneratePaginationLimits(limit int, userIdToRolesLength int, page int, invitesLength int) (int, int)

func GetRequestId

func GetRequestId(ctx context.Context) string

func GetUserIDsFromUserIDRoles

func GetUserIDsFromUserIDRoles(userIDToRoles map[string][]string) []string

func VerifyLimitsWithOverride

func VerifyLimitsWithOverride(limit *int, page *int) error

Types

type Service

type Service struct {
	Db  db.Service
	Fga fga.Service
	// contains filtered or unexported fields
}

func New

func New(db db.Service, fga fga.Service, log *logger.Logger) *Service

func (*Service) AssignRoleBindings

func (s *Service) AssignRoleBindings(ctx context.Context, tenantID string, entityType string,
	entityID string, input []*graph.Change) (bool, error)

func (*Service) AvailableRolesForEntity

func (s *Service) AvailableRolesForEntity(ctx context.Context, tenantID string, entity graph.EntityInput) ([]*graph.Role, error)

func (*Service) AvailableRolesForEntityType

func (s *Service) AvailableRolesForEntityType(ctx context.Context, tenantID string, entityType string) ([]*graph.Role, error)

func (*Service) CreateUser

func (s *Service) CreateUser(ctx context.Context, tenantID string, input graph.UserInput) (*graph.User, error)

func (*Service) DeleteInvite

func (s *Service) DeleteInvite(ctx context.Context, tenantID string, invite graph.Invite) (bool, error)

func (*Service) InviteUser

func (s *Service) InviteUser(ctx context.Context, tenantID string, invite graph.Invite, notifyByEmail bool) (bool, error)

func (*Service) LeaveEntity

func (s *Service) LeaveEntity(ctx context.Context, tenantID string, entityType string, entityID string) (bool, error)

func (*Service) Login added in v0.4.2

func (s *Service) Login(ctx context.Context) (bool, error)

func (*Service) RemoveFromEntity

func (s *Service) RemoveFromEntity(ctx context.Context, tenantID string, entityType string, userID string, entityID string) (bool, error)

func (*Service) RemoveUser

func (s *Service) RemoveUser(ctx context.Context, tenantID string, rawUserID *string, rawEmail *string) (*bool, error)

func (*Service) RolesForUserOfEntity

func (s *Service) RolesForUserOfEntity(ctx context.Context, tenantID string,
	entity graph.EntityInput, userID string) ([]*graph.Role, error)

func (*Service) SearchUsers

func (s *Service) SearchUsers(ctx context.Context, query string) ([]*graph.User, error)

func (*Service) TenantInfo

func (s *Service) TenantInfo(ctx context.Context, tenantIdInput *string) (*graph.TenantInfo, error)

func (*Service) User

func (s *Service) User(ctx context.Context, tenantID string, userID string) (*graph.User, error)

func (*Service) UserByEmail

func (s *Service) UserByEmail(ctx context.Context, tenantID string, email string) (*graph.User, error)

func (*Service) UsersByIds added in v0.1.0

func (s *Service) UsersByIds(
	ctx context.Context,
	tenantID string,
	userIds []string,
) ([]*graph.User, error)

func (*Service) UsersConnection

func (s *Service) UsersConnection(ctx context.Context, tenantID string, limit *int, page *int) (*graph.UserConnection, error)

func (*Service) UsersOfEntity

func (s *Service) UsersOfEntity(
	ctx context.Context,
	tenantID string,
	entity graph.EntityInput,
	limit *int,
	page *int,
	showInvitees *bool,
	searchTerm *string,
	rolesfilter []*graph.RoleInput,
	sortBy *graph.SortByInput,
) (*graph.GrantedUserConnection, error)

type ServiceInterface

type ServiceInterface interface {
	AssignRoleBindings(ctx context.Context, tenantID string, entityType string, entityID string, input []*graph.Change) (bool, error)
	UsersOfEntity(ctx context.Context, tenantID string, entity graph.EntityInput, limit *int,
		page *int, showInvitees *bool, searchTerm *string, rolesFilter []*graph.RoleInput, sortBy *graph.SortByInput,
	) (*graph.GrantedUserConnection, error)
	RemoveFromEntity(ctx context.Context, tenantID string, entityType string, userID string, entityID string) (bool, error)
	LeaveEntity(ctx context.Context, tenantID string, entityType string, entityID string) (bool, error)
	RolesForUserOfEntity(ctx context.Context, tenantID string, entity graph.EntityInput, userID string) ([]*graph.Role, error)
	AvailableRolesForEntity(ctx context.Context, tenantID string, entity graph.EntityInput) ([]*graph.Role, error)
	AvailableRolesForEntityType(ctx context.Context, tenantID string, entityType string) ([]*graph.Role, error)
	InviteUser(ctx context.Context, tenantID string, invite graph.Invite, notifyByEmail bool) (bool, error)
	DeleteInvite(ctx context.Context, tenantID string, invite graph.Invite) (bool, error)
	CreateUser(ctx context.Context, tenantID string, input graph.UserInput) (*graph.User, error)
	RemoveUser(ctx context.Context, tenantID string, rawUserID *string, rawEmail *string) (*bool, error)
	User(ctx context.Context, tenantID string, userID string) (*graph.User, error)
	UserByEmail(ctx context.Context, tenantID string, email string) (*graph.User, error)
	UsersConnection(ctx context.Context, tenantID string, limit *int, page *int) (*graph.UserConnection, error)
	TenantInfo(ctx context.Context, tenantIdInput *string) (*graph.TenantInfo, error)
	SearchUsers(ctx context.Context, query string) ([]*graph.User, error)
	UsersByIds(ctx context.Context, tenantID string, userIds []string) ([]*graph.User, error)
	Login(ctx context.Context) (bool, error)
}

Jump to

Keyboard shortcuts

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