summaryrefslogtreecommitdiff
path: root/repoze/bfg/interfaces.py
diff options
context:
space:
mode:
authorChris McDonough <chrism@agendaless.com>2008-07-16 10:32:08 +0000
committerChris McDonough <chrism@agendaless.com>2008-07-16 10:32:08 +0000
commit2466f6eaa2246598dc6cb3c962364773eb4cc64a (patch)
tree80954892ad8e12cffb534f3ae92cd321d4d870f5 /repoze/bfg/interfaces.py
parent23aa82c4963dc75737d7dc8a84d7639775c3b282 (diff)
downloadpyramid-2466f6eaa2246598dc6cb3c962364773eb4cc64a.tar.gz
pyramid-2466f6eaa2246598dc6cb3c962364773eb4cc64a.tar.bz2
pyramid-2466f6eaa2246598dc6cb3c962364773eb4cc64a.zip
Add security.
Diffstat (limited to 'repoze/bfg/interfaces.py')
-rw-r--r--repoze/bfg/interfaces.py19
1 files changed, 19 insertions, 0 deletions
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 """
+