This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
# authority
|
||||
|
||||
**Owns:** Scope and authority grant/validation semantics.
|
||||
|
||||
See `architecture/architecture-registry.yaml` for allowed dependencies and DB schema.
|
||||
|
||||
This module may not write another owner's canonical state. Domain code does not import adapters/runtime/providers.
|
||||
@@ -0,0 +1,3 @@
|
||||
package application
|
||||
|
||||
// Package application coordinates authority-owned use cases through explicit ports.
|
||||
@@ -0,0 +1,22 @@
|
||||
package domain
|
||||
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"git.cin.su/m/Assistant/contracts/authority"
|
||||
"git.cin.su/m/Assistant/contracts/identity"
|
||||
)
|
||||
|
||||
var ErrInvalidCreatorGrant = errors.New("creator grant must be active, global, and revisioned")
|
||||
|
||||
// ValidateCreatorGrant validates the narrow bootstrap authority used by
|
||||
// Domovoy. Execution paths must still perform their own target/revision checks.
|
||||
func ValidateCreatorGrant(binding identity.PrincipalBinding, scope authority.Scope, grant authority.AuthorityGrant) error {
|
||||
if binding.ActorID == "" || binding.PrincipalID == "" || !binding.Active ||
|
||||
!scope.Global || scope.ID == "" ||
|
||||
grant.ID == "" || grant.Class != authority.GrantClassCreator || !grant.Active || grant.Revision == 0 ||
|
||||
grant.ActorID != binding.ActorID || grant.PrincipalID != binding.PrincipalID || grant.ScopeID != scope.ID {
|
||||
return ErrInvalidCreatorGrant
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
package domain
|
||||
|
||||
// Package domain contains authority domain meaning only. It must not import adapters or runtime packages.
|
||||
@@ -0,0 +1,19 @@
|
||||
package domain
|
||||
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"git.cin.su/m/Assistant/contracts/authority"
|
||||
"git.cin.su/m/Assistant/contracts/identity"
|
||||
)
|
||||
|
||||
var ErrInvalidGrant = errors.New("authority grant is not currently valid for actor, principal, and scope")
|
||||
|
||||
func ValidateGrant(binding identity.PrincipalBinding, scope authority.Scope, grant authority.AuthorityGrant) error {
|
||||
if binding.ActorID == "" || binding.PrincipalID == "" || !binding.Active ||
|
||||
scope.ID == "" || grant.ID == "" || grant.Revision == 0 || !grant.Active ||
|
||||
grant.ActorID != binding.ActorID || grant.PrincipalID != binding.PrincipalID || grant.ScopeID != scope.ID {
|
||||
return ErrInvalidGrant
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
package authority
|
||||
|
||||
// Module is an intentionally minimal V1 composition handle. Do not turn it into a God service.
|
||||
type Module struct{}
|
||||
@@ -0,0 +1,3 @@
|
||||
package ports
|
||||
|
||||
// Package ports declares authority-owned external dependencies. Ports must be narrow and semantic.
|
||||
Reference in New Issue
Block a user