service

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2021 License: MIT Imports: 5 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)
	FindAll(ctx context.Context) (model.Organizations, error)
	Update(ctx context.Context, strId, name, description string) error
	Delete(ctx context.Context, strId string) error
}

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)
}

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
}

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
}

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
}

Jump to

Keyboard shortcuts

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