33 lines
1.3 KiB
Go
33 lines
1.3 KiB
Go
package model
|
|
|
|
import (
|
|
"go.mongodb.org/mongo-driver/bson/primitive"
|
|
)
|
|
|
|
type ScopeMode string
|
|
|
|
const (
|
|
ScopeAll ScopeMode = "all" // apply to all of that type
|
|
ScopeOnly ScopeMode = "only" // only listed IDs
|
|
ScopeAllExcept ScopeMode = "all_except" // all minus listed IDs
|
|
)
|
|
|
|
type TargetScope struct {
|
|
ObjectRefs `bson:"target" json:"target"`
|
|
Mode ScopeMode `bson:"mode" json:"mode"`
|
|
}
|
|
|
|
type PropertyInstance struct {
|
|
Global bool `bson:"global" json:"global"` // Property has single value for all property users
|
|
Required bool `bson:"required" json:"required"` // Presence requirement (works for One and Many).
|
|
UniqueAcrossEntities bool `bson:"uniqueAcrossEntities" json:"uniqueAcrossEntities"` // Uniqueness across ENTITIES (DB-level concern; enforce in assignments collection).
|
|
PropertySchemaRef primitive.ObjectID `bson:"propertySchemaRef" json:"propertySchemaRef"`
|
|
}
|
|
|
|
type PropertiesBinding struct {
|
|
PermissionBound `bson:"inline" json:"inline"`
|
|
Scope TargetScope `bson:"scope" json:"scope"`
|
|
Bindings []PropertyInstance `bson:"bindings" json:"bindings"`
|
|
ApplicableScopes []TargetScope `bson:"applicableScopes" json:"applicableScopes"`
|
|
}
|