fga

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2025 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const ParentEntry = "parent"

Variables

This section is empty.

Functions

This section is empty.

Types

type CompatService

type CompatService struct {
	openfgav1.UnimplementedOpenFGAServiceServer
	// contains filtered or unexported fields
}

func NewCompatClient

func NewCompatClient(cl openfgav1.OpenFGAServiceClient, db db.Service, fgaEvents FgaEvents) (*CompatService, error)

func NewFGAServer

func NewFGAServer(
	grpcAddr string,
	db db.Service,
	fgaEvents FgaEvents,
	tr policy_services.TenantIdReader,
	isLocal bool,
) (*grpc.Server, *CompatService, error)

func NewFGAService

func NewFGAService(grpcAddr string, db db.Service, fgaEvents FgaEvents) (*CompatService, error)

func (*CompatService) AssignRoleBindings

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

func (*CompatService) CreateAccount

func (s *CompatService) CreateAccount(ctx context.Context, tenantID string, entityType string, entityID string, ownerUserID string) error

func (*CompatService) GetPermissionsForRole added in v0.2.0

func (s *CompatService) GetPermissionsForRole(ctx context.Context, tenantID string, entityType string, roleTechnicalName string) ([]*graphql.Permission, error)

func (*CompatService) RemoveAccount

func (s *CompatService) RemoveAccount(ctx context.Context, tenantID string, entityType string, entityID string) error

func (*CompatService) RemoveFromEntity

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

func (*CompatService) UsersForEntity

func (s *CompatService) UsersForEntity(
	ctx context.Context, tenantID string, entityID string, entityType string,
) (types.UserIDToRoles, error)

UsersForEntity returns a map of user IDs to roles for a given entity.

func (*CompatService) UsersForEntityRolefilter

func (s *CompatService) UsersForEntityRolefilter(
	ctx context.Context,
	tenantID string,
	entityID string,
	entityType string,
	rolefilter []*graphql.RoleInput,
) (types.UserIDToRoles, error)

UsersForEntityRolefilter returns a map of user IDs to roles for a given entity using a rolefilter

func (*CompatService) WithFGAStoreHelper added in v0.3.0

func (c *CompatService) WithFGAStoreHelper(helper pmfga.FGAStoreHelper) *CompatService

func (*CompatService) Write

Write implements openfgav1.OpenFGAServiceServer.

type FGAEventer

type FGAEventer struct {
	FGALoginHandler
	// contains filtered or unexported fields
}

func NewFGAEventer

func NewFGAEventer(
	client openfgav1.OpenFGAServiceClient,
	inviteManager InviteManger,
	helper pmfga.FGAStoreHelper,
	opts ...FGAEventerOption,
) (*FGAEventer, error)

func (*FGAEventer) HandleLogin

func (s *FGAEventer) HandleLogin(ctx context.Context, logger *commonslogger.Logger,
	tenantID string, userId string, userEmail string) error

HandleLogin Handles the login event whenever a user logs into the portal. This makes sure that the user gets the appropriate tenant role

type FGAEventerOption

type FGAEventerOption func(f *FGAEventer)

type FGALoginHandler

type FGALoginHandler interface {
	HandleLogin(ctx context.Context, logger *commonslogger.Logger, tenantID string, userId string, userEmail string) error
}

type FgaEvents

type FgaEvents interface {
	UserRoleChanged(ctx context.Context, tenantID string, entityID string, entityType string,
		userID string, oldRoles []string, newRoles []string) error
}

type InviteManger

type InviteManger interface {
	GetInvitesForEmail(ctx context.Context, tenantID, email string) ([]db.Invite, error)
	DeleteInvitesForEmail(ctx context.Context, tenantID, email string) error
}

type Service

type Service interface {
	UsersForEntity(ctx context.Context, tenantID string, entityID string, entityType string) (types.UserIDToRoles, error)
	UsersForEntityRolefilter(
		ctx context.Context, tenantID string, entityID string, entityType string, rolefilter []*graphql.RoleInput,
	) (types.UserIDToRoles, error)
	CreateAccount(ctx context.Context, tenantID string, entityType string, entityID string, ownerUserID string) error
	RemoveAccount(ctx context.Context, tenantID string, entityType string, entityID string) error
	AssignRoleBindings(ctx context.Context, tenantID string, entityType string, entityID string, input []*graphql.Change) error
	RemoveFromEntity(ctx context.Context, tenantID string, entityType string, entityID string, userID string) error
	GetPermissionsForRole(ctx context.Context, tenantID string, entityType string, roleTechnicalName string) ([]*graphql.Permission, error)
}

type Tuple

type Tuple interface {
	GetUser() string
	GetObject() string
	GetRelation() string
}

type UserService

type UserService interface {
	GetUserByID(ctx context.Context, tenantID string, userId string) (*graphql.User, error)
}

Directories

Path Synopsis
middleware

Jump to

Keyboard shortcuts

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