app

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2024 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrRoleBindingNotFound error = fmt.Errorf("role binding not found")
View Source
var Module = fx.Module(
	"app",
	fx.Provide(func(ev *env.Env) (RoleBindingMap, error) {
		if ev.ActionRoleMapFile != "" {
			b, err := os.ReadFile(ev.ActionRoleMapFile)
			if err != nil {
				return nil, errors.NewE(err)
			}
			var rbm RoleBindingMap
			if err := json.Unmarshal(b, &rbm); err != nil {
				return nil, errors.NewE(err)
			}
			return rbm, nil
		}

		return roleBindings, nil
	}),

	repos.NewFxMongoRepo[*entities.RoleBinding]("role_bindings", "rb", entities.RoleBindingIndices),

	fx.Provide(func(logger logging.Logger, rbRepo repos.DbRepo[*entities.RoleBinding], rbm RoleBindingMap) iam.IAMServer {
		return newIAMGrpcService(logger, rbRepo, rbm)
	}),

	fx.Invoke(
		func(server IAMGrpcServer, iamService iam.IAMServer) {
			iam.RegisterIAMServer(server, iamService)
		},
	),
)

Functions

This section is empty.

Types

type GrpcService

type GrpcService struct {
	iam.UnimplementedIAMServer
	// contains filtered or unexported fields
}

func (*GrpcService) AddMembership

func (s *GrpcService) AddMembership(ctx context.Context, in *iam.AddMembershipIn) (*iam.AddMembershipOut, error)

func (*GrpcService) Can

func (s *GrpcService) Can(ctx context.Context, in *iam.CanIn) (*iam.CanOut, error)

func (*GrpcService) GetMembership

func (s *GrpcService) GetMembership(ctx context.Context, in *iam.GetMembershipIn) (*iam.GetMembershipOut, error)

func (*GrpcService) ListMembershipsForResource

func (s *GrpcService) ListMembershipsForResource(ctx context.Context, in *iam.MembershipsForResourceIn) (*iam.ListMembershipsOut, error)

func (*GrpcService) ListMembershipsForUser

func (s *GrpcService) ListMembershipsForUser(ctx context.Context, in *iam.MembershipsForUserIn) (*iam.ListMembershipsOut, error)

func (*GrpcService) Ping

func (s *GrpcService) Ping(ctx context.Context, in *iam.Message) (*iam.Message, error)

func (*GrpcService) RemoveMembership

func (s *GrpcService) RemoveMembership(ctx context.Context, in *iam.RemoveMembershipIn) (*iam.RemoveMembershipOut, error)

func (*GrpcService) RemoveResource

func (s *GrpcService) RemoveResource(ctx context.Context, in *iam.RemoveResourceIn) (*iam.RemoveResourceOut, error)

func (*GrpcService) UpdateMembership

func (s *GrpcService) UpdateMembership(ctx context.Context, in *iam.UpdateMembershipIn) (*iam.UpdateMembershipOut, error)

UpdateMembership updates only the role for a user on already specified resource_ref

type IAMGrpcServer

type IAMGrpcServer grpc.Server

type RoleBindingMap

type RoleBindingMap map[t.Action][]t.Role

Jump to

Keyboard shortcuts

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