diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/pyramid/config/security.py | 8 | ||||
| -rw-r--r-- | src/pyramid/predicates.py | 11 | ||||
| -rw-r--r-- | src/pyramid/security.py | 18 |
3 files changed, 37 insertions, 0 deletions
diff --git a/src/pyramid/config/security.py b/src/pyramid/config/security.py index a68581ff1..8f0a108c5 100644 --- a/src/pyramid/config/security.py +++ b/src/pyramid/config/security.py @@ -1,4 +1,5 @@ from zope.interface import implementer +from zope.deprecation import deprecate from pyramid.interfaces import ( IAuthorizationPolicy, @@ -56,6 +57,13 @@ class SecurityConfiguratorMixin(object): introspectables=(intr,), ) + @deprecate( + 'Authentication and authorization policies have been deprecated in ' + 'favor of security policies. See ' + 'https://docs.pylonsproject.org/projects/pyramid/en/latest' + '/whatsnew-2.0.html#upgrading-authentication-authorization ' + 'for more information.' + ) @action_method def set_authentication_policy(self, policy): """ diff --git a/src/pyramid/predicates.py b/src/pyramid/predicates.py index eafd4b890..a267a69a0 100644 --- a/src/pyramid/predicates.py +++ b/src/pyramid/predicates.py @@ -1,5 +1,7 @@ import re +from zope.deprecation import deprecated + from pyramid.exceptions import ConfigurationError from pyramid.csrf import check_csrf_token @@ -319,6 +321,15 @@ class EffectivePrincipalsPredicate(object): return False +deprecated( + 'EffectivePrincipalsPredicate', + 'The new security policy has removed the concept of principals. See ' + 'https://docs.pylonsproject.org/projects/pyramid/en/latest' + '/whatsnew-2.0.html#upgrading-authentication-authorization ' + 'for more information.', +) + + class Notted(object): def __init__(self, predicate): self.predicate = predicate diff --git a/src/pyramid/security.py b/src/pyramid/security.py index 44ae75196..64e840801 100644 --- a/src/pyramid/security.py +++ b/src/pyramid/security.py @@ -1,4 +1,5 @@ from zope.interface import implementer, providedBy +from zope.deprecation import deprecated from pyramid.interfaces import ( ISecurityPolicy, @@ -137,6 +138,15 @@ def principals_allowed_by_permission(context, permission): return policy.principals_allowed_by_permission(context, permission) +deprecated( + 'principals_allowed_by_permission', + 'The new security policy has removed the concept of principals. See ' + 'https://docs.pylonsproject.org/projects/pyramid/en/latest' + '/whatsnew-2.0.html#upgrading-authentication-authorization ' + 'for more information.', +) + + def view_execution_permitted(context, request, name=''): """ If the view specified by ``context`` and ``name`` is protected by a :term:`permission`, check the permission associated with the @@ -395,6 +405,14 @@ class AuthenticationAPIMixin(object): return [Everyone] return policy.effective_principals(self) + effective_principals = deprecated( + effective_principals, + 'The new security policy has removed the concept of principals. See ' + 'https://docs.pylonsproject.org/projects/pyramid/en/latest' + '/whatsnew-2.0.html#upgrading-authentication-authorization ' + 'for more information.', + ) + @implementer(ISecurityPolicy) class LegacySecurityPolicy: |
