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
96c5843c
Commit
96c5843c
authored
May 08, 1998
by
Jim Fulton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rearranged permission user interface machinery, alot.
parent
f9f9dbc0
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
141 additions
and
231 deletions
+141
-231
lib/python/AccessControl/Role.py
lib/python/AccessControl/Role.py
+124
-196
lib/python/AccessControl/User.py
lib/python/AccessControl/User.py
+17
-35
No files found.
lib/python/AccessControl/Role.py
View file @
96c5843c
This diff is collapsed.
Click to expand it.
lib/python/AccessControl/User.py
View file @
96c5843c
"""Access control package"""
__version__
=
'$Revision: 1.4
6
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.4
7
$'
[
11
:
-
2
]
from
PersistentMapping
import
PersistentMapping
...
...
@@ -25,30 +25,18 @@ class User(Implicit, Persistent):
return
password
==
self
.
__
def
allowed
(
self
,
parent
,
roles
=
None
):
obj
=
parent
obj_roles
=
roles
usr_roles
=
self
.
roles
while
1
:
if
(
obj_roles
is
None
)
or
(
'Anonymous'
in
obj_roles
):
return
1
for
role
in
obj_roles
:
if
role
in
usr_roles
:
return
1
if
'Shared'
in
obj_roles
:
if
obj
is
None
:
return
0
if
hasattr
(
obj
,
'__roles__'
):
obj_roles
=
obj
.
__roles__
else
:
obj_roles
=
[
'Shared'
,]
if
hasattr
(
obj
,
'aq_parent'
):
obj
=
obj
.
aq_parent
elif
hasattr
(
obj
,
'im_self'
):
obj
=
obj
.
im_self
else
:
obj
=
None
continue
return
0
if
roles
is
None
or
'Anonymous'
in
roles
:
return
1
for
role
in
roles
:
if
role
in
usr_roles
:
if
(
hasattr
(
self
,
'aq_parent'
)
and
hasattr
(
self
.
aq_parent
,
'aq_parent'
)):
if
not
parent
.
aq_inContextOf
(
self
.
aq_parent
.
aq_parent
,
1
):
return
None
return
1
return
None
hasRole
=
allowed
...
...
@@ -86,7 +74,6 @@ nobody=User('Anonymous User','',('Anonymous',))
class
UserFolder
(
Implicit
,
Persistent
,
Navigation
,
Tabs
,
RoleManager
,
Item
,
App
.
Undo
.
UndoSupport
):
""" """
__roles__
=
[
'Manager'
,
'Shared'
]
meta_type
=
'User Folder'
id
=
'acl_users'
...
...
@@ -110,7 +97,6 @@ class UserFolder(Implicit, Persistent, Navigation, Tabs, RoleManager,
(
'Undo changes'
,
[
'manage_undo_transactions'
]),
(
'Change permissions'
,
[
'manage_access'
]),
(
'Manage users'
,
[
'manage_users'
]),
(
'Shared permission'
,
[
''
]),
)
...
...
@@ -157,6 +143,9 @@ class UserFolder(Implicit, Persistent, Navigation, Tabs, RoleManager,
if
not
user
.
authenticate
(
password
):
return
None
# We need the user to be able to acquire!
user
=
user
.
__of__
(
self
)
# Try to authorize user
if
user
.
hasRole
(
parent
,
roles
):
return
user
...
...
@@ -187,11 +176,6 @@ class UserFolder(Implicit, Persistent, Navigation, Tabs, RoleManager,
message
=
'Password and confirmation do not match'
,
action
=
'manage_main'
)
if
not
roles
:
roles
=
[]
if
'Shared'
in
roles
:
return
MessageDialog
(
title
=
'Illegal value'
,
message
=
'Shared is not a legal role name'
,
action
=
'manage_main'
)
self
.
data
[
name
]
=
User
(
name
,
password
,
roles
)
if
REQUEST
:
return
self
.
_mainUser
(
self
,
REQUEST
)
...
...
@@ -212,11 +196,6 @@ class UserFolder(Implicit, Persistent, Navigation, Tabs, RoleManager,
message
=
'Password and confirmation do not match'
,
action
=
'manage_main'
)
if
not
roles
:
roles
=
[]
if
'Shared'
in
roles
:
return
MessageDialog
(
title
=
'Illegal value'
,
message
=
'Shared is not a legal role name'
,
action
=
'manage_main'
)
user
=
self
.
data
[
name
]
user
.
__
=
password
user
.
roles
=
roles
...
...
@@ -312,6 +291,9 @@ if _remote_user_mode:
try
:
user
=
self
.
data
[
name
]
except
:
return
None
# We need the user to be able to acquire!
user
=
user
.
__of__
(
self
)
# Try to authorize user
if
user
.
hasRole
(
parent
,
roles
):
return
user
...
...
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