[Zope-CVS] CVS: Products/VerboseSecurity - VerboseSecurityPolicy.py:1.4 __init__.py:1.2 UnauthorizedPatch.py:NONE

Shane Hathaway shane@cvs.zope.org
Fri, 30 Aug 2002 11:21:39 -0400


Update of /cvs-repository/Products/VerboseSecurity
In directory cvs.zope.org:/tmp/cvs-serv26084

Modified Files:
	VerboseSecurityPolicy.py __init__.py 
Removed Files:
	UnauthorizedPatch.py 
Log Message:
Simplified unauthorized logging.  Log every failed access with
severity=BLATHER.  This will flood the log if you allow it, but it's better
than exception guessing.


=== Products/VerboseSecurity/VerboseSecurityPolicy.py 1.3 => 1.4 ===
--- Products/VerboseSecurity/VerboseSecurityPolicy.py:1.3	Thu Aug 22 12:50:05 2002
+++ Products/VerboseSecurity/VerboseSecurityPolicy.py	Fri Aug 30 11:21:39 2002
@@ -27,7 +27,7 @@
         _noroles = SimpleObjectPolicies._noroles
     except AttributeError:
         _noroles = []
-    from zLOG import LOG, PROBLEM
+    from zLOG import LOG, PROBLEM, BLATHER
     from Acquisition import aq_base, aq_inner, aq_parent
 
     from AccessControl.PermissionRole import _what_not_even_god_should_do, \
@@ -273,9 +273,6 @@
             return context.user.allowed(object, roles)
 
 
-from thread import get_ident
-_last_messages = {}
-
 def item_repr(ob):
     """Generates a repr without angle brackets (to avoid HTML quoting)"""
     return repr(ob).replace('<', '(').replace('>', ')')
@@ -337,14 +334,8 @@
             s += ', who has the roles %s' % simplifyRoles(eo_owner_roles)
         info.append(s + '.')
     res = ' '.join(info)
-    # Save the message.
-    _last_messages[get_ident()] = res
+    LOG('VerboseSecurity', BLATHER, 'Unauthorized: %s' % res)
     return res
-
-
-def getUnauthorizedMessage():
-    """Returns the reason for the most recent failed access."""
-    return _last_messages.get(get_ident())
 
 
 def getUserRolesInContext(user, context):


=== Products/VerboseSecurity/__init__.py 1.1.1.1 => 1.2 ===
--- Products/VerboseSecurity/__init__.py:1.1.1.1	Tue Aug 20 13:09:39 2002
+++ Products/VerboseSecurity/__init__.py	Fri Aug 30 11:21:39 2002
@@ -21,4 +21,3 @@
 setSecurityPolicy(VerboseSecurityPolicy())
 
 import PermissionRolePatch
-import UnauthorizedPatch

=== Removed File Products/VerboseSecurity/UnauthorizedPatch.py ===