API Reference 0.7.0rikulo_securityAccessControl

AccessControl abstract class

The access control.

abstract class AccessControl {
 /** Test if the given request is accessible by the given user.
  *
  * * [user] - the current user, or null if not logged in.
  * * It returns true if the access is granted; returns false if not allowed
  * (either not logged in or not allowed).
  *
  * If [user] is not null and this method returns false, an instance of [Http404]
  * will be thrown. If you prefer other status code (such as 401), you can
  * throw an exception in this method.
  */
 bool canAccess(HttpConnect connect, user);
}

Subclasses

SimpleAccessControl

Methods

abstract bool canAccess(HttpConnect connect, user) #

Test if the given request is accessible by the given user.

  • user - the current user, or null if not logged in.
  • It returns true if the access is granted; returns false if not allowed (either not logged in or not allowed).

If user is not null and this method returns false, an instance of Http404 will be thrown. If you prefer other status code (such as 401), you can throw an exception in this method.