org

package
v0.0.0-...-afa1830 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2021 License: AGPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CountOrgAgents

func CountOrgAgents(ctx context.Context, exec boil.ContextExecutor, orgID string) (int64, error)

CountOrgAgents ...

func GetIDsForIdentity

func GetIDsForIdentity(ctx context.Context, boxExec boil.ContextExecutor, redConn *redis.Client, identityID string) ([]string, error)

TODO (structure): the cache should be refactored into a cross-module package (inside sdk eventually)

func IsAgent

func IsAgent(ctx context.Context, exec boil.ContextExecutor, orgID, identityID string) (bool, error)

func MustBeAdmin

func MustBeAdmin(ctx context.Context, exec boil.ContextExecutor, orgID string, identityID string) error

Types

type AgentFilters

type AgentFilters struct {
	Offset         null.Int
	Limit          null.Int
	OrganizationID string
}

type AgentView

type AgentView struct {
	*sqlboiler.OrganizationAgent
	View IdentityView `json:"identity"`
}

func ListAgents

func ListAgents(ctx context.Context, exec boil.ContextExecutor, filters AgentFilters) ([]*AgentView, error)

func ToAgentView

func ToAgentView(ctx context.Context, exec boil.ContextExecutor, agent *sqlboiler.OrganizationAgent, optionalAgentIdentity *identity.Identity) (*AgentView, error)

type IdentityView

type IdentityView struct {
	ID              string                  `json:"id"`
	DisplayName     string                  `json:"display_name"`
	AvatarURL       null.String             `json:"avatar_url"`
	IdentifierValue string                  `json:"identifier_value"`
	IdentifierKind  identity.IdentifierKind `json:"identifier_kind"`
}

type Org

type Org struct {
	ID        string    `json:"id"`
	Name      string    `json:"name"`
	Slug      string    `json:"slug"`
	CreatorID string    `json:"creator_id"`
	CreatedAt time.Time `json:"created_at"`

	// for now, this is ignored
	Domain  null.String `json:"-"` // https://gitlab.misakey.dev/misakey/user-needs/-/issues/392
	LogoURL null.String `json:"-"` // https://gitlab.misakey.dev/misakey/user-needs/-/issues/395
}

func Create

func Create(ctx context.Context, exec boil.ContextExecutor, creatorID, name string) (Org, error)

func GetOrg

func GetOrg(ctx context.Context, exec boil.ContextExecutor, id string) (*Org, error)

func ListByIDsOrRole

func ListByIDsOrRole(ctx context.Context, exec boil.ContextExecutor, orgIDs []string, identityID string) ([]Org, error)

func (*Org) ToIdentity

func (o *Org) ToIdentity() *identity.Identity

Jump to

Keyboard shortcuts

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