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
bb5234e6
Commit
bb5234e6
authored
Jan 10, 2001
by
Chris McDonough
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added roles argument to validate and validateValue methods.
parent
b4a35249
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
6 deletions
+11
-6
lib/python/AccessControl/SecurityManager.py
lib/python/AccessControl/SecurityManager.py
+11
-6
No files found.
lib/python/AccessControl/SecurityManager.py
View file @
bb5234e6
...
...
@@ -85,11 +85,13 @@
__doc__
=
'''short description
$Id: SecurityManager.py,v 1.
2 2000/05/11 18:54:13 ji
m Exp $'''
__version__
=
'$Revision: 1.
2
$'
[
11
:
-
2
]
$Id: SecurityManager.py,v 1.
3 2001/01/10 20:20:46 chris
m Exp $'''
__version__
=
'$Revision: 1.
3
$'
[
11
:
-
2
]
import
ZopeSecurityPolicy
,
os
,
string
_noroles
=
ZopeSecurityPolicy
.
_noroles
try
:
max_stack_size
=
string
.
atoi
(
os
.
environ
.
get
(
'Z_MAX_STACK_SIZE'
,
'100'
))
except
:
max_stack_size
=
100
...
...
@@ -115,7 +117,8 @@ class SecurityManager:
self
.
_context
=
context
self
.
_policy
=
None
def
validate
(
self
,
accessed
=
None
,
container
=
None
,
name
=
None
,
value
=
None
):
def
validate
(
self
,
accessed
=
None
,
container
=
None
,
name
=
None
,
value
=
None
,
roles
=
_noroles
):
"""Validate access.
Arguments:
...
...
@@ -127,6 +130,8 @@ class SecurityManager:
name -- The name used to access the value
value -- The value retrieved though the access.
roles -- The roles of the object if already known.
The arguments may be provided as keyword arguments. Some of these
arguments may be ommitted, however, the policy may reject access
...
...
@@ -136,15 +141,15 @@ class SecurityManager:
policy
=
self
.
_policy
if
policy
is
None
:
policy
=
_defaultPolicy
return
policy
.
validate
(
accessed
,
container
,
name
,
value
,
self
.
_context
)
self
.
_context
,
roles
)
def
validateValue
(
self
,
value
):
def
validateValue
(
self
,
value
,
roles
=
_noroles
):
"""Convenience for common case of simple value validation.
"""
policy
=
self
.
_policy
if
policy
is
None
:
policy
=
_defaultPolicy
return
policy
.
validate
(
None
,
None
,
None
,
value
,
self
.
_context
)
self
.
_context
,
roles
)
def
checkPermission
(
self
,
permission
,
object
):
"""Check whether the security context allows the given permission on
...
...
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