service

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ApiKey

type ApiKey interface {
	Generate() (string, error)
	Get() string
}

func NewApiKey

func NewApiKey(repo repository.ApiKey) ApiKey

type OrganizationService

type OrganizationService interface {
	Create(ctx context.Context, name, description string) (*model.Organization, error)
	FindById(ctx context.Context, strId string) (*model.Organization, error)
	FindByName(ctx context.Context, name string) (*model.Organization, error)
	FindAll(ctx context.Context) (model.Organizations, error)
	Update(ctx context.Context, strId, name, description string) error
	Delete(ctx context.Context, strId string) error
}

func NewOrganizationService added in v0.0.4

func NewOrganizationService(reader repository.Reader, writer repository.Writer) OrganizationService

type PermissionService

type PermissionService interface {
	Create(ctx context.Context, names, descriptions []string) (model.Permissions, error)
	FindById(ctx context.Context, strId string) (*model.Permission, error)
	FindAll(ctx context.Context) (model.Permissions, error)
	Update(ctx context.Context, strId, name, description string) error
	Delete(ctx context.Context, strId string) error
	Check(ctx context.Context, userKey, organizationName string, permissionNames ...string) (*model.ResourceCheck, error)
}

func NewPermissionService added in v0.0.4

func NewPermissionService(reader repository.Reader, writer repository.Writer) PermissionService

type Resource

type Resource interface {
	Save(ctx context.Context, method, uri string, permissions ...string) error
	Authorized(ctx context.Context, method, uri, organizationName, userKey string) bool
}

func NewResource added in v0.0.4

func NewResource(reader repository.Reader, writer repository.Writer) Resource

type RoleService

type RoleService interface {
	Create(ctx context.Context, names, descriptions []string) (model.Roles, error)
	FindById(ctx context.Context, strId string) (*model.Role, error)
	FindAll(ctx context.Context) (model.Roles, error)
	Update(ctx context.Context, strId string, name, description string) error
	Delete(ctx context.Context, strId string) error
	GetPermissions(ctx context.Context, strId string) (model.Permissions, error)
	AddPermissions(ctx context.Context, strId string, permissionIds []string) error
	DeletePermissions(ctx context.Context, strId string, permissionIds []string) error
}

func NewRoleService added in v0.0.4

func NewRoleService(reader repository.Reader, writer repository.Writer) RoleService

type UserService

type UserService interface {
	Create(ctx context.Context, userKey, organizationId string, roleIds ...string) error
	Delete(ctx context.Context, userKey, organizationId string) error
	FindByKey(ctx context.Context, userKey, organizationId string) (*model.User, error)
	AddRole(ctx context.Context, userKey, organizationId string, roleIds []string) error
	DeleteRole(ctx context.Context, userKey, organizationId string, roleIds []string) error
}

func NewUserService added in v0.0.4

func NewUserService(reader repository.Reader, writer repository.Writer) UserService

Jump to

Keyboard shortcuts

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