role

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const AuditEntity = "role"

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")
	ErrLogActivity   = errors.New("error while logging activity")
)
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 ActivityService added in v0.6.15

type ActivityService interface {
	Log(ctx context.Context, action string, actor activity.Actor, data any) error
}

type LogData added in v0.6.25

type LogData struct {
	Entity      string   `mapstructure:"entity"`
	ID          string   `mapstructure:"id"`
	Name        string   `mapstructure:"name"`
	Types       []string `mapstructure:"types"`
	NamespaceID string   `mapstructure:"namespace_id"`
}

type Repository

type Repository interface {
	Get(ctx context.Context, id string) (Role, error)
	List(ctx context.Context) ([]Role, error)
	Upsert(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

func (Role) ToLogData added in v0.6.25

func (role Role) ToLogData() LogData

type Service

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

func NewService

func NewService(logger log.Logger, repository Repository, userService UserService, activityService ActivityService) *Service

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)

func (Service) Upsert added in v0.6.25

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

type UserService added in v0.6.15

type UserService interface {
	FetchCurrentUser(ctx context.Context) (user.User, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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