Documentation
¶
Index ¶
- Constants
- Variables
- type AssetOwner
- type Owner
- type PostgresRepository
- func (r *PostgresRepository) AddAssetOwner(ctx context.Context, assetID, ownerType, ownerID string) error
- func (r *PostgresRepository) AddMember(ctx context.Context, member *TeamMember) error
- func (r *PostgresRepository) ConvertMemberToManual(ctx context.Context, teamID, userID string) error
- func (r *PostgresRepository) CreateSSOMapping(ctx context.Context, mapping *SSOTeamMapping) error
- func (r *PostgresRepository) CreateTeam(ctx context.Context, team *Team) error
- func (r *PostgresRepository) DeleteSSOMapping(ctx context.Context, id string) error
- func (r *PostgresRepository) DeleteTeam(ctx context.Context, id string) error
- func (r *PostgresRepository) FindSimilarTeamNames(ctx context.Context, searchTerm string, limit int) ([]string, error)
- func (r *PostgresRepository) GetMappingsForGroups(ctx context.Context, provider string, groups []string) ([]*SSOTeamMapping, error)
- func (r *PostgresRepository) GetMember(ctx context.Context, teamID, userID string) (*TeamMember, error)
- func (r *PostgresRepository) GetSSOMapping(ctx context.Context, id string) (*SSOTeamMapping, error)
- func (r *PostgresRepository) GetTeam(ctx context.Context, id string) (*Team, error)
- func (r *PostgresRepository) GetTeamByName(ctx context.Context, name string) (*Team, error)
- func (r *PostgresRepository) IsUserInTeam(ctx context.Context, userID, teamID string) (bool, error)
- func (r *PostgresRepository) ListAssetOwners(ctx context.Context, assetID string) ([]*Owner, error)
- func (r *PostgresRepository) ListAssetsByOwner(ctx context.Context, ownerType, ownerID string) ([]string, error)
- func (r *PostgresRepository) ListMembers(ctx context.Context, teamID string) ([]*TeamMemberWithUser, error)
- func (r *PostgresRepository) ListSSOMappings(ctx context.Context, provider string) ([]*SSOTeamMapping, error)
- func (r *PostgresRepository) ListTeams(ctx context.Context, limit, offset int) ([]*Team, int, error)
- func (r *PostgresRepository) ListUserTeams(ctx context.Context, userID string) ([]*Team, error)
- func (r *PostgresRepository) RemoveAssetOwner(ctx context.Context, assetID, ownerType, ownerID string) error
- func (r *PostgresRepository) RemoveMember(ctx context.Context, teamID, userID string) error
- func (r *PostgresRepository) SearchOwners(ctx context.Context, query string, limit int) ([]*Owner, error)
- func (r *PostgresRepository) TeamExists(ctx context.Context, id string) (bool, error)
- func (r *PostgresRepository) UpdateMemberRole(ctx context.Context, teamID, userID, role string) error
- func (r *PostgresRepository) UpdateSSOMapping(ctx context.Context, id, teamID, memberRole string) error
- func (r *PostgresRepository) UpdateTeam(ctx context.Context, id, name, description string) error
- func (r *PostgresRepository) UpdateTeamFields(ctx context.Context, id string, name, description *string, ...) error
- type Repository
- type SSOTeamMapping
- type Service
- func (s *Service) AddAssetOwner(ctx context.Context, assetID, ownerType, ownerID string) error
- func (s *Service) AddMember(ctx context.Context, teamID, userID, role string) error
- func (s *Service) CanUserAccessAsset(ctx context.Context, userID, assetID string) (bool, error)
- func (s *Service) ConvertMemberToManual(ctx context.Context, teamID, userID string) error
- func (s *Service) CreateSSOMapping(ctx context.Context, provider, ssoGroupName, teamID, memberRole string) (*SSOTeamMapping, error)
- func (s *Service) CreateTeam(ctx context.Context, name, description, createdBy string) (*Team, error)
- func (s *Service) CreateTeamViaSSO(ctx context.Context, provider, groupName string) (*Team, error)
- func (s *Service) DeleteSSOMapping(ctx context.Context, id string) error
- func (s *Service) DeleteTeam(ctx context.Context, id string) error
- func (s *Service) FindSimilarTeamNames(ctx context.Context, searchTerm string, limit int) ([]string, error)
- func (s *Service) GetSSOMapping(ctx context.Context, id string) (*SSOTeamMapping, error)
- func (s *Service) GetTeam(ctx context.Context, id string) (*Team, error)
- func (s *Service) GetTeamByName(ctx context.Context, name string) (*Team, error)
- func (s *Service) ListAssetOwners(ctx context.Context, assetID string) ([]*Owner, error)
- func (s *Service) ListAssetsByOwner(ctx context.Context, ownerType, ownerID string) ([]string, error)
- func (s *Service) ListMembers(ctx context.Context, teamID string) ([]*TeamMemberWithUser, error)
- func (s *Service) ListSSOMappings(ctx context.Context, provider string) ([]*SSOTeamMapping, error)
- func (s *Service) ListTeams(ctx context.Context, limit, offset int) ([]*Team, int, error)
- func (s *Service) ListUserTeams(ctx context.Context, userID string) ([]*Team, error)
- func (s *Service) RemoveAssetOwner(ctx context.Context, assetID, ownerType, ownerID string) error
- func (s *Service) RemoveMember(ctx context.Context, teamID, userID string) error
- func (s *Service) SearchOwners(ctx context.Context, query string, limit int) ([]*Owner, error)
- func (s *Service) SyncUserTeamsFromSSO(ctx context.Context, userID, provider string, ssoGroups []string, ...) error
- func (s *Service) UpdateMemberRole(ctx context.Context, teamID, userID, role string) error
- func (s *Service) UpdateSSOMapping(ctx context.Context, id, teamID, memberRole string) error
- func (s *Service) UpdateTeam(ctx context.Context, id, name, description string) error
- func (s *Service) UpdateTeamFields(ctx context.Context, id string, name, description *string, ...) error
- type Team
- type TeamMember
- type TeamMemberWithUser
Constants ¶
View Source
const ( RoleOwner = "owner" RoleMember = "member" SourceManual = "manual" SourceSSO = "sso" OwnerTypeUser = "user" OwnerTypeTeam = "team" )
Variables ¶
View Source
var ( ErrTeamNotFound = errors.New("team not found") ErrTeamNameExists = errors.New("team name already exists") ErrMemberNotFound = errors.New("member not found") ErrMemberAlreadyExists = errors.New("member already exists") ErrMappingNotFound = errors.New("sso mapping not found") ErrMappingAlreadyExists = errors.New("sso mapping already exists") ErrCannotEditSSOTeam = errors.New("cannot edit SSO-managed team") )
Functions ¶
This section is empty.
Types ¶
type AssetOwner ¶
type PostgresRepository ¶
type PostgresRepository struct {
// contains filtered or unexported fields
}
func (*PostgresRepository) AddAssetOwner ¶
func (r *PostgresRepository) AddAssetOwner(ctx context.Context, assetID, ownerType, ownerID string) error
func (*PostgresRepository) AddMember ¶
func (r *PostgresRepository) AddMember(ctx context.Context, member *TeamMember) error
func (*PostgresRepository) ConvertMemberToManual ¶
func (r *PostgresRepository) ConvertMemberToManual(ctx context.Context, teamID, userID string) error
func (*PostgresRepository) CreateSSOMapping ¶
func (r *PostgresRepository) CreateSSOMapping(ctx context.Context, mapping *SSOTeamMapping) error
func (*PostgresRepository) CreateTeam ¶
func (r *PostgresRepository) CreateTeam(ctx context.Context, team *Team) error
func (*PostgresRepository) DeleteSSOMapping ¶
func (r *PostgresRepository) DeleteSSOMapping(ctx context.Context, id string) error
func (*PostgresRepository) DeleteTeam ¶
func (r *PostgresRepository) DeleteTeam(ctx context.Context, id string) error
func (*PostgresRepository) FindSimilarTeamNames ¶ added in v0.5.0
func (r *PostgresRepository) FindSimilarTeamNames(ctx context.Context, searchTerm string, limit int) ([]string, error)
FindSimilarTeamNames finds team names similar to the given search term
func (*PostgresRepository) GetMappingsForGroups ¶
func (r *PostgresRepository) GetMappingsForGroups(ctx context.Context, provider string, groups []string) ([]*SSOTeamMapping, error)
func (*PostgresRepository) GetMember ¶
func (r *PostgresRepository) GetMember(ctx context.Context, teamID, userID string) (*TeamMember, error)
func (*PostgresRepository) GetSSOMapping ¶
func (r *PostgresRepository) GetSSOMapping(ctx context.Context, id string) (*SSOTeamMapping, error)
func (*PostgresRepository) GetTeamByName ¶
func (*PostgresRepository) IsUserInTeam ¶
func (*PostgresRepository) ListAssetOwners ¶
func (*PostgresRepository) ListAssetsByOwner ¶
func (*PostgresRepository) ListMembers ¶
func (r *PostgresRepository) ListMembers(ctx context.Context, teamID string) ([]*TeamMemberWithUser, error)
func (*PostgresRepository) ListSSOMappings ¶
func (r *PostgresRepository) ListSSOMappings(ctx context.Context, provider string) ([]*SSOTeamMapping, error)
func (*PostgresRepository) ListUserTeams ¶
func (*PostgresRepository) RemoveAssetOwner ¶
func (r *PostgresRepository) RemoveAssetOwner(ctx context.Context, assetID, ownerType, ownerID string) error
func (*PostgresRepository) RemoveMember ¶
func (r *PostgresRepository) RemoveMember(ctx context.Context, teamID, userID string) error
func (*PostgresRepository) SearchOwners ¶
func (*PostgresRepository) TeamExists ¶
func (*PostgresRepository) UpdateMemberRole ¶
func (r *PostgresRepository) UpdateMemberRole(ctx context.Context, teamID, userID, role string) error
func (*PostgresRepository) UpdateSSOMapping ¶
func (r *PostgresRepository) UpdateSSOMapping(ctx context.Context, id, teamID, memberRole string) error
func (*PostgresRepository) UpdateTeam ¶
func (r *PostgresRepository) UpdateTeam(ctx context.Context, id, name, description string) error
func (*PostgresRepository) UpdateTeamFields ¶ added in v0.5.0
type Repository ¶
type Repository interface {
CreateTeam(ctx context.Context, team *Team) error
GetTeam(ctx context.Context, id string) (*Team, error)
GetTeamByName(ctx context.Context, name string) (*Team, error)
FindSimilarTeamNames(ctx context.Context, searchTerm string, limit int) ([]string, error)
UpdateTeam(ctx context.Context, id string, name, description string) error
UpdateTeamFields(ctx context.Context, id string, name, description *string, metadata map[string]interface{}, tags []string) error
DeleteTeam(ctx context.Context, id string) error
ListTeams(ctx context.Context, limit, offset int) ([]*Team, int, error)
TeamExists(ctx context.Context, id string) (bool, error)
AddMember(ctx context.Context, member *TeamMember) error
RemoveMember(ctx context.Context, teamID, userID string) error
UpdateMemberRole(ctx context.Context, teamID, userID, role string) error
GetMember(ctx context.Context, teamID, userID string) (*TeamMember, error)
ListMembers(ctx context.Context, teamID string) ([]*TeamMemberWithUser, error)
ListUserTeams(ctx context.Context, userID string) ([]*Team, error)
IsUserInTeam(ctx context.Context, userID, teamID string) (bool, error)
ConvertMemberToManual(ctx context.Context, teamID, userID string) error
CreateSSOMapping(ctx context.Context, mapping *SSOTeamMapping) error
GetSSOMapping(ctx context.Context, id string) (*SSOTeamMapping, error)
UpdateSSOMapping(ctx context.Context, id, teamID, memberRole string) error
DeleteSSOMapping(ctx context.Context, id string) error
ListSSOMappings(ctx context.Context, provider string) ([]*SSOTeamMapping, error)
GetMappingsForGroups(ctx context.Context, provider string, groups []string) ([]*SSOTeamMapping, error)
AddAssetOwner(ctx context.Context, assetID, ownerType, ownerID string) error
RemoveAssetOwner(ctx context.Context, assetID, ownerType, ownerID string) error
ListAssetOwners(ctx context.Context, assetID string) ([]*Owner, error)
ListAssetsByOwner(ctx context.Context, ownerType, ownerID string) ([]string, error)
SearchOwners(ctx context.Context, query string, limit int) ([]*Owner, error)
}
func NewPostgresRepository ¶
func NewPostgresRepository(db *pgxpool.Pool) Repository
type SSOTeamMapping ¶
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func NewService(repo Repository) *Service
func (*Service) AddAssetOwner ¶
func (*Service) CanUserAccessAsset ¶
func (*Service) ConvertMemberToManual ¶
func (*Service) CreateSSOMapping ¶
func (*Service) CreateTeam ¶
func (*Service) CreateTeamViaSSO ¶
func (*Service) DeleteSSOMapping ¶
func (*Service) FindSimilarTeamNames ¶ added in v0.5.0
func (*Service) GetSSOMapping ¶
func (*Service) GetTeamByName ¶ added in v0.5.0
func (*Service) ListAssetOwners ¶
func (*Service) ListAssetsByOwner ¶
func (*Service) ListMembers ¶
func (*Service) ListSSOMappings ¶
func (*Service) ListUserTeams ¶
func (*Service) RemoveAssetOwner ¶
func (*Service) RemoveMember ¶
func (*Service) SearchOwners ¶
func (*Service) SyncUserTeamsFromSSO ¶
func (*Service) UpdateMemberRole ¶
func (*Service) UpdateSSOMapping ¶
func (*Service) UpdateTeam ¶
type Team ¶
type Team struct {
ID string `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
Metadata map[string]interface{} `json:"metadata,omitempty"`
Tags []string `json:"tags,omitempty"`
CreatedViaSSO bool `json:"created_via_sso"`
SSOProvider *string `json:"sso_provider,omitempty"`
CreatedBy *string `json:"created_by,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
type TeamMember ¶
type TeamMemberWithUser ¶
type TeamMemberWithUser struct {
TeamMember
Username string `json:"username"`
Name string `json:"name"`
Email *string `json:"email,omitempty"`
ProfilePicture *string `json:"profile_picture,omitempty"`
}
Click to show internal directories.
Click to hide internal directories.