Documentation ¶
Index ¶
- type Manager
- func (m *Manager) Add(ctx context.Context, org *hub.Organization) error
- func (m *Manager) AddMember(ctx context.Context, orgName, userAlias string) error
- func (m *Manager) CheckAvailability(ctx context.Context, resourceKind, value string) (bool, error)
- func (m *Manager) ConfirmMembership(ctx context.Context, orgName string) error
- func (m *Manager) Delete(ctx context.Context, orgName string) error
- func (m *Manager) DeleteMember(ctx context.Context, orgName, userAlias string) error
- func (m *Manager) GetAuthorizationPolicyJSON(ctx context.Context, orgName string) ([]byte, error)
- func (m *Manager) GetByUserJSON(ctx context.Context, p *hub.Pagination) (*hub.JSONQueryResult, error)
- func (m *Manager) GetJSON(ctx context.Context, orgName string) ([]byte, error)
- func (m *Manager) GetMembersJSON(ctx context.Context, orgName string, p *hub.Pagination) (*hub.JSONQueryResult, error)
- func (m *Manager) Update(ctx context.Context, orgName string, org *hub.Organization) error
- func (m *Manager) UpdateAuthorizationPolicy(ctx context.Context, orgName string, p *hub.AuthorizationPolicy) error
- type ManagerMock
- func (m *ManagerMock) Add(ctx context.Context, org *hub.Organization) error
- func (m *ManagerMock) AddMember(ctx context.Context, orgName, userAlias string) error
- func (m *ManagerMock) CheckAvailability(ctx context.Context, resourceKind, value string) (bool, error)
- func (m *ManagerMock) ConfirmMembership(ctx context.Context, orgName string) error
- func (m *ManagerMock) Delete(ctx context.Context, orgName string) error
- func (m *ManagerMock) DeleteMember(ctx context.Context, orgName, userAlias string) error
- func (m *ManagerMock) GetAuthorizationPolicyJSON(ctx context.Context, orgName string) ([]byte, error)
- func (m *ManagerMock) GetByUserJSON(ctx context.Context, p *hub.Pagination) (*hub.JSONQueryResult, error)
- func (m *ManagerMock) GetJSON(ctx context.Context, orgName string) ([]byte, error)
- func (m *ManagerMock) GetMembersJSON(ctx context.Context, orgName string, p *hub.Pagination) (*hub.JSONQueryResult, error)
- func (m *ManagerMock) Update(ctx context.Context, orgName string, org *hub.Organization) error
- func (m *ManagerMock) UpdateAuthorizationPolicy(ctx context.Context, orgName string, policy *hub.AuthorizationPolicy) error
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) AddMember ¶
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 ¶
CheckAvailability checks the availability of a given value for the provided resource kind.
func (*Manager) ConfirmMembership ¶
ConfirmMembership confirms the user doing the request membership to the provided organization.
func (*Manager) DeleteMember ¶
DeleteMember removes a member from the provided organization. The user doing the request must be a member of the organization.
func (*Manager) GetAuthorizationPolicyJSON ¶
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) 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) UpdateAuthorizationPolicy ¶
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 ¶
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 ¶
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 ¶
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) 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 ¶
func (m *ManagerMock) UpdateAuthorizationPolicy( ctx context.Context, orgName string, policy *hub.AuthorizationPolicy, ) error
UpdateAuthorizationPolicy implements the OrganizationManager interface.