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
9d44f7aa
Commit
9d44f7aa
authored
Apr 01, 1998
by
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added has_role method, changed hasRole to allowed, leaving hasRole as an alias.
parent
53db5d28
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
2 deletions
+13
-2
lib/python/AccessControl/User.py
lib/python/AccessControl/User.py
+13
-2
No files found.
lib/python/AccessControl/User.py
View file @
9d44f7aa
"""Access control package"""
__version__
=
'$Revision: 1.4
3
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.4
4
$'
[
11
:
-
2
]
from
PersistentMapping
import
PersistentMapping
...
...
@@ -24,7 +24,7 @@ class User(Implicit, Persistent):
def
authenticate
(
self
,
password
):
return
password
==
self
.
__
def
hasRole
(
self
,
parent
,
roles
=
None
):
def
allowed
(
self
,
parent
,
roles
=
None
):
obj
=
parent
obj_roles
=
roles
usr_roles
=
self
.
roles
...
...
@@ -48,6 +48,17 @@ class User(Implicit, Persistent):
continue
return
0
hasRole
=
allowed
def
has_role
(
self
,
roles
):
if
type
(
roles
)
==
type
(
's'
):
roles
=
[
roles
]
user_roles
=
self
.
roles
for
role
in
roles
:
if
role
in
user_roles
:
return
1
return
0
def
__len__
(
self
):
return
1
def
__str__
(
self
):
return
self
.
name
__repr__
=
__str__
...
...
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