Documentation
¶
Index ¶
- Constants
- Variables
- func AnyHasDescendant(ctx context.Context, tenantIDs utils.StringSet, descendant string) bool
- func BuildSpsString(subject string, predict string, object ...string) string
- func GetAncestors(ctx context.Context, tenantId string) ([]string, error)
- func GetChildren(ctx context.Context, tenantId string) ([]string, error)
- func GetDescendants(ctx context.Context, tenantId string) ([]string, error)
- func GetObjectOfSpo(spo string) (string, error)
- func GetParent(ctx context.Context, tenantId string) (string, error)
- func GetRoot(ctx context.Context) (string, error)
- func GetTenancyPath(ctx context.Context, tenantId string) ([]uuid.UUID, error)
- func IsLoaded(ctx context.Context) bool
- func Use()
- func ZInclusive(min string) string
- type Accessor
- type CacheProperties
- type TenancyAccessor
- func (a *TenancyAccessor) GetAncestors(ctx context.Context, tenantId string) ([]string, error)
- func (a *TenancyAccessor) GetChildren(ctx context.Context, tenantId string) ([]string, error)
- func (a *TenancyAccessor) GetDescendants(ctx context.Context, tenantId string) ([]string, error)
- func (a *TenancyAccessor) GetParent(ctx context.Context, tenantId string) (string, error)
- func (a *TenancyAccessor) GetRoot(ctx context.Context) (string, error)
- func (a *TenancyAccessor) GetTenancyPath(ctx context.Context, tenantId string) ([]uuid.UUID, error)
- func (a *TenancyAccessor) IsLoaded(ctx context.Context) bool
Constants ¶
View Source
const CachePropertiesPrefix = "security.cache"
View Source
const IsChildrenOfPredict = "is-children-of"
View Source
const IsParentOfPredict = "is-parent-of"
View Source
const RedisZsetMaxByte = "\uffff"
View Source
const RootTenantKey = "root-tenant-id"
View Source
const STATUS_FAILED_TO_LOAD_ROOT_TENANT = "FAILED_TO_LOAD_ROOT_TENANT"
View Source
const STATUS_IN_PROGRESS = "IN_PROGRESS"
View Source
const STATUS_LOADED = "LOADED"
View Source
const StatusKey = "tenant-hierarchy-status"
View Source
const ZsetKey = "tenant-hierarchy"
Variables ¶
Functions ¶
func AnyHasDescendant ¶
AnyHasDescendant returns true if any of "tenantIDs" in utils.StringSet contains "descendant" or its ancestors
func GetObjectOfSpo ¶
func GetRoot ¶
GetRoot because root tenantId won't change once system is started, we can cache it after first successful read.
func GetTenancyPath ¶
func IsLoaded ¶
IsLoaded returns if tenancy information is available. Note that callers normally don't need to check this flag directly. Other top-level functions Get...() returns error if not loaded
func ZInclusive ¶
Types ¶
type Accessor ¶
type Accessor interface { GetParent(ctx context.Context, tenantId string) (string, error) GetChildren(ctx context.Context, tenantId string) ([]string, error) GetAncestors(ctx context.Context, tenantId string) ([]string, error) GetDescendants(ctx context.Context, tenantId string) ([]string, error) GetRoot(ctx context.Context) (string, error) IsLoaded(ctx context.Context) bool GetTenancyPath(ctx context.Context, tenantId string) ([]uuid.UUID, error) }
type CacheProperties ¶
type CacheProperties struct {
DbIndex int `json:"db-index"`
}
type TenancyAccessor ¶
type TenancyAccessor struct {
// contains filtered or unexported fields
}
func (*TenancyAccessor) GetAncestors ¶
func (*TenancyAccessor) GetChildren ¶
func (*TenancyAccessor) GetDescendants ¶
func (*TenancyAccessor) GetRoot ¶
func (a *TenancyAccessor) GetRoot(ctx context.Context) (string, error)
GetRoot will return the root tenantID. Because the root tenantId won't change once system is started, we can cache it after first successful read.
func (*TenancyAccessor) GetTenancyPath ¶
Click to show internal directories.
Click to hide internal directories.