service

package
v0.0.0-...-2f4d8a3 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrAppUserAlreadyExists = errors.New("AppUser already exists")
View Source
var ErrAppUserNotFound = errors.New("AppUser not found")
View Source
var ErrOrganizationAlreadyExists = errors.New("organization already exists")
View Source
var ErrOrganizationNotFound = errors.New("organization not found")
View Source
var ErrSpaceAlreadyExists = errors.New("space already exists")
View Source
var ErrSpaceNotFound = errors.New("space not found")
View Source
var ErrSystemOwnerNotFound = errors.New("SystemOwner not found")

Functions

This section is empty.

Types

type AppUser

type AppUser interface {
	domain.AppUserModel

	GetDefaultSpace(ctx context.Context) (Space, error)
	GetPersonalSpace(ctx context.Context) (Space, error)
}

func NewAppUser

func NewAppUser(ctx context.Context, rf RepositoryFactory, appUserModel domain.AppUserModel) (AppUser, error)

type AppUserAddParameter

type AppUserAddParameter interface {
	GetLoginID() string
	GetUsername() string
	GetRoles() []string
	GetProperties() map[string]string
}

func NewAppUserAddParameter

func NewAppUserAddParameter(loginID, username string, roles []string, properties map[string]string) (AppUserAddParameter, error)

type AppUserGroup

type AppUserGroup interface {
	domain.AppUserGroupModel
}

func NewAppUserGroup

func NewAppUserGroup(appUserGroupModel domain.AppUserGroupModel) (AppUserGroup, error)

NewAppUserGroup returns a new AppUserGroup

type AppUserGroupRepository

type AppUserGroupRepository interface {
	FindPublicGroup(ctx context.Context, operator domain.SystemOwnerModel) (AppUserGroup, error)

	AddPublicGroup(ctx context.Context, operator domain.SystemOwnerModel) (domain.AppUserGroupID, error)
}

type AppUserRepository

type AppUserRepository interface {
	FindSystemOwnerByOrganizationID(ctx context.Context, operator domain.SystemAdminModel, organizationID domain.OrganizationID) (SystemOwner, error)

	FindSystemOwnerByOrganizationName(ctx context.Context, operator domain.SystemAdminModel, organizationName string) (SystemOwner, error)

	FindAppUserByID(ctx context.Context, operator domain.AppUserModel, id domain.AppUserID) (AppUser, error)

	FindAppUserByLoginID(ctx context.Context, operator domain.AppUserModel, loginID string) (AppUser, error)

	FindOwnerByLoginID(ctx context.Context, operator domain.SystemOwnerModel, loginID string) (Owner, error)

	AddAppUser(ctx context.Context, operator domain.OwnerModel, param AppUserAddParameter) (domain.AppUserID, error)

	AddSystemOwner(ctx context.Context, operator domain.SystemAdminModel, organizationID domain.OrganizationID) (domain.AppUserID, error)

	AddFirstOwner(ctx context.Context, operator domain.SystemOwnerModel, param FirstOwnerAddParameter) (domain.AppUserID, error)

	FindAppUserIDs(ctx context.Context, operator domain.SystemOwnerModel, pageNo, pageSize int) ([]domain.AppUserID, error)
}

type FirstOwnerAddParameter

type FirstOwnerAddParameter interface {
	GetLoginID() string
	GetUsername() string
	GetPassword() string
}

func NewFirstOwnerAddParameter

func NewFirstOwnerAddParameter(loginID, username, password string) (FirstOwnerAddParameter, error)

type GroupUserRepository

type GroupUserRepository interface {
	AddGroupUser(ctx context.Context, operator domain.AppUserModel, appUserGroupID domain.AppUserGroupID, appUserID domain.AppUserID) error
}

type Organization

type Organization interface {
	domain.OrganizationModel
}

func NewOrganization

func NewOrganization(organizationModel domain.OrganizationModel) (Organization, error)

type OrganizationAddParameter

type OrganizationAddParameter interface {
	GetName() string
	GetFirstOwner() FirstOwnerAddParameter
}

func NewOrganizationAddParameter

func NewOrganizationAddParameter(name string, firstOwner FirstOwnerAddParameter) (OrganizationAddParameter, error)

type OrganizationRepository

