authz

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2023 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const ResourceTypeRole = "role"

Variables

This section is empty.

Functions

This section is empty.

Types

type MySQLRepository

type MySQLRepository struct {
	database.SQLRepository
}

func NewMySQLRepository

func NewMySQLRepository(db *database.MySQL) MySQLRepository

func (MySQLRepository) Create

func (repo MySQLRepository) Create(ctx context.Context, role Role) (int64, error)

func (MySQLRepository) DeleteByRoleId

func (repo MySQLRepository) DeleteByRoleId(ctx context.Context, roleId string) error

func (MySQLRepository) GetById

func (repo MySQLRepository) GetById(ctx context.Context, id int64) (*Role, error)

func (MySQLRepository) GetByRoleId

func (repo MySQLRepository) GetByRoleId(ctx context.Context, roleId string) (*Role, error)

func (MySQLRepository) List

func (repo MySQLRepository) List(ctx context.Context, listParams middleware.ListParams) ([]Role, error)

func (MySQLRepository) UpdateByRoleId

func (repo MySQLRepository) UpdateByRoleId(ctx context.Context, roleId string, role Role) error

type PostgresRepository added in v0.4.0

type PostgresRepository struct {
	database.SQLRepository
}

func NewPostgresRepository added in v0.4.0

func NewPostgresRepository(db *database.Postgres) PostgresRepository

func (PostgresRepository) Create added in v0.4.0

func (repo PostgresRepository) Create(ctx context.Context, role Role) (int64, error)

func (PostgresRepository) DeleteByRoleId added in v0.4.0

func (repo PostgresRepository) DeleteByRoleId(ctx context.Context, roleId string) error

func (PostgresRepository) GetById added in v0.4.0

func (repo PostgresRepository) GetById(ctx context.Context, id int64) (*Role, error)

func (PostgresRepository) GetByRoleId added in v0.4.0

func (repo PostgresRepository) GetByRoleId(ctx context.Context, roleId string) (*Role, error)

func (PostgresRepository) List added in v0.4.0

func (repo PostgresRepository) List(ctx context.Context, listParams middleware.ListParams) ([]Role, error)

func (PostgresRepository) UpdateByRoleId added in v0.4.0

func (repo PostgresRepository) UpdateByRoleId(ctx context.Context, roleId string, role Role) error

type Role

type Role struct {
	ID          int64               `mysql:"id" postgres:"id"`
	ObjectId    int64               `mysql:"objectId" postgres:"object_id"`
	RoleId      string              `mysql:"roleId" postgres:"role_id"`
	Name        database.NullString `mysql:"name" postgres:"name"`
	Description database.NullString `mysql:"description" postgres:"description"`
	CreatedAt   time.Time           `mysql:"createdAt" postgres:"created_at"`
	UpdatedAt   time.Time           `mysql:"updatedAt" postgres:"updated_at"`
	DeletedAt   database.NullTime   `mysql:"deletedAt" postgres:"deleted_at"`
}

func (Role) ToRoleSpec

func (role Role) ToRoleSpec() *RoleSpec

type RoleListParamParser

type RoleListParamParser struct{}

func (RoleListParamParser) GetDefaultSortBy

func (parser RoleListParamParser) GetDefaultSortBy() string

func (RoleListParamParser) GetSupportedSortBys

func (parser RoleListParamParser) GetSupportedSortBys() []string

func (RoleListParamParser) ParseValue

func (parser RoleListParamParser) ParseValue(val string, sortBy string) (interface{}, error)

type RoleRepository

type RoleRepository interface {
	Create(ctx context.Context, role Role) (int64, error)
	GetById(ctx context.Context, id int64) (*Role, error)
	GetByRoleId(ctx context.Context, roleId string) (*Role, error)
	List(ctx context.Context, listParams middleware.ListParams) ([]Role, error)
	UpdateByRoleId(ctx context.Context, roleId string, role Role) error
	DeleteByRoleId(ctx context.Context, roleId string) error
}

func NewRepository

func NewRepository(db database.Database) (RoleRepository, error)

type RoleService

type RoleService struct {
	service.BaseService
}

func NewService

func NewService(env service.Env) RoleService

func (RoleService) Create

func (svc RoleService) Create(ctx context.Context, roleSpec RoleSpec) (*RoleSpec, error)

func (RoleService) DeleteByRoleId

func (svc RoleService) DeleteByRoleId(ctx context.Context, roleId string) error

func (RoleService) GetByRoleId

func (svc RoleService) GetByRoleId(ctx context.Context, roleId string) (*RoleSpec, error)

func (RoleService) GetRoutes

func (svc RoleService) GetRoutes() []service.Route

GetRoutes registers all route handlers for this module

func (RoleService) List

func (svc RoleService) List(ctx context.Context, listParams middleware.ListParams) ([]RoleSpec, error)

func (RoleService) UpdateByRoleId

func (svc RoleService) UpdateByRoleId(ctx context.Context, roleId string, roleSpec UpdateRoleSpec) (*RoleSpec, error)

type RoleSpec

type RoleSpec struct {
	RoleId      string                 `json:"roleId" validate:"required"`
	Name        database.NullString    `json:"name"`
	Description database.NullString    `json:"description"`
	Context     context.ContextSetSpec `json:"context,omitempty"`
	CreatedAt   time.Time              `json:"createdAt"`
}

func (RoleSpec) ToObjectSpec

func (spec RoleSpec) ToObjectSpec() *object.ObjectSpec

func (RoleSpec) ToRole

func (spec RoleSpec) ToRole(objectId int64) *Role

type UpdateRoleSpec

type UpdateRoleSpec struct {
	Name        database.NullString `json:"name"`
	Description database.NullString `json:"description"`
}

Jump to

Keyboard shortcuts

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