client

package module
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2021 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckPermissions added in v0.0.5

func CheckPermissions(ctx context.Context, client RBNS, rbacFunc OrganizationUserFunc, permissions ...string) (context.Context, bool, error)

func StreamServerInterceptor added in v0.0.2

func StreamServerInterceptor(client RBNS, mp MethodPermissions, rbacFunc OrganizationUserFunc) grpc.StreamServerInterceptor

func UnaryServerInterceptor added in v0.0.2

func UnaryServerInterceptor(client RBNS, mp MethodPermissions, rbacFunc OrganizationUserFunc) grpc.UnaryServerInterceptor

Types

type GRPCClient

type GRPCClient interface {
	Target() string
}

type MethodPermissions added in v0.0.2

type MethodPermissions map[string][]string

type OrganizationUserFunc added in v0.0.2

type OrganizationUserFunc func(ctx context.Context) (newCtx context.Context, userKey string, organizationName string, err error)

type Organizations

type Organizations interface {
	// FindById is application id and organization id
	FindById(in *protobuf.OrganizationKey, opts ...grpc.CallOption) (*protobuf.OrganizationEntity, error)
	// FindAll is application is return organizations
	FindAll(in *emptypb.Empty, opts ...grpc.CallOption) (*protobuf.OrganizationEntities, error)
	// Update is organization entity update
	Update(in *protobuf.OrganizationUpdateEntity, opts ...grpc.CallOption) (*emptypb.Empty, error)
	// Delete is organization entity delete
	Delete(in *protobuf.OrganizationKey, opts ...grpc.CallOption) (*emptypb.Empty, error)
	// Create is create orgnization
	Create(in *protobuf.OrganizationEntity, opts ...grpc.CallOption) (*protobuf.OrganizationEntity, error)
}

type Permissions

type Permissions interface {
	// Check is resource check
	Check(in *protobuf.PermissionCheckRequest, opts ...grpc.CallOption) (*protobuf.PermissionCheckResult, error)
	// FindById is find by id
	FindById(in *protobuf.PermissionKey, opts ...grpc.CallOption) (*protobuf.PermissionEntity, error)
	// Update is permission entity update
	Update(in *protobuf.PermissionEntity, opts ...grpc.CallOption) (*emptypb.Empty, error)
	// Delete is permission entity delete
	Delete(in *protobuf.PermissionKey, opts ...grpc.CallOption) (*emptypb.Empty, error)
	// Create is create permission
	Create(in *protobuf.PermissionEntities, opts ...grpc.CallOption) (*protobuf.PermissionEntities, error)
	// FindAll is find by application id return permissions
	FindAll(in *emptypb.Empty, opts ...grpc.CallOption) (*protobuf.PermissionEntities, error)
}

type RBNS

type RBNS interface {
	Permissions(ctx context.Context) Permissions
	Roles(ctx context.Context) Roles
	Organizations(ctx context.Context) Organizations
	Users(ctx context.Context) Users
	io.Closer
	GRPCClient
}

func New

func New(grpcAddress string) (RBNS, error)

func NewWithContext

func NewWithContext(grpcAddress string, baseCtx context.Context) (RBNS, error)

func NewWithContextTLS

func NewWithContextTLS(grpcAddress string, baseCtx context.Context, certFile, commonName string) (RBNS, error)

type Roles

type Roles interface {
	// DeletePermission is delete permission to the role
	DeletePermission(in *protobuf.RoleReleationPermission, opts ...grpc.CallOption) (*emptypb.Empty, error)
	// GetPermissions is get permission to the role
	GetPermissions(in *protobuf.RoleKey, opts ...grpc.CallOption) (*protobuf.PermissionEntities, error)
	// AddPermissions is add permission to the role
	AddPermissions(in *protobuf.RoleReleationPermissions, opts ...grpc.CallOption) (*emptypb.Empty, error)
	// DeletePermissions is delete permission to the role
	DeletePermissions(in *protobuf.RoleReleationPermissions, opts ...grpc.CallOption) (*emptypb.Empty, error)
	// FindById is find by id
	FindById(in *protobuf.RoleKey, opts ...grpc.CallOption) (*protobuf.RoleEntity, error)
	// Update is role entity update
	Update(in *protobuf.RoleUpdateEntity, opts ...grpc.CallOption) (*emptypb.Empty, error)
	// Delete is role entity delete
	Delete(in *protobuf.RoleKey, opts ...grpc.CallOption) (*emptypb.Empty, error)
	// RoleCreate is create role
	Create(in *protobuf.RoleEntities, opts ...grpc.CallOption) (*protobuf.RoleEntities, error)
	// FindAll is find roles
	FindAll(in *emptypb.Empty, opts ...grpc.CallOption) (*protobuf.RoleEntities, error)
}

type ServiceRBACFuncOverride added in v0.0.2

type ServiceRBACFuncOverride interface {
	OrganizationUserFuncOverride(ctx context.Context, fullMethodName string) []string
}

type Users

type Users interface {
	// FindByKey is find organization id and user key
	FindByKey(in *protobuf.UserKey, opts ...grpc.CallOption) (*protobuf.UserEntity, error)
	// FindByOrganizationNameAndUserKey is find organization id and user key
	FindByOrganizationNameAndUserKey(in *protobuf.UserKeyByName, opts ...grpc.CallOption) (*protobuf.UserEntity, error)
	// Delete is delete user
	Delete(in *protobuf.UserKey, opts ...grpc.CallOption) (*emptypb.Empty, error)
	// DeleteRole is delete role to user
	DeleteRole(in *protobuf.UserRoleDelete, opts ...grpc.CallOption) (*emptypb.Empty, error)
	// AddRoles is add role to user
	AddRoles(in *protobuf.UserRole, opts ...grpc.CallOption) (*emptypb.Empty, error)
	// DeleteRoles is delete role to user
	DeleteRoles(in *protobuf.UserRole, opts ...grpc.CallOption) (*emptypb.Empty, error)
	// Create is create user
	Create(in *protobuf.UserEntity, opts ...grpc.CallOption) (*emptypb.Empty, error)
}

Jump to

Keyboard shortcuts

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