add method

void add(
  1. String uri,
  2. Iterable<String> roles
)

Adds a protected resource.

  • uri - a regular expression used to match the request URI.

Note: add appends; the first matching mapping wins in canAccess. To replace an existing entry, call remove first.

Implementation

void add(String uri, Iterable<String> roles) {
  assert(_mapping.every((m) => m.pattern.pattern != "^$uri\$"),
      "Duplicate URI pattern: $uri (call remove() first to replace)");
  _mapping.add(_ACMapping(uri, roles));
}