org

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2021 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

Manager provides an API to manage organizations.

func NewManager

func NewManager(cfg *viper.Viper, db hub.DB, es hub.EmailSender, az hub.Authorizer) *Manager

NewManager creates a new Manager instance.

func (*Manager) Add

func (m *Manager) Add(ctx context.Context, org *hub.Organization) error

Add adds the provided organization to the database.

func (*Manager) AddMember

func (m *Manager) AddMember(ctx context.Context, orgName, userAlias string) error

AddMember adds a new member to the provided organization. The new member must be a registered user. The user will receive an email to confirm her willingness to join the organization. The user doing the request must be a member of the organization.

func (*Manager) CheckAvailability

func (m *Manager) CheckAvailability(ctx context.Context, resourceKind, value string) (bool, error)

CheckAvailability checks the availability of a given value for the provided resource kind.

func (*Manager) ConfirmMembership

func (m *Manager) ConfirmMembership(ctx context.Context, orgName string) error

ConfirmMembership confirms the user doing the request membership to the provided organization.

func (*Manager) Delete added in v0.14.0

func (m *Manager) Delete(ctx context.Context, orgName string) error

Delete deletes the provided organization from the database.

func (*Manager) DeleteMember

func (m *Manager) DeleteMember(ctx context.Context, orgName, userAlias string) error

DeleteMember removes a member from the provided organization. The user doing the request must be a member of the organization.

func (*Manager) GetAuthorizationPolicyJSON added in v0.6.0

func (m *Manager) GetAuthorizationPolicyJSON(ctx context.Context, orgName string) ([]byte, error)

GetAuthorizationPolicyJSON returns the organization's authorization policy as a json object.

func (*Manager) GetByUserJSON

func (m *Manager) GetByUserJSON(ctx context.Context, p *hub.Pagination) (*hub.JSONQueryResult, error)

GetByUserJSON returns the organizations the user doing the request belongs to as a json object.

func (*Manager) GetJSON

func (m *Manager) GetJSON(ctx context.Context, orgName string) ([]byte, error)

GetJSON returns the organization requested as a json object.

func (*Manager) GetMembersJSON

func (m *Manager) GetMembersJSON(
	ctx context.Context,
	orgName string,
	p *hub.Pagination,
) (*hub.JSONQueryResult, error)

GetMembersJSON returns the members of the provided organization as a json object.

func (*Manager) Update

func (m *Manager) Update(ctx context.Context, orgName string, org *hub.Organization) error

Update updates the provided organization in the database.

func (*Manager) UpdateAuthorizationPolicy added in v0.6.0

func (m *Manager) UpdateAuthorizationPolicy(
	ctx context.Context,
	orgName string,
	p *hub.AuthorizationPolicy,
) error

UpdateAuthorizationPolicy updates the organization's authorization policy in the database.

type ManagerMock

type ManagerMock struct {
	mock.Mock
}

ManagerMock is a mock implementation of the OrganizationManager interface.

func (*ManagerMock) Add

func (m *ManagerMock) Add(ctx context.Context, org *hub.Organization) error

Add implements the OrganizationManager interface.

func (*ManagerMock) AddMember

func (m *ManagerMock) AddMember(ctx context.Context, orgName, userAlias string) error

AddMember implements the OrganizationManager interface.

func (*ManagerMock) CheckAvailability

func (m *ManagerMock) CheckAvailability(ctx context.Context, resourceKind, value string) (bool, error)

CheckAvailability implements the OrganizationManager interface.

func (*ManagerMock) ConfirmMembership

func (m *ManagerMock) ConfirmMembership(ctx context.Context, orgName string) error

ConfirmMembership implements the OrganizationManager interface.

func (*ManagerMock) Delete added in v0.14.0

func (m *ManagerMock) Delete(ctx context.Context, orgName string) error

Delete implements the OrganizationManager interface.

func (*ManagerMock) DeleteMember

func (m *ManagerMock) DeleteMember(ctx context.Context, orgName, userAlias string) error

DeleteMember implements the OrganizationManager interface.

func (*ManagerMock) GetAuthorizationPolicyJSON added in v0.6.0

func (m *ManagerMock) GetAuthorizationPolicyJSON(ctx context.Context, orgName string) ([]byte, error)

GetAuthorizationPolicyJSON implements the OrganizationManager interface.

func (*ManagerMock) GetByUserJSON

func (m *ManagerMock) GetByUserJSON(ctx context.Context, p *hub.Pagination) (*hub.JSONQueryResult, error)

GetByUserJSON implements the OrganizationManager interface.

func (*ManagerMock) GetJSON

func (m *ManagerMock) GetJSON(ctx context.Context, orgName string) ([]byte, error)

GetJSON implements the OrganizationManager interface.

func (*ManagerMock) GetMembersJSON

func (m *ManagerMock) GetMembersJSON(
	ctx context.Context,
	orgName string,
	p *hub.Pagination,
) (*hub.JSONQueryResult, error)

GetMembersJSON implements the OrganizationManager interface.

func (*ManagerMock) Update

func (m *ManagerMock) Update(ctx context.Context, orgName string, org *hub.Organization) error

Update implements the OrganizationManager interface.

func (*ManagerMock) UpdateAuthorizationPolicy added in v0.6.0

func (m *ManagerMock) UpdateAuthorizationPolicy(
	ctx context.Context,
	orgName string,
	policy *hub.AuthorizationPolicy,
) error

UpdateAuthorizationPolicy implements the OrganizationManager interface.

Jump to

Keyboard shortcuts

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