pecan.secure – Pecan Secure Controllers

The pecan.secure module includes a basic framework for building security into your applications.

pecan.secure.secure(func_or_obj, check_permissions_for_obj=None)

This method secures a method or class depending on invocation.

To decorate a method use one argument:

@secure(<check_permissions_method>)

To secure a class, invoke with two arguments:

secure(<obj instance>, <check_permissions_method>)

pecan.secure.unlocked(func_or_obj)

This method unlocks method or class attribute on a SecureController. Can be used to decorate or wrap an attribute

class pecan.secure.SecureControllerBase

Bases: object

classmethod check_permissions()

Returns True or False to grant access. Implemented in subclasses of SecureController.

class pecan.secure.SecureController

Bases: pecan.secure.SecureControllerBase

Used to apply security to a controller. Implementations of SecureController should extend the check_permissions method to return a True or False value (depending on whether or not the user has permissions to the controller).