role

package
v0.6.14 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	UserType       = namespace.DefinitionUser.ID
	TeamMemberType = fmt.Sprintf("%s#%s", namespace.DefinitionTeam.ID, DefinitionTeamMember.ID)
)
View Source
var (
	ErrNotExist      = errors.New("role doesn't exist")
	ErrInvalidID     = errors.New("role id is invalid")
	ErrConflict      = errors.New("role name already exist")
	ErrInvalidDetail = errors.New("invalid role detail")
)
View Source
var DefinitionOrganizationAdmin = Role{
	Name:        "Organization Admin",
	ID:          "organization_admin",
	NamespaceID: namespace.DefinitionOrg.ID,
	Types:       []string{UserType, TeamMemberType},
}
View Source
var DefinitionProjectAdmin = Role{
	Name:        "Project Admin",
	ID:          "project_admin",
	NamespaceID: namespace.DefinitionProject.ID,
	Types:       []string{UserType, TeamMemberType},
}
View Source
var DefinitionTeamAdmin = Role{
	Name:        "Team Admin",
	ID:          "team_admin",
	NamespaceID: namespace.DefinitionTeam.ID,
	Types:       []string{UserType},
}
View Source
var DefinitionTeamMember = Role{
	Name:        "Team Member",
	ID:          "team_member",
	NamespaceID: namespace.DefinitionTeam.ID,
	Types:       []string{UserType},
}

Functions

This section is empty.

Types

type Repository

type Repository interface {
	Get(ctx context.Context, id string) (Role, error)
	List(ctx context.Context) ([]Role, error)
	Create(ctx context.Context, role Role) (string, error)
	Update(ctx context.Context, toUpdate Role) (string, error)
}

type Role

type Role struct {
	ID          string
	Name        string
	Types       []string
	NamespaceID string
	Metadata    metadata.Metadata
	CreatedAt   time.Time
	UpdatedAt   time.Time
}

func GetOwnerRole

func GetOwnerRole(ns namespace.Namespace) Role

type Service

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

func NewService

func NewService(repository Repository) *Service

func (Service) Create

func (s Service) Create(ctx context.Context, toCreate Role) (Role, error)

func (Service) Get

func (s Service) Get(ctx context.Context, id string) (Role, error)

func (Service) List

func (s Service) List(ctx context.Context) ([]Role, error)

func (Service) Update

func (s Service) Update(ctx context.Context, toUpdate Role) (Role, error)

Jump to

Keyboard shortcuts

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