user

package
v0.0.27 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2023 License: Apache-2.0 Imports: 7 Imported by: 15

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HasUploaderRole added in v0.0.23

func HasUploaderRole(user *userpb.User) bool

HasUploaderRole returns true if the user has uploader role.

Types

type BlockedUsers added in v0.0.21

type BlockedUsers map[string]struct{}

BlockedUsers is a set containing all the blocked users.

func NewBlockedUsersSet added in v0.0.21

func NewBlockedUsersSet(users []string) BlockedUsers

NewBlockedUsersSet creates a new set of blocked users from a list.

func (BlockedUsers) IsBlocked added in v0.0.21

func (b BlockedUsers) IsBlocked(user string) bool

IsBlocked returns true if the user is blocked.

type ConfigureArg added in v0.0.2

type ConfigureArg struct {
	Ml map[string]interface{}
}

ConfigureArg for RPC.

type ConfigureReply added in v0.0.2

type ConfigureReply struct {
	Err error
}

ConfigureReply for RPC.

type FindUsersArg added in v0.0.2

type FindUsersArg struct {
	Ctx                map[interface{}]interface{}
	Query              string
	SkipFetchingGroups bool
}

FindUsersArg for RPC.

type FindUsersReply added in v0.0.2

type FindUsersReply struct {
	User []*userpb.User
	Err  error
}

FindUsersReply for RPC.

type GetUserArg added in v0.0.2

type GetUserArg struct {
	Ctx                map[interface{}]interface{}
	UID                *userpb.UserId
	SkipFetchingGroups bool
}

GetUserArg for RPC.

type GetUserByClaimArg added in v0.0.2

type GetUserByClaimArg struct {
	Ctx                map[interface{}]interface{}
	Claim              string
	Value              string
	SkipFetchingGroups bool
}

GetUserByClaimArg for RPC.

type GetUserByClaimReply added in v0.0.2

type GetUserByClaimReply struct {
	User *userpb.User
	Err  error
}

GetUserByClaimReply for RPC.

type GetUserGroupsArg added in v0.0.2

type GetUserGroupsArg struct {
	Ctx  map[interface{}]interface{}
	User *userpb.UserId
}

GetUserGroupsArg for RPC.

type GetUserGroupsReply added in v0.0.2

type GetUserGroupsReply struct {
	Group []string
	Err   error
}

GetUserGroupsReply for RPC.

type GetUserReply added in v0.0.2

type GetUserReply struct {
	User *userpb.User
	Err  error
}

GetUserReply for RPC.

type Manager

type Manager interface {
	plugin.Plugin
	// GetUser returns the user metadata identified by a uid.
	// The groups of the user are omitted if specified, as these might not be required for certain operations
	// and might involve computational overhead.
	GetUser(ctx context.Context, uid *userpb.UserId, skipFetchingGroups bool) (*userpb.User, error)
	// GetUserByClaim returns the user identified by a specific value for a given claim.
	GetUserByClaim(ctx context.Context, claim, value string, skipFetchingGroups bool) (*userpb.User, error)
	// GetUserGroups returns the groups a user identified by a uid belongs to.
	GetUserGroups(ctx context.Context, uid *userpb.UserId) ([]string, error)
	// FindUsers returns all the user objects which match a query parameter.
	FindUsers(ctx context.Context, query string, skipFetchingGroups bool) ([]*userpb.User, error)
}

Manager is the interface to implement to manipulate users.

type ProviderPlugin added in v0.0.2

type ProviderPlugin struct {
	Impl Manager
}

ProviderPlugin is the implementation of plugin.Plugin so we can serve/consume this.

func (*ProviderPlugin) Client added in v0.0.2

func (p *ProviderPlugin) Client(b *hcplugin.MuxBroker, c *rpc.Client) (interface{}, error)

Client returns interface implementation for the plugin that communicates to the server end of the plugin.

func (*ProviderPlugin) Server added in v0.0.2

func (p *ProviderPlugin) Server(*hcplugin.MuxBroker) (interface{}, error)

Server returns the RPC Server which serves the methods that the Client calls over net/rpc.

type RPCClient added in v0.0.2

type RPCClient struct{ Client *rpc.Client }

RPCClient is an implementation of Manager that talks over RPC.

func (*RPCClient) Configure added in v0.0.2

func (m *RPCClient) Configure(ml map[string]interface{}) error

Configure RPCClient configure method.

func (*RPCClient) FindUsers added in v0.0.2

func (m *RPCClient) FindUsers(ctx context.Context, query string, skipFetchingGroups bool) ([]*userpb.User, error)

FindUsers RPCClient FindUsers method.

func (*RPCClient) GetUser added in v0.0.2

func (m *RPCClient) GetUser(ctx context.Context, uid *userpb.UserId, skipFetchingGroups bool) (*userpb.User, error)

GetUser RPCClient GetUser method.

func (*RPCClient) GetUserByClaim added in v0.0.2

func (m *RPCClient) GetUserByClaim(ctx context.Context, claim, value string, skipFetchingGroups bool) (*userpb.User, error)

GetUserByClaim RPCClient GetUserByClaim method.

func (*RPCClient) GetUserGroups added in v0.0.2

func (m *RPCClient) GetUserGroups(ctx context.Context, user *userpb.UserId) ([]string, error)

GetUserGroups RPCClient GetUserGroups method.

type RPCServer added in v0.0.2

type RPCServer struct {
	// This is the real implementation
	Impl Manager
}

RPCServer is the server that RPCClient talks to, conforming to the requirements of net/rpc.

func (*RPCServer) Configure added in v0.0.2

func (m *RPCServer) Configure(args ConfigureArg, resp *ConfigureReply) error

Configure RPCServer Configure method.

func (*RPCServer) FindUsers added in v0.0.2

func (m *RPCServer) FindUsers(args FindUsersArg, resp *FindUsersReply) error

FindUsers RPCServer FindUsers method.

func (*RPCServer) GetUser added in v0.0.2

func (m *RPCServer) GetUser(args GetUserArg, resp *GetUserReply) error

GetUser RPCServer GetUser method.

func (*RPCServer) GetUserByClaim added in v0.0.2

func (m *RPCServer) GetUserByClaim(args GetUserByClaimArg, resp *GetUserByClaimReply) error

GetUserByClaim RPCServer GetUserByClaim method.

func (*RPCServer) GetUserGroups added in v0.0.2

func (m *RPCServer) GetUserGroups(args GetUserGroupsArg, resp *GetUserGroupsReply) error

GetUserGroups RPCServer GetUserGroups method.

Directories

Path Synopsis
manager

Jump to

Keyboard shortcuts

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