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
eae39718
Commit
eae39718
authored
May 08, 1998
by
Jim Fulton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Waaaaa, added code to deal with "Shared" roles.
parent
0612b700
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
1 deletion
+31
-1
lib/python/AccessControl/User.py
lib/python/AccessControl/User.py
+31
-1
No files found.
lib/python/AccessControl/User.py
View file @
eae39718
"""Access control package"""
"""Access control package"""
__version__
=
'$Revision: 1.4
7
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.4
8
$'
[
11
:
-
2
]
from
PersistentMapping
import
PersistentMapping
from
PersistentMapping
import
PersistentMapping
...
@@ -15,6 +15,8 @@ from ImageFile import ImageFile
...
@@ -15,6 +15,8 @@ from ImageFile import ImageFile
from
Role
import
RoleManager
from
Role
import
RoleManager
import
Globals
,
App
.
Undo
import
Globals
,
App
.
Undo
ListType
=
type
([])
class
User
(
Implicit
,
Persistent
):
class
User
(
Implicit
,
Persistent
):
def
__init__
(
self
,
name
,
password
,
roles
):
def
__init__
(
self
,
name
,
password
,
roles
):
self
.
name
=
name
self
.
name
=
name
...
@@ -24,6 +26,24 @@ class User(Implicit, Persistent):
...
@@ -24,6 +26,24 @@ class User(Implicit, Persistent):
def
authenticate
(
self
,
password
):
def
authenticate
(
self
,
password
):
return
password
==
self
.
__
return
password
==
self
.
__
def
_shared_roles
(
self
,
parent
):
r
=
[]
while
1
:
if
hasattr
(
parent
,
'aq_parent'
):
while
hasattr
(
parent
.
aq_self
,
'aq_self'
):
parent
=
parent
.
aq_self
parent
=
parent
.
aq_parent
else
:
return
r
roles
=
parent
.
__roles__
if
roles
is
None
:
return
'Anonymous'
,
if
'Shared'
in
roles
:
roles
=
list
(
roles
)
roles
.
remove
(
'Shared'
)
r
=
r
+
roles
else
:
try
:
return
r
+
list
(
roles
)
except
:
return
r
def
allowed
(
self
,
parent
,
roles
=
None
):
def
allowed
(
self
,
parent
,
roles
=
None
):
usr_roles
=
self
.
roles
usr_roles
=
self
.
roles
...
@@ -34,8 +54,18 @@ class User(Implicit, Persistent):
...
@@ -34,8 +54,18 @@ class User(Implicit, Persistent):
if
(
hasattr
(
self
,
'aq_parent'
)
and
if
(
hasattr
(
self
,
'aq_parent'
)
and
hasattr
(
self
.
aq_parent
,
'aq_parent'
)):
hasattr
(
self
.
aq_parent
,
'aq_parent'
)):
if
not
parent
.
aq_inContextOf
(
self
.
aq_parent
.
aq_parent
,
1
):
if
not
parent
.
aq_inContextOf
(
self
.
aq_parent
.
aq_parent
,
1
):
if
'Shared'
in
roles
:
# Damn, old role setting. Waaa
roles
=
self
.
_shared_roles
(
parent
)
if
'Anonymous'
in
roles
:
return
1
return
None
return
None
return
1
return
1
if
'Shared'
in
roles
:
# Damn, old role setting. Waaa
roles
=
self
.
_shared_roles
(
parent
)
if
'Anonymous'
in
roles
:
return
1
return
None
return
None
hasRole
=
allowed
hasRole
=
allowed
...
...
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