Wardrik.Statements (wardrik v0.1.0-rc.1)

Copy Markdown

The default Wardrik.Authorizer. Allows what the scope's Wardrik.Statements allow.

scope = Wardrik.as(MyApp.AgentRuntime, "acme/@maria", roles: [:reader], resources: ["acme/agent/*"])

Anything no statement allows is refused.

Summary

Functions

Returns whether outer covers every name the pattern inner covers.

Functions

within?(inner, outer)

@spec within?(String.t(), String.t()) :: boolean()

Returns whether outer covers every name the pattern inner covers.

Wardrik.Statements.within?("acme/agent/*", "acme/*")
#=> true

Wardrik.Statements.within?("acme/a?", "acme/a*")
#=> true

Wardrik.Statements.within?("acme/a*", "acme/a?")
#=> false