OxL Справочник OxL
РусскийEnglish

error missing-policy

error Стандарт: [§13.4, ч. III.4]

rpc никому не доступен.

What it means#

External principals (User, Anonymous) may call an rpc only when something grants it explicitly: an allow rule of the service's policy, @allow(...) or @public (§13.4). @internal says the method is deliberately closed to them, and calls from the code of the program's roles are allowed implicitly (the call graph "role → method", §13.4). An rpc that has none of these and that no role calls (the compiler follows the handlers, actor messages, main, provides, sagas and pipelines of every role; if cluster.self.hasRole(…) does not prune) can be reached by nobody, which is almost certainly a mistake. Code that no role reaches (dead functions) does not count as a caller; in oxl test builds the tests do.

The check runs only when the rest of the program compiles without errors.

Example#

oxl✓ проверяется в CI
service Orders {
  rpc purge() -> i32       // <- missing-policy
}
impl Orders {
  rpc purge() { 0 }
}
error
missing-policy

How to fix#

oxl✓ проверяется в CI
service Orders {
  @public rpc purge() -> i32            // or: @allow(role: Admin), @internal, an `allow purge if ...` rule
}
impl Orders {
  rpc purge() { 0 }
}

See also#

OxL 1.0.0-beta · Версия документации 1.0.0-beta© OxwaldLink · сгенерировано из Стандарта, исходников std и руководства