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
26791c09
Commit
26791c09
authored
Jan 16, 2004
by
Brian Lloyd
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
reenable cAccessControl
parent
f54fc698
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
47 additions
and
22 deletions
+47
-22
lib/python/AccessControl/Implementation.py
lib/python/AccessControl/Implementation.py
+4
-13
lib/python/AccessControl/cAccessControl.c
lib/python/AccessControl/cAccessControl.c
+43
-4
lib/python/AccessControl/tests/testImplementation.py
lib/python/AccessControl/tests/testImplementation.py
+0
-5
No files found.
lib/python/AccessControl/Implementation.py
View file @
26791c09
...
...
@@ -34,28 +34,20 @@ def setImplementation(name):
"""Select the policy implementation to use.
'name' must be either 'PYTHON' or 'C'.
XXX: 'C' version is currently broken
"""
import
sys
global
_implementation_name
#
name
=
name
.
upper
()
if
name
==
_implementation_name
:
return
if
name
==
"C"
:
raise
NotImplementedError
(
# XXX
"'C' version of ZSP not yet working."
)
try
:
from
AccessControl
import
ImplC
as
impl
except
ImportError
:
name
=
"PYTHON"
from
AccessControl
import
ImplPython
as
impl
from
AccessControl
import
ImplC
as
impl
elif
name
==
"PYTHON"
:
from
AccessControl
import
ImplPython
as
impl
else
:
raise
ValueError
(
"unknown policy implementation: %r"
%
name
)
#
_implementation_name
=
name
for
modname
,
names
in
_policy_names
.
items
():
__import__
(
modname
)
...
...
@@ -91,5 +83,4 @@ _policy_names = {
# start with the default, mostly because we need something for the tests
#setImplementation("C") XXX: C version of ZSP isn't yet working
setImplementation
(
"PYTHON"
)
setImplementation
(
"C"
)
lib/python/AccessControl/cAccessControl.c
View file @
26791c09
...
...
@@ -36,7 +36,7 @@
USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
DAMAGE.
$Id: cAccessControl.c,v 1.2
5 2004/01/14 19:42:30
Brian Exp $
$Id: cAccessControl.c,v 1.2
6 2004/01/16 18:49:22
Brian Exp $
If you have questions regarding this software,
contact:
...
...
@@ -674,6 +674,7 @@ static PyObject *unrestrictedTraverse_str = NULL;
static
PyObject
*
aq_validate
=
NULL
;
static
PyObject
*
aq_parent_str
=
NULL
;
static
PyObject
*
_check_context_str
=
NULL
;
static
PyObject
*
getRoles
=
NULL
;
static
int
ownerous
=
1
;
static
int
authenticated
=
1
;
...
...
@@ -785,8 +786,8 @@ static PyObject *ZopeSecurityPolicy_validate(PyObject *self, PyObject *args) {
return
NULL
;
/*| # Provide special rules for acquisition attributes
**| if
type(name) in (StringType, UnicodeType
):
**| if name
[:3] == 'aq_'
and name not in valid_aq_:
**| if
isinstance(name, str
):
**| if name
.startswith('aq_')
and name not in valid_aq_:
**| raise Unauthorized(name, value)
*/
...
...
@@ -807,6 +808,30 @@ static PyObject *ZopeSecurityPolicy_validate(PyObject *self, PyObject *args) {
Py_XINCREF
(
roles
);
/* Convert the borrowed ref to a real one */
/* new */
/*| # If roles weren't passed in, we'll try to get them from
**| # the object
**|
**| if roles is _noroles:
**| roles = getRoles(container, name, value, _noroles)
*/
if
(
roles
==
NULL
)
{
/* Note that the '_noroles' arg is just a marker - our C version
of _noroles is null */
roles
=
callfunction4
(
getRoles
,
container
,
name
,
value
,
getRoles
);
if
(
roles
==
getRoles
)
{
Py_DECREF
(
roles
);
roles
=
NULL
;
}
if
(
roles
==
NULL
)
PyErr_Clear
();
}
/* old */
/*| # If roles weren't passed in, we'll try to get them from
**| # the object
**|
...
...
@@ -820,6 +845,10 @@ static PyObject *ZopeSecurityPolicy_validate(PyObject *self, PyObject *args) {
PyErr_Clear
();
}
/*| # We still might not have any roles
**|
**| if roles is _noroles:
...
...
@@ -2323,7 +2352,7 @@ void initcAccessControl(void) {
module
=
Py_InitModule3
(
"cAccessControl"
,
cAccessControl_methods
,
"$Id: cAccessControl.c,v 1.2
5 2004/01/14 19:42:30
Brian Exp $
\n
"
);
"$Id: cAccessControl.c,v 1.2
6 2004/01/16 18:49:22
Brian Exp $
\n
"
);
aq_init
();
/* For Python <= 2.1.1, aq_init() should be after
Py_InitModule(). */
...
...
@@ -2362,6 +2391,16 @@ void initcAccessControl(void) {
Py_DECREF
(
module
);
module
=
NULL
;
/*| from ZopeSecurityPolicy import getRoles
*/
IMPORT
(
module
,
"AccessControl.ZopeSecurityPolicy"
);
GETATTR
(
module
,
getRoles
);
Py_DECREF
(
module
);
module
=
NULL
;
/*| from unauthorized import Unauthorized
*/
...
...
lib/python/AccessControl/tests/testImplementation.py
View file @
26791c09
...
...
@@ -38,11 +38,6 @@ class AccessControlImplementationTest(unittest.TestCase):
setImplementation
(
self
.
original
)
def
test_setImplemenationC
(
self
):
# XXX: 'C' ZSP is not yet working
self
.
assertRaises
(
NotImplementedError
,
setImplementation
,
"C"
)
return
setImplementation
(
"C"
)
name
=
getImplementationName
()
if
self
.
have_cAccessControl
:
...
...
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