From 2466f6eaa2246598dc6cb3c962364773eb4cc64a Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Wed, 16 Jul 2008 10:32:08 +0000 Subject: Add security. --- repoze/bfg/interfaces.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'repoze/bfg/interfaces.py') diff --git a/repoze/bfg/interfaces.py b/repoze/bfg/interfaces.py index 005d30027..f51e23cbf 100644 --- a/repoze/bfg/interfaces.py +++ b/repoze/bfg/interfaces.py @@ -43,3 +43,22 @@ class ITemplateFactory(Interface): def __call__(template_path): """ Return an IView given a template path """ +class ISecurityPolicy(Interface): + """ A utility that provides a mechanism to check authorization + using authentication data """ + def permits(context, request, permission): + """ Returns True if the combination of the authorization + information in the context and the authentication data in + the request allow the action implied by the permission """ + +class NoAuthorizationInformation(Exception): + pass + +class IViewPermission(Interface): + def __call__(security_policy): + """ Return True if the permission allows, return False if it denies. """ + +class IViewPermissionFactory(Interface): + def __call__(context, request): + """ Return an IViewPermission """ + -- cgit v1.2.3