Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
Zope
Commits
2f8efb21
Commit
2f8efb21
authored
Jan 27, 2004
by
Brian Lloyd
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
policy fixes
parent
1c5572b9
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
97 additions
and
153 deletions
+97
-153
lib/python/AccessControl/ImplPython.py
lib/python/AccessControl/ImplPython.py
+23
-17
lib/python/AccessControl/cAccessControl.c
lib/python/AccessControl/cAccessControl.c
+74
-136
No files found.
lib/python/AccessControl/ImplPython.py
View file @
2f8efb21
...
...
@@ -212,6 +212,13 @@ class ZopeSecurityPolicy:
if
name
.
startswith
(
'aq_'
)
and
name
not
in
valid_aq_
:
raise
Unauthorized
(
name
,
value
)
containerbase
=
aq_base
(
container
)
accessedbase
=
aq_base
(
accessed
)
if
accessedbase
is
accessed
:
# accessed is not a wrapper, so assume that the
# value could not have been acquired.
accessedbase
=
container
############################################################
# If roles weren't passed in, we'll try to get them from the object
...
...
@@ -236,14 +243,16 @@ class ZopeSecurityPolicy:
roles
=
getattr
(
container
,
'__roles__'
,
roles
)
if
roles
is
_noroles
:
# Try to acquire __roles__. If __roles__ can't be
# acquired, the value is unprotected and roles is
# left set to _noroles.
if
aq_base
(
container
)
is
not
container
:
try
:
roles
=
container
.
aq_acquire
(
'__roles__'
)
if
containerbase
is
container
:
# Container is not wrapped.
if
containerbase
is
not
accessedbase
:
raise
Unauthorized
(
name
,
value
)
else
:
# Try to acquire roles
try
:
roles
=
container
.
aq_acquire
(
'__roles__'
)
except
AttributeError
:
pass
if
containerbase
is
not
accessedbase
:
raise
Unauthorized
(
name
,
value
)
# We need to make sure that we are allowed to
# get unprotected attributes from the container. We are
...
...
@@ -308,18 +317,15 @@ class ZopeSecurityPolicy:
# in the context of the accessed item; users in subfolders
# should not be able to use proxy roles to access items
# above their subfolder!
owner
=
eo
.
getOwner
()
# Sigh; the default userfolder doesn't return users wrapped
if
owner
and
not
hasattr
(
owner
,
'aq_parent'
):
udb
=
eo
.
getOwner
(
1
)[
0
]
root
=
container
.
getPhysicalRoot
()
udb
=
root
.
unrestrictedTraverse
(
udb
)
owner
=
owner
.
__of__
(
udb
)
owner
=
eo
.
getWrappedOwner
()
if
owner
is
not
None
:
if
not
owner
.
_check_context
(
container
):
# container is higher up than the owner, deny access
raise
Unauthorized
(
name
,
value
)
if
container
is
not
containerbase
:
# Unwrapped objects don't need checking
if
not
owner
.
_check_context
(
container
):
# container is higher up than the owner,
# deny access
raise
Unauthorized
(
name
,
value
)
for
r
in
proxy_roles
:
if
r
in
roles
:
...
...
lib/python/AccessControl/cAccessControl.c
View file @
2f8efb21
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment