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
2bc3fafd
Commit
2bc3fafd
authored
Mar 09, 1998
by
Jim Fulton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rearranged _addRole and _delRole to make sure that all objects
in a permission share the same role data.
parent
4296f24d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
26 deletions
+27
-26
lib/python/AccessControl/Role.py
lib/python/AccessControl/Role.py
+27
-26
No files found.
lib/python/AccessControl/Role.py
View file @
2bc3fafd
"""Access control support"""
__version__
=
'$Revision: 1.1
4
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.1
5
$'
[
11
:
-
2
]
from
Globals
import
HTMLFile
,
MessageDialog
...
...
@@ -234,7 +234,7 @@ Globals.default__class_init__(RoleManager)
ListType
=
type
([])
class
Permission
:
# A Permission maps a named logical permission to a set
...
...
@@ -271,19 +271,23 @@ class Permission:
# subobjects for this permission. To do this, we add
# the given roles to the __roles__ of each attribute
# that this permission represents.
first
=
1
data
=
None
for
name
in
self
.
data
:
if
name
==
''
:
attr
=
self
.
obj
else
:
attr
=
getattr
(
self
.
obj
,
name
)
if
hasattr
(
attr
,
'aq_self'
):
attr
=
attr
.
aq_self
if
hasattr
(
attr
,
'__roles__'
):
data
=
attr
.
__roles__
else
:
data
=
[]
if
data
is
None
:
data
=
[]
data
=
list
(
data
)
for
role
in
roles
:
data
.
append
(
role
)
if
first
:
if
hasattr
(
attr
,
'__roles__'
):
data
=
attr
.
__roles__
if
data
is
None
:
data
=
[]
elif
type
(
data
)
is
not
ListType
:
data
=
list
(
data
)
else
:
data
=
[]
for
role
in
roles
:
data
.
append
(
role
)
first
=
0
attr
.
__roles__
=
data
def
delRoles
(
self
,
roles
):
...
...
@@ -292,28 +296,25 @@ class Permission:
# the given roles from the __roles__ of each attribute
# that this permission represents. If the __roles__ of any
# attribute is thus left empty, it is deleted.
first
=
1
data
=
None
for
name
in
self
.
data
:
if
name
==
''
:
attr
=
self
.
obj
else
:
attr
=
getattr
(
self
.
obj
,
name
)
if
hasattr
(
attr
,
'aq_self'
):
attr
=
attr
.
aq_self
if
not
hasattr
(
attr
,
'__roles__'
):
# return
data
=
[
'Shared'
]
#data=attr.__roles__
else
:
data
=
attr
.
__roles__
if
data
is
None
:
data
=
[]
data
=
list
(
data
)
for
role
in
roles
:
if
role
in
data
:
data
.
remove
(
role
)
if
first
:
if
hasattr
(
attr
,
'__roles__'
):
data
=
attr
.
__roles__
if
data
is
None
:
data
=
[]
elif
type
(
data
)
is
not
ListType
:
data
=
list
(
data
)
else
:
data
=
[
'Shared'
]
for
role
in
roles
:
if
role
in
data
:
data
.
remove
(
role
)
first
=
0
attr
.
__roles__
=
data
#if data: attr.__roles__=data
#else:
# The hasattr above will find __roles__ defined
# in the class, but we wont be able to delete it.
#try: del attr.__roles__
#except: pass
def
__len__
(
self
):
return
1
def
__str__
(
self
):
return
self
.
name
...
...
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