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
51d780c9
Commit
51d780c9
authored
May 11, 2016
by
Georg Gogo. BERNHARD
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixing permission handling by using hashed names instead of columns and rows (#59)
parent
5b6a9672
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
5 deletions
+10
-5
src/OFS/dtml/access.dtml
src/OFS/dtml/access.dtml
+1
-1
src/OFS/role.py
src/OFS/role.py
+9
-4
No files found.
src/OFS/dtml/access.dtml
View file @
51d780c9
...
...
@@ -81,7 +81,7 @@ a permission in addition to selecting to acquire permissions.
<dtml-unless isTopLevelPrincipiaApplicationObject>
<td align="left" valign="top">
<input type="checkbox" name="a
&dtml-sequence-index
;" &dtml-acquire; />
<input type="checkbox" name="a
cquire_&dtml-hashed_name
;" &dtml-acquire; />
</td>
</dtml-unless>
<td align="left" nowrap>
...
...
src/OFS/role.py
View file @
51d780c9
...
...
@@ -25,6 +25,7 @@ from AccessControl.rolemanager import reqattr
from
AccessControl.Permission
import
Permission
from
AccessControl.Permissions
import
change_permissions
from
AccessControl.requestmethod
import
requestmethod
from
AccessControl.rolemanager
import
_string_hash
class
RoleManager
(
BaseRoleManager
):
...
...
@@ -104,14 +105,18 @@ class RoleManager(BaseRoleManager):
permissions
=
self
.
ac_inherited_permissions
(
1
)
fails
=
[]
for
ip
in
range
(
len
(
permissions
)):
permission_name
=
permissions
[
ip
][
0
]
permission_hash
=
_string_hash
(
permission_name
)
roles
=
[]
for
ir
in
indexes
:
if
have
(
"p%dr%d"
%
(
ip
,
ir
)):
roles
.
append
(
valid_roles
[
ir
])
for
role
in
valid_roles
:
role_name
=
role
role_hash
=
_string_hash
(
role_name
)
if
have
(
"permission_%srole_%s"
%
(
permission_hash
,
role_hash
)):
roles
.
append
(
role
)
name
,
value
=
permissions
[
ip
][:
2
]
try
:
p
=
Permission
(
name
,
value
,
self
)
if
not
have
(
'a
%d'
%
ip
):
if
not
have
(
'a
cquire_%s'
%
permission_hash
):
roles
=
tuple
(
roles
)
p
.
setRoles
(
roles
)
except
:
...
...
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