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
f291b685
Commit
f291b685
authored
Sep 08, 2004
by
Andreas Jung
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
using isinstance()
parent
f465428d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
lib/python/AccessControl/User.py
lib/python/AccessControl/User.py
+4
-4
No files found.
lib/python/AccessControl/User.py
View file @
f291b685
...
@@ -14,8 +14,9 @@
...
@@ -14,8 +14,9 @@
__version__
=
'$Revision: 1.182 $'
[
11
:
-
2
]
__version__
=
'$Revision: 1.182 $'
[
11
:
-
2
]
import
Globals
,
socket
,
SpecialUsers
,
re
import
os
import
os
import
Globals
,
socket
,
SpecialUsers
,
re
from
Globals
import
DTMLFile
,
MessageDialog
,
Persistent
,
PersistentMapping
from
Globals
import
DTMLFile
,
MessageDialog
,
Persistent
,
PersistentMapping
from
App.Management
import
Navigation
,
Tabs
from
App.Management
import
Navigation
,
Tabs
from
Acquisition
import
Implicit
from
Acquisition
import
Implicit
...
@@ -31,7 +32,6 @@ from AccessControl.SecurityManagement import newSecurityManager
...
@@ -31,7 +32,6 @@ from AccessControl.SecurityManagement import newSecurityManager
from
AccessControl.SecurityManagement
import
noSecurityManager
from
AccessControl.SecurityManagement
import
noSecurityManager
from
AccessControl.ZopeSecurityPolicy
import
_noroles
from
AccessControl.ZopeSecurityPolicy
import
_noroles
ListType
=
type
([])
_marker
=
[]
_marker
=
[]
...
@@ -248,7 +248,7 @@ class BasicUser(Implicit):
...
@@ -248,7 +248,7 @@ class BasicUser(Implicit):
def
has_role
(
self
,
roles
,
object
=
None
):
def
has_role
(
self
,
roles
,
object
=
None
):
"""Check to see if a user has a given role or roles."""
"""Check to see if a user has a given role or roles."""
if
type
(
roles
)
==
type
(
's'
):
if
isinstance
(
roles
,
str
):
roles
=
[
roles
]
roles
=
[
roles
]
if
object
is
not
None
:
if
object
is
not
None
:
user_roles
=
self
.
getRolesInContext
(
object
)
user_roles
=
self
.
getRolesInContext
(
object
)
...
@@ -263,7 +263,7 @@ class BasicUser(Implicit):
...
@@ -263,7 +263,7 @@ class BasicUser(Implicit):
def
has_permission
(
self
,
permission
,
object
):
def
has_permission
(
self
,
permission
,
object
):
"""Check to see if a user has a given permission on an object."""
"""Check to see if a user has a given permission on an object."""
roles
=
rolesForPermissionOn
(
permission
,
object
)
roles
=
rolesForPermissionOn
(
permission
,
object
)
if
type
(
roles
)
is
type
(
''
):
if
isinstance
(
roles
,
str
):
roles
=
[
roles
]
roles
=
[
roles
]
return
self
.
allowed
(
object
,
roles
)
return
self
.
allowed
(
object
,
roles
)
...
...
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