OxL Reference

method Flag.setAs

set on behalf of p.

Example:

oxl✓ checked in CI
dynamic Features {
  beta: Flag = Flag.off
}

policy Features {
  allow set if caller.hasRole("Admin")
}

fn main() io {
  let f = Features.get()
  let admin = Principal.User("ann", ["Admin"], Map.new(), false, none)
  f.beta.setAs(&admin, "on")!
  print("{f.beta.current()}")
}
Output
{"percent":100,"by":"user"}
pub(api) fn setAs(p: &Principal, text: str, layer: DynScope = .Global) -> () | DynError

Since. 1.0.0-beta

Parameters

NameType
p&Principal
textstr
layerDynScope = .Global

Returns

()

Errors

  • DynError @error
  • `DynError` for rules that do not parse or when the policy refuses `p`.

Effects

none declared (pure unless the body says otherwise)

Defined in: std/core/dynconf.oxl:883

See also