VipPolicyEvaluateRequest vip.policy-evaluate-request@1

Generated at from openvibe-contracts v0.53.0 and openvibe-sdk v0.11.0.

Version
1.0.0
Owner
vip
Visibility
first-party
Status
active
Compatibility
backward
Schema
https://openvibe.network/contracts/vip/policy-evaluate-request.v1.json

vip.policy-evaluate-request@1: the question of vip.resource.policy.evaluate on OpenVibe.VIP. POST /api/v1/policies/evaluate: { resource, owner, subject?, rule_id?, mode?, fallback? }: may subject see resource, owned (says the product) by creator owner? Only the owner's rule applies; rule_id pins the rule the product expects. fallback is the product's own default gate, used only when the owner has no active rule. A person asks about themselves (403 vip.not_yours otherwise); a service may leave subject out (a signed-out viewer: the answer is no). Nothing is refused for a bad resource, owner or fallback: the answer is allow false with the reason (invalid_resource, owner_required, invalid_fallback, no_rule). Unknown fields are ignored.

Fields

FieldTypeRequiredDescriptionConstraints
resourcecommon.entity-ref
ownerone ofThe creator who owns the resource: a user SubjectRef, usr_ id, or network.
subjectone ofThe viewer; null or absent for a signed-out viewer (services only).
rule_idstringThe rule the product believes applies (vgr_…); a mismatch denies.
modeenumauthoritative always asks Billing; a sensitive rule always does.
  • one of "auto", "authoritative"
fallbackone ofThe product's default gate: { requirement: member, binding?: "product:binding" } (or just "member"); null or false for none.

Examples

From the contract's own test fixtures: valid ones validate, rejected ones must fail.

Valid: service
{
  "subject": {
    "type": "user",
    "id": "usr_01JAB2C3D4E5F6G7H8J9K0MNPR"
  },
  "resource": {
    "service": "blog",
    "type": "post",
    "id": "pst_01JAB2C3D4E5F6G7H8J9K0MNPZ"
  },
  "owner": "usr_01JAB2C3D4E5F6G7H8J9K0MNPQ",
  "fallback": {
    "requirement": "member",
    "binding": "blog:gated_post"
  }
}
Valid: signed-out
{
  "subject": null,
  "resource": {
    "service": "community",
    "type": "thread",
    "id": "thr_01JAB2C3D4E5F6G7H8J9K0MNQ4"
  },
  "owner": {
    "type": "user",
    "id": "usr_01JAB2C3D4E5F6G7H8J9K0MNPQ"
  },
  "mode": "authoritative"
}
Rejected: bad-fallback
{
  "resource": {
    "service": "blog",
    "type": "post",
    "id": "p1"
  },
  "owner": "usr_01JAB2C3D4E5F6G7H8J9K0MNPQ",
  "fallback": {
    "requirement": "follower"
  }
}
Rejected: not-an-object
"blog:post:pst_1"

Validate

const contracts = require('openvibe-contracts');
contracts.validate('vip.policy-evaluate-request@1', value);   // { valid, errors: [{ path, message }] }