policy

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: 9 Imported by: 0

Documentation

Index

Constants

View Source
const AuditEntity = "policy"

Variables

View Source
var (
	ErrNotExist      = errors.New("policies doesn't exist")
	ErrInvalidUUID   = errors.New("invalid syntax of uuid")
	ErrInvalidID     = errors.New("policy id is invalid")
	ErrConflict      = errors.New("policy already exist")
	ErrInvalidDetail = errors.New("invalid policy detail")
	ErrLogActivity   = errors.New("error while logging activity")
)
View Source
var DefinitionCreateProject = Policy{
	NamespaceID: namespace.DefinitionOrg.ID,
	RoleID:      role.DefinitionOrganizationAdmin.ID,
	ActionID:    action.DefinitionCreateProject.ID,
}
View Source
var DefinitionCreateTeam = Policy{
	NamespaceID: namespace.DefinitionOrg.ID,
	RoleID:      role.DefinitionOrganizationAdmin.ID,
	ActionID:    action.DefinitionCreateTeam.ID,
}
View Source
var DefinitionManageProject = Policy{
	NamespaceID: namespace.DefinitionProject.ID,
	RoleID:      role.DefinitionProjectAdmin.ID,
	ActionID:    action.DefinitionManageProject.ID,
}
View Source
var DefinitionManageProjectOrg = Policy{
	NamespaceID: namespace.DefinitionProject.ID,
	RoleID:      role.DefinitionOrganizationAdmin.ID,
	ActionID:    action.DefinitionManageProject.ID,
}
View Source
var DefinitionManageTeam = Policy{
	NamespaceID: namespace.DefinitionTeam.ID,
	RoleID:      role.DefinitionTeamAdmin.ID,
	ActionID:    action.DefinitionManageTeam.ID,
}
View Source
var DefinitionManageTeamOrgAdmin = Policy{
	NamespaceID: namespace.DefinitionTeam.ID,
	RoleID:      role.DefinitionOrganizationAdmin.ID,
	ActionID:    action.DefinitionManageTeam.ID,
}
View Source
var DefinitionOrganizationManage = Policy{
	NamespaceID: namespace.DefinitionOrg.ID,
	RoleID:      role.DefinitionOrganizationAdmin.ID,
	ActionID:    action.DefinitionManageOrganization.ID,
}
View Source
var DefinitionProjectOrgAdmin = Policy{
	NamespaceID: namespace.DefinitionTeam.ID,
	RoleID:      role.DefinitionProjectAdmin.ID,
	ActionID:    action.DefinitionTeamAll.ID,
}
View Source
var DefinitionTeamOrgAdmin = Policy{
	NamespaceID: namespace.DefinitionTeam.ID,
	RoleID:      role.DefinitionOrganizationAdmin.ID,
	ActionID:    action.DefinitionTeamAll.ID,
}
View Source
var DefinitionViewTeamAdmin = Policy{
	NamespaceID: namespace.DefinitionTeam.ID,
	RoleID:      role.DefinitionTeamAdmin.ID,
	ActionID:    action.DefinitionViewTeam.ID,
}
View Source
var DefinitionViewTeamMember = Policy{
	NamespaceID: namespace.DefinitionTeam.ID,
	RoleID:      role.DefinitionTeamMember.ID,
	ActionID:    action.DefinitionViewTeam.ID,
}

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 AuthzRepository

type AuthzRepository interface {
	Add(ctx context.Context, policies []Policy) error
}

type Filters

type Filters struct {
	NamespaceID string
}

type LogData added in v0.6.25

type LogData struct {
	Entity      string `mapstructure:"entity"`
	ID          string `mapstructure:"id"`
	RoleID      string `mapstructure:"role_id"`
	NamespaceID string `mapstructure:"namespace_id"`
	ActionID    string `mapstructure:"action_id"`
}

type Policy

type Policy struct {
	ID          string
	RoleID      string
	NamespaceID string
	ActionID    string
}

func (Policy) ToLogData added in v0.6.25

func (policy Policy) ToLogData() LogData

type Repository

type Repository interface {
	Get(ctx context.Context, id string) (Policy, error)
	List(ctx context.Context, filter Filters) ([]Policy, error)
	Upsert(ctx context.Context, pol *Policy) (string, error)
	Update(ctx context.Context, pol *Policy) (string, error)
}

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) (Policy, error)

func (Service) List

func (s Service) List(ctx context.Context, filter Filters) ([]Policy, error)

func (Service) Update

func (s Service) Update(ctx context.Context, pol *Policy) ([]Policy, error)

func (Service) Upsert added in v0.6.25

func (s Service) Upsert(ctx context.Context, pol *Policy) ([]Policy, 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