Capabilities

Context Access

Read the current user from context provided by the Go app.

Reference View source
Source capabilities/context_access.vibe
# vibe: 0.2
# uses: ctx

def current_user_id
  ctx.user.id
end

def coach?
  ctx.user.role == "coach"
end

def run
  {
    note: "This example requires the ctx capability which is injected by the host application.",
    functions: ["current_user_id", "coach?"]
  }
end
Output
Press Run example to run this code.