mirror of
https://github.com/beenuar/AiSOC.git
synced 2026-11-24 08:35:46 +08:00
chore(schema): T3.2 add EFFECTIVE_PERMISSION edge
Adds the cached effective-permissions edge to the v1.0 graph vocabulary. Materialised by services/api/app/services/effective_permissions/ rather than the ingest writer, so it carries `actions` (resolved allow-set), an optional `deny_actions` list, the `policy_chain_ids` provenance trail, and the `last_resolved` watermark the UI uses for "changes since last week". Schema is in lockstep across: * schemas/graph-schema.yaml * services/ingest/internal/graph/schema.go (RelEffectivePermission) Drift gate (`scripts/export_graph_schema.py --check`) passes: 15 rels (was 14).
This commit is contained in:
@@ -438,3 +438,26 @@ relationships:
|
||||
- { name: snapshot_id, type: string, required: true }
|
||||
- { name: bytes_in, type: int, required: false }
|
||||
- { name: object_path, type: string, required: false }
|
||||
|
||||
- name: EFFECTIVE_PERMISSION
|
||||
source_label: Identity
|
||||
target_label: Resource
|
||||
event_edge: false
|
||||
description: >-
|
||||
Cached result of the effective-permissions resolver (T3.2). Materialised
|
||||
by `services/api/app/services/effective_permissions/` when a UI query or
|
||||
a scheduled reconciliation asks "what can this principal actually do on
|
||||
this resource right now?". The `actions` list is the resolved
|
||||
allow-set (deny-overrides already applied) and `policy_chain_ids`
|
||||
records every Policy / Role node consulted to derive it, so the UI can
|
||||
reconstruct the provenance hop-by-hop without re-running the resolver.
|
||||
Structural edge (not event-derived) — refreshed on policy-snapshot
|
||||
change and pruned when stale.
|
||||
properties:
|
||||
- { name: snapshot_id, type: string, required: true }
|
||||
- { name: provider, type: string, required: true }
|
||||
- { name: actions, type: list, required: true }
|
||||
- { name: deny_actions, type: list, required: false }
|
||||
- { name: policy_chain_ids, type: list, required: false }
|
||||
- { name: last_resolved, type: datetime, required: true }
|
||||
- { name: resolver_version, type: string, required: false }
|
||||
|
||||
@@ -78,20 +78,26 @@ type RelType string
|
||||
|
||||
// Canonical relationship types for v1.0. Same compatibility rules as labels.
|
||||
const (
|
||||
RelAssumedBy RelType = "ASSUMED_BY"
|
||||
RelHasPermission RelType = "HAS_PERMISSION"
|
||||
RelGrants RelType = "GRANTS"
|
||||
RelOwns RelType = "OWNS"
|
||||
RelConfiguredAs RelType = "CONFIGURED_AS"
|
||||
RelDeployedFrom RelType = "DEPLOYED_FROM"
|
||||
RelAccesses RelType = "ACCESSES"
|
||||
RelPeerOf RelType = "PEER_OF"
|
||||
RelTriggered RelType = "TRIGGERED"
|
||||
RelOccurredOn RelType = "OCCURRED_ON"
|
||||
RelMemberOf RelType = "MEMBER_OF"
|
||||
RelDeploys RelType = "DEPLOYS"
|
||||
RelReadsFrom RelType = "READS_FROM"
|
||||
RelWritesTo RelType = "WRITES_TO"
|
||||
RelAssumedBy RelType = "ASSUMED_BY"
|
||||
RelHasPermission RelType = "HAS_PERMISSION"
|
||||
RelGrants RelType = "GRANTS"
|
||||
RelOwns RelType = "OWNS"
|
||||
RelConfiguredAs RelType = "CONFIGURED_AS"
|
||||
RelDeployedFrom RelType = "DEPLOYED_FROM"
|
||||
RelAccesses RelType = "ACCESSES"
|
||||
RelPeerOf RelType = "PEER_OF"
|
||||
RelTriggered RelType = "TRIGGERED"
|
||||
RelOccurredOn RelType = "OCCURRED_ON"
|
||||
RelMemberOf RelType = "MEMBER_OF"
|
||||
RelDeploys RelType = "DEPLOYS"
|
||||
RelReadsFrom RelType = "READS_FROM"
|
||||
RelWritesTo RelType = "WRITES_TO"
|
||||
// RelEffectivePermission is the cached output of the T3.2 resolver —
|
||||
// materialised by `services/api/app/services/effective_permissions/`
|
||||
// rather than by the ingest writer itself. Listed here so it travels
|
||||
// with the canonical vocabulary and so the schema drift gate keeps the
|
||||
// YAML, the Go enums, and the live database in lockstep.
|
||||
RelEffectivePermission RelType = "EFFECTIVE_PERMISSION"
|
||||
)
|
||||
|
||||
// AllRelTypes is the canonical, ordered enumeration of v1.0 relationships.
|
||||
@@ -110,6 +116,7 @@ var AllRelTypes = []RelType{
|
||||
RelDeploys,
|
||||
RelReadsFrom,
|
||||
RelWritesTo,
|
||||
RelEffectivePermission,
|
||||
}
|
||||
|
||||
// ChangeType describes a graph mutation that downstream consumers want to
|
||||
|
||||
Reference in New Issue
Block a user