summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheron Luhn <theron@luhn.com>2019-06-23 12:45:47 -0700
committerTheron Luhn <theron@luhn.com>2019-06-23 12:45:47 -0700
commit514f75fc6dfa6b7f5e58e48da229c7a23059ba31 (patch)
tree171572a03d6b57988e4a14b68b84ba2ae35fc888
parent14d569ea34409ed796296f860f03b8403859412f (diff)
downloadpyramid-514f75fc6dfa6b7f5e58e48da229c7a23059ba31.tar.gz
pyramid-514f75fc6dfa6b7f5e58e48da229c7a23059ba31.tar.bz2
pyramid-514f75fc6dfa6b7f5e58e48da229c7a23059ba31.zip
Add deprecation warnings.
-rw-r--r--src/pyramid/config/security.py8
-rw-r--r--src/pyramid/predicates.py11
-rw-r--r--src/pyramid/security.py18
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: