libb.login_required

login_required(*, allowed_groups, session_accessor=None, login_path='/login/', on_forbidden=None)[source]

Decorator: require a logged-in session whose groups are allowed.

Redirects to login_path when no user is in the session; otherwise enforces group_required(). Built for the standard Flask web tier; all group names, the login path, and the denied renderer are injected.

Parameters:
  • allowed_groups – Iterable of group names (see group_required).

  • session_accessor – Callable returning the session mapping (defaults to Flask’s session).

  • login_path – Where to redirect unauthenticated users.

  • on_forbidden – Callable(groups, allowed) for the 403 case.

Returns:

A view decorator.