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
5866524f
Commit
5866524f
authored
Sep 08, 2004
by
Andreas Jung
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
using isinstance()
parent
f291b685
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
12 deletions
+10
-12
lib/python/AccessControl/Owned.py
lib/python/AccessControl/Owned.py
+2
-3
lib/python/AccessControl/Permission.py
lib/python/AccessControl/Permission.py
+4
-4
lib/python/AccessControl/Role.py
lib/python/AccessControl/Role.py
+3
-4
lib/python/AccessControl/SecurityInfo.py
lib/python/AccessControl/SecurityInfo.py
+1
-1
No files found.
lib/python/AccessControl/Owned.py
View file @
5866524f
...
...
@@ -275,8 +275,7 @@ def absattr(attr):
if
callable
(
attr
):
return
attr
()
return
attr
def
ownerInfo
(
user
,
getattr
=
getattr
,
type
=
type
,
st
=
type
(
''
)):
def
ownerInfo
(
user
,
getattr
=
getattr
):
if
user
is
None
:
return
None
uid
=
user
.
getId
()
...
...
@@ -290,7 +289,7 @@ def ownerInfo(user,
db
=
db
.
aq_parent
if
db
is
root
:
break
id
=
db
.
id
if
type
(
id
)
is
not
st
:
if
not
isinstance
(
id
,
str
)
:
try
:
id
=
id
()
except
:
id
=
str
(
id
)
path
.
append
(
id
)
...
...
lib/python/AccessControl/Permission.py
View file @
5866524f
...
...
@@ -14,9 +14,9 @@
$Id$
"""
import
string
,
Products
,
Globals
ListType
=
type
([])
name_trans
=
filter
(
lambda
c
,
an
=
string
.
letters
+
string
.
digits
+
'_'
:
c
not
in
an
,
map
(
chr
,
range
(
256
)))
...
...
@@ -83,7 +83,7 @@ class Permission:
def
setRoles
(
self
,
roles
):
obj
=
self
.
obj
if
type
(
roles
)
is
ListType
and
not
roles
:
if
isinstance
(
roles
,
list
)
and
not
roles
:
if
hasattr
(
obj
,
self
.
_p
):
delattr
(
obj
,
self
.
_p
)
else
:
setattr
(
obj
,
self
.
_p
,
roles
)
...
...
@@ -100,14 +100,14 @@ class Permission:
roles
=
self
.
getRoles
()
if
role
in
roles
:
if
present
:
return
if
type
(
roles
)
is
ListType
:
roles
.
remove
(
role
)
if
isinstance
(
roles
,
list
)
:
roles
.
remove
(
role
)
else
:
roles
=
list
(
roles
)
roles
.
remove
(
role
)
roles
=
tuple
(
roles
)
elif
not
present
:
return
else
:
if
type
(
roles
)
is
ListType
:
roles
.
append
(
role
)
if
isinstance
(
roles
,
list
)
:
roles
.
append
(
role
)
else
:
roles
=
roles
+
(
role
,)
self
.
setRoles
(
roles
)
...
...
lib/python/AccessControl/Role.py
View file @
5866524f
...
...
@@ -21,7 +21,6 @@ from Permission import Permission
from
App.Common
import
aq_base
from
cgi
import
escape
ListType
=
type
([])
DEFAULTMAXLISTUSERS
=
250
...
...
@@ -109,7 +108,7 @@ class RoleManager(ExtensionClass.Base, PermissionMapping.RoleManager):
p
=
Permission
(
name
,
value
,
self
)
roles
=
p
.
getRoles
(
default
=
[])
d
=
{
'name'
:
name
,
'acquire'
:
type
(
roles
)
is
ListType
and
'CHECKED'
or
''
,
'acquire'
:
isinstance
(
roles
,
list
)
and
'CHECKED'
or
''
,
'roles'
:
map
(
lambda
ir
,
roles
=
roles
,
valid
=
valid
,
ip
=
ip
:
{
...
...
@@ -262,7 +261,7 @@ class RoleManager(ExtensionClass.Base, PermissionMapping.RoleManager):
if
name
==
permission
:
p
=
Permission
(
name
,
value
,
self
)
roles
=
p
.
getRoles
()
return
type
(
roles
)
is
ListType
and
'CHECKED'
or
''
return
isinstance
(
roles
,
list
)
and
'CHECKED'
or
''
raise
ValueError
,
(
"The permission <em>%s</em> is invalid."
%
escape
(
permission
))
...
...
@@ -317,7 +316,7 @@ class RoleManager(ExtensionClass.Base, PermissionMapping.RoleManager):
aclu
=
getattr
(
aq_base
(
item
),
'__allow_groups__'
,
_notfound
)
if
aclu
is
not
_notfound
:
mlu
=
getattr
(
aclu
,
'maxlistusers'
,
_notfound
)
if
type
(
mlu
)
!=
type
(
1
):
mlu
=
DEFAULTMAXLISTUSERS
if
not
isinstance
(
mlu
,
int
):
mlu
=
DEFAULTMAXLISTUSERS
if
mlu
<
0
:
raise
OverflowError
un
=
getattr
(
aclu
,
'user_names'
,
_notfound
)
if
un
is
not
_notfound
:
...
...
lib/python/AccessControl/SecurityInfo.py
View file @
5866524f
...
...
@@ -126,7 +126,7 @@ class SecurityInfo(Acquisition.Implicit):
This should be a boolean value, a map of attribute names to
booleans, or a callable (name, value) -> boolean.
"""
if
type
(
access
)
==
type
(
''
):
if
isinstance
(
access
,
str
):
access
=
access
.
lower
()
if
access
==
'allow'
:
access
=
1
...
...
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