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
fc9a5ef6
Commit
fc9a5ef6
authored
Jun 10, 2006
by
Andreas Jung
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- Collector #2073: fixed misbehaviour of OFS.Owned.changeOwnership
parent
494c9180
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
189 additions
and
2 deletions
+189
-2
doc/CHANGES.txt
doc/CHANGES.txt
+1
-0
lib/python/AccessControl/Owned.py
lib/python/AccessControl/Owned.py
+3
-2
lib/python/AccessControl/tests/framework.py
lib/python/AccessControl/tests/framework.py
+107
-0
lib/python/AccessControl/tests/testChownRecursive.py
lib/python/AccessControl/tests/testChownRecursive.py
+78
-0
No files found.
doc/CHANGES.txt
View file @
fc9a5ef6
...
@@ -25,6 +25,7 @@ Zope Changes
...
@@ -25,6 +25,7 @@ Zope Changes
- Collector 2077: fixed problem with ACTUAL_URL and SiteRoot
- Collector 2077: fixed problem with ACTUAL_URL and SiteRoot
- Collector #2073: fixed misbehaviour of OFS.Owned.changeOwnership
Zope 2.9.3 (2006/05/13)
Zope 2.9.3 (2006/05/13)
...
...
lib/python/AccessControl/Owned.py
View file @
fc9a5ef6
...
@@ -152,8 +152,9 @@ class Owned(ExtensionClass.Base):
...
@@ -152,8 +152,9 @@ class Owned(ExtensionClass.Base):
new
=
ownerInfo
(
user
)
new
=
ownerInfo
(
user
)
if
new
is
None
:
return
# Special user!
if
new
is
None
:
return
# Special user!
old
=
self
.
getOwnerTuple
()
old
=
self
.
getOwnerTuple
()
if
old
==
new
:
return
if
not
recursive
:
if
old
is
UnownableOwner
:
return
if
old
==
new
:
return
if
old
is
UnownableOwner
:
return
for
child
in
self
.
objectValues
():
for
child
in
self
.
objectValues
():
if
recursive
:
if
recursive
:
...
...
lib/python/AccessControl/tests/framework.py
0 → 100644
View file @
fc9a5ef6
##############################################################################
#
# ZopeTestCase
#
# COPY THIS FILE TO YOUR 'tests' DIRECTORY.
#
# This version of framework.py will use the SOFTWARE_HOME
# environment variable to locate Zope and the Testing package.
#
# If the tests are run in an INSTANCE_HOME installation of Zope,
# Products.__path__ and sys.path with be adjusted to include the
# instance's Products and lib/python directories respectively.
#
# If you explicitly set INSTANCE_HOME prior to running the tests,
# auto-detection is disabled and the specified path will be used
# instead.
#
# If the 'tests' directory contains a custom_zodb.py file, INSTANCE_HOME
# will be adjusted to use it.
#
# If you set the ZEO_INSTANCE_HOME environment variable a ZEO setup
# is assumed, and you can attach to a running ZEO server (via the
# instance's custom_zodb.py).
#
##############################################################################
#
# The following code should be at the top of every test module:
#
# import os, sys
# if __name__ == '__main__':
# execfile(os.path.join(sys.path[0], 'framework.py'))
#
# ...and the following at the bottom:
#
# if __name__ == '__main__':
# framework()
#
##############################################################################
__version__
=
'0.2.3'
# Save start state
#
__SOFTWARE_HOME
=
os
.
environ
.
get
(
'SOFTWARE_HOME'
,
''
)
__INSTANCE_HOME
=
os
.
environ
.
get
(
'INSTANCE_HOME'
,
''
)
if
__SOFTWARE_HOME
.
endswith
(
os
.
sep
):
__SOFTWARE_HOME
=
os
.
path
.
dirname
(
__SOFTWARE_HOME
)
if
__INSTANCE_HOME
.
endswith
(
os
.
sep
):
__INSTANCE_HOME
=
os
.
path
.
dirname
(
__INSTANCE_HOME
)
# Find and import the Testing package
#
if
not
sys
.
modules
.
has_key
(
'Testing'
):
p0
=
sys
.
path
[
0
]
if
p0
and
__name__
==
'__main__'
:
os
.
chdir
(
p0
)
p0
=
''
s
=
__SOFTWARE_HOME
p
=
d
=
s
and
s
or
os
.
getcwd
()
while
d
:
if
os
.
path
.
isdir
(
os
.
path
.
join
(
p
,
'Testing'
)):
zope_home
=
os
.
path
.
dirname
(
os
.
path
.
dirname
(
p
))
sys
.
path
[:
1
]
=
[
p0
,
p
,
zope_home
]
break
p
,
d
=
s
and
(
''
,
''
)
or
os
.
path
.
split
(
p
)
else
:
print
'Unable to locate Testing package.'
,
print
'You might need to set SOFTWARE_HOME.'
sys
.
exit
(
1
)
import
Testing
,
unittest
execfile
(
os
.
path
.
join
(
os
.
path
.
dirname
(
Testing
.
__file__
),
'common.py'
))
# Include ZopeTestCase support
#
if
1
:
# Create a new scope
p
=
os
.
path
.
join
(
os
.
path
.
dirname
(
Testing
.
__file__
),
'ZopeTestCase'
)
if
not
os
.
path
.
isdir
(
p
):
print
'Unable to locate ZopeTestCase package.'
,
print
'You might need to install ZopeTestCase.'
sys
.
exit
(
1
)
ztc_common
=
'ztc_common.py'
ztc_common_global
=
os
.
path
.
join
(
p
,
ztc_common
)
f
=
0
if
os
.
path
.
exists
(
ztc_common_global
):
execfile
(
ztc_common_global
)
f
=
1
if
os
.
path
.
exists
(
ztc_common
):
execfile
(
ztc_common
)
f
=
1
if
not
f
:
print
'Unable to locate %s.'
%
ztc_common
sys
.
exit
(
1
)
# Debug
#
print
'SOFTWARE_HOME: %s'
%
os
.
environ
.
get
(
'SOFTWARE_HOME'
,
'Not set'
)
print
'INSTANCE_HOME: %s'
%
os
.
environ
.
get
(
'INSTANCE_HOME'
,
'Not set'
)
sys
.
stdout
.
flush
()
lib/python/AccessControl/tests/testChownRecursive.py
0 → 100644
View file @
fc9a5ef6
# vim: ts=4 expandtab :
##############################################################################
#
# Copyright (c) 2005 Zope Corporation and Contributors. All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""Skeleton ZopeTestCase
$Id: testSkeleton.py 30245 2005-05-05 09:50:09Z shh $
"""
import
os
,
sys
if
__name__
==
'__main__'
:
execfile
(
os
.
path
.
join
(
sys
.
path
[
0
],
'framework.py'
))
from
Testing
import
ZopeTestCase
#ZopeTestCase.installProduct('SomeProduct')
class
TestRecursiveChangeOwnership
(
ZopeTestCase
.
ZopeTestCase
):
user_name2
=
"dumdidum"
user_pass2
=
"dumdidum"
def
afterSetUp
(
self
):
## self.folder.changeOwnership(ZopeTestCase.user_name)
# need a second user
ufld
=
self
.
folder
[
'acl_users'
]
ufld
.
userFolderAddUser
(
self
.
user_name2
,
self
.
user_pass2
,
[],
[])
# remember user objects
# is the __of__() call correct? is it needed? without it ownerInfo in Owned.py throws
# an AttributeError ...
self
.
user1
=
self
.
folder
[
'acl_users'
].
getUser
(
ZopeTestCase
.
user_name
).
__of__
(
self
.
folder
)
self
.
user2
=
self
.
folder
[
'acl_users'
].
getUser
(
self
.
user_name2
).
__of__
(
self
.
folder
)
self
.
folder
.
changeOwnership
(
self
.
user1
)
# need some objects owned by second user
# beneath self.folder
self
.
folder
.
manage_addFile
(
"testfile"
)
self
.
file
=
self
.
folder
[
"testfile"
]
self
.
file
.
changeOwnership
(
self
.
user2
)
def
testRecursiveChangeOwnership
(
self
):
# ensure folder is owned by user1
owner
=
self
.
folder
.
getOwnerTuple
()[
1
]
self
.
assertEqual
(
owner
,
ZopeTestCase
.
user_name
)
# ensure file is owned by user2
owner
=
self
.
file
.
getOwnerTuple
()[
1
]
self
.
assertEqual
(
owner
,
self
.
user_name2
)
self
.
folder
.
changeOwnership
(
self
.
user1
,
recursive
=
1
)
# ensure file's ownership has changed now to user1
owner
=
self
.
file
.
getOwnerTuple
()[
1
]
self
.
assertEqual
(
owner
,
ZopeTestCase
.
user_name
)
def
test_suite
():
from
unittest
import
TestSuite
,
makeSuite
suite
=
TestSuite
()
suite
.
addTest
(
makeSuite
(
TestRecursiveChangeOwnership
))
return
suite
if
__name__
==
'__main__'
:
framework
()
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