type OrganizationRepository interface {
	GetOrganization(ctx context.Context, operator domain.AppUserModel) (Organization, error)

	FindOrganizationByName(ctx context.Context, operator domain.SystemAdminModel, name string) (Organization, error)

	FindOrganizationByID(ctx context.Context, operator domain.SystemAdminModel, id domain.OrganizationID) (Organization, error)

	AddOrganization(ctx context.Context, operator domain.SystemAdminModel, param OrganizationAddParameter) (domain.OrganizationID, error)
}

type Owner

type Owner interface {
	domain.OwnerModel
}

func NewOwner

func NewOwner(rf RepositoryFactory, ownerModel domain.OwnerModel) Owner

type RBACRepository

type RBACRepository interface {
	Init() error

	AddNamedPolicy(subject domain.RBACRole, object domain.RBACObject, action domain.RBACAction) error

	AddNamedGroupingPolicy(subject domain.RBACUser, object domain.RBACRole) error

	NewEnforcerWithRolesAndUsers(roles []domain.RBACRole, users []domain.RBACUser) (*casbin.Enforcer, error)
}

type RepositoryFactory

type RepositoryFactory interface {
	NewOrganizationRepository(ctx context.Context) OrganizationRepository
	NewSpaceRepository(ctx context.Context) SpaceRepository
	NewAppUserRepository(ctx context.Context) AppUserRepository
	NewAppUserGroupRepository(ctx context.Context) AppUserGroupRepository

	NewGroupUserRepository(ctx context.Context) GroupUserRepository
	NewUserSpaceRepository(ctx context.Context) UserSpaceRepository
	NewRBACRepository(ctx context.Context) RBACRepository
}

type Space

type Space interface {
	domain.SpaceModel
}

func NewSpace

func NewSpace(spaceModel domain.SpaceModel) (Space, error)

type SpaceRepository

type SpaceRepository interface {
	FindDefaultSpace(ctx context.Context, operator domain.AppUserModel) (Space, error)

	FindPersonalSpace(ctx context.Context, operator domain.AppUserModel) (Space, error)

	FindSystemSpace(ctx context.Context, operator domain.AppUserModel) (Space, error)

	AddDefaultSpace(ctx context.Context, operator domain.SystemOwnerModel) (uint, error)

	AddPersonalSpace(ctx context.Context, operator domain.SystemOwnerModel, appUser domain.AppUserModel) (domain.SpaceID, error)

	AddSystemSpace(ctx context.Context, operator domain.SystemOwnerModel) (domain.SpaceID, error)
}

type SystemAdmin

type SystemAdmin interface {
	domain.SystemAdminModel

	FindSystemOwnerByOrganizationID(ctx context.Context, organizationID domain.OrganizationID) (SystemOwner, error)

	FindSystemOwnerByOrganizationName(ctx context.Context, organizationName string) (SystemOwner, error)

	FindOrganizationByName(ctx context.Context, name string) (Organization, error)

	AddOrganization(ctx context.Context, parma OrganizationAddParameter) (domain.OrganizationID, error)
}

func NewSystemAdmin

func NewSystemAdmin(ctx context.Context, rf RepositoryFactory) (SystemAdmin, error)

type SystemOwner

type SystemOwner interface {
	domain.SystemOwnerModel

	GetOrganization(ctxc context.Context) (Organization, error)

	FindAppUserByID(ctx context.Context, id domain.AppUserID) (AppUser, error)

	FindAppUserByLoginID(ctx context.Context, loginID string) (AppUser, error)

	FindSystemSpace(ctx context.Context) (Space, error)

	AddAppUser(ctx context.Context, param AppUserAddParameter) (domain.AppUserID, error)

	AddSystemSpace(ctx context.Context) (domain.SpaceID, error)
}

func NewSystemOwner

func NewSystemOwner(ctx context.Context, rf RepositoryFactory, systemOwnerModel domain.SystemOwnerModel) (SystemOwner, error)

type UserPreferenceRepository

type UserPreferenceRepository interface {
	SetPreference(ctx context.Context)
}

type UserPreferences

type UserPreferences interface {
}

func NewUserPreferences

func NewUserPreferences() UserPreferences

type UserSpaceRepository

type UserSpaceRepository interface {
	Add(ctx context.Context, operator domain.AppUserModel, spaceID domain.SpaceID) error
}

UserSpaceRepository mangages relationship between AppUser and Space

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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