Commit d5fab897 authored by Jérome Perrin's avatar Jérome Perrin

administration: update Base_viewSecurity to display local roles defined on document

parent 9d710981
...@@ -52,12 +52,15 @@ ...@@ -52,12 +52,15 @@
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>from AccessControl import getSecurityManager\n <value> <string>from AccessControl import getSecurityManager\n
from zExceptions import Unauthorized\n from zExceptions import Unauthorized\n
u=getSecurityManager().getUser()\n from pprint import pformat\n
\n \n
print \'User:\',u\n u = getSecurityManager().getUser()\n
print \'Is owner:\',u.allowed(context,(\'Owner\',))\n \n
print \'User roles:\',u.getRoles()\n print \'User:\', u\n
print \'User roles in context:\',u.getRolesInContext(context)\n print \'Is owner:\', u.allowed(context,(\'Owner\',))\n
print \'User roles:\', u.getRoles()\n
print \'User roles in context:\', u.getRolesInContext(context)\n
print \'Permissions:\'\n
for permission in [\n for permission in [\n
\'Access contents information\',\n \'Access contents information\',\n
\'Add portal content\',\n \'Add portal content\',\n
...@@ -66,12 +69,17 @@ for permission in [\n ...@@ -66,12 +69,17 @@ for permission in [\n
\'View\',\n \'View\',\n
\'Manage portal\',\n \'Manage portal\',\n
]:\n ]:\n
print permission,u.has_permission(permission,context)\n print " ", permission, u.has_permission(permission, context)\n
\n
print\n
try:\n try:\n
print u.getGroups()\n print "User groups:\\n", pformat(u.getGroups())\n
except AttributeError:\n except AttributeError:\n
print \'no getGroups\'\n print \'no getGroups\'\n
\n \n
print\n
print \'Local roles on document:\\n\', pformat(context.get_local_roles())\n
\n
print \'\'\'\n print \'\'\'\n
----------------\n ----------------\n
Security mapping\n Security mapping\n
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment