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
b6c7f455
Commit
b6c7f455
authored
Dec 13, 2001
by
Andreas Jung
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
merge from 2.5 branch (string methods)
parent
5590459c
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
33 additions
and
37 deletions
+33
-37
lib/python/AccessControl/AuthEncoding.py
lib/python/AccessControl/AuthEncoding.py
+1
-2
lib/python/AccessControl/Owned.py
lib/python/AccessControl/Owned.py
+4
-4
lib/python/AccessControl/Permission.py
lib/python/AccessControl/Permission.py
+3
-3
lib/python/AccessControl/PermissionMapping.py
lib/python/AccessControl/PermissionMapping.py
+1
-1
lib/python/AccessControl/PermissionRole.py
lib/python/AccessControl/PermissionRole.py
+3
-3
lib/python/AccessControl/Role.py
lib/python/AccessControl/Role.py
+4
-5
lib/python/AccessControl/SecurityInfo.py
lib/python/AccessControl/SecurityInfo.py
+1
-2
lib/python/AccessControl/SecurityManager.py
lib/python/AccessControl/SecurityManager.py
+4
-4
lib/python/AccessControl/User.py
lib/python/AccessControl/User.py
+9
-10
lib/python/AccessControl/ZopeSecurityPolicy.py
lib/python/AccessControl/ZopeSecurityPolicy.py
+3
-3
No files found.
lib/python/AccessControl/AuthEncoding.py
View file @
b6c7f455
...
...
@@ -11,11 +11,10 @@
#
##############################################################################
__version__
=
'$Revision: 1.
5
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.
6
$'
[
11
:
-
2
]
import
sha
,
binascii
from
binascii
import
b2a_base64
,
a2b_base64
from
string
import
upper
from
random
import
choice
,
randrange
...
...
lib/python/AccessControl/Owned.py
View file @
b6c7f455
...
...
@@ -13,10 +13,10 @@
__doc__
=
'''Support for owned objects
$Id: Owned.py,v 1.1
4 2001/11/28 15:50:51 matt
Exp $'''
__version__
=
'$Revision: 1.1
4
$'
[
11
:
-
2
]
$Id: Owned.py,v 1.1
5 2001/12/13 14:24:02 andreasjung
Exp $'''
__version__
=
'$Revision: 1.1
5
$'
[
11
:
-
2
]
import
Globals
,
urlparse
,
SpecialUsers
,
ExtensionClass
,
string
import
Globals
,
urlparse
,
SpecialUsers
,
ExtensionClass
from
AccessControl
import
getSecurityManager
,
Unauthorized
from
Acquisition
import
aq_get
,
aq_parent
,
aq_base
...
...
@@ -54,7 +54,7 @@ class Owned(ExtensionClass.Base):
"""
owner
=
self
.
getOwner
(
1
)
if
owner
is
None
or
owner
is
UnownableOwner
:
return
owner
d
=
{
'path'
:
string
.
join
(
owner
[
0
],
'/'
),
'id'
:
owner
[
1
],
d
=
{
'path'
:
'/'
.
join
(
owner
[
0
]
),
'id'
:
owner
[
1
],
'explicit'
:
hasattr
(
self
,
'_owner'
),
'userCanChangeOwnershipType'
:
getSecurityManager
().
checkPermission
(
'Take ownership'
,
self
)
...
...
lib/python/AccessControl/Permission.py
View file @
b6c7f455
...
...
@@ -13,8 +13,8 @@
__doc__
=
'''short description
$Id: Permission.py,v 1.
8 2001/11/28 15:50:51 matt
Exp $'''
__version__
=
'$Revision: 1.
8
$'
[
11
:
-
2
]
$Id: Permission.py,v 1.
9 2001/12/13 14:24:26 andreasjung
Exp $'''
__version__
=
'$Revision: 1.
9
$'
[
11
:
-
2
]
import
string
,
Products
,
Globals
...
...
@@ -22,7 +22,7 @@ ListType=type([])
name_trans
=
filter
(
lambda
c
,
an
=
string
.
letters
+
string
.
digits
+
'_'
:
c
not
in
an
,
map
(
chr
,
range
(
256
)))
name_trans
=
string
.
maketrans
(
string
.
join
(
name_trans
,
''
),
'_'
*
len
(
name_trans
))
name_trans
=
string
.
maketrans
(
''
.
join
(
name_trans
),
'_'
*
len
(
name_trans
))
def
pname
(
name
,
translate
=
string
.
translate
,
name_trans
=
name_trans
):
return
'_'
+
translate
(
name
,
name_trans
)
+
"_Permission"
...
...
lib/python/AccessControl/PermissionMapping.py
View file @
b6c7f455
...
...
@@ -117,7 +117,7 @@ class PM(ExtensionClass.Base):
def
__getattr__
(
self
,
name
):
# We want to make sure that any non-explicitly set methods are
# private!
if
name
[:
1
]
==
'_'
and
name
[
-
11
:]
==
"_Permission"
:
return
''
if
name
.
startswith
(
'_'
)
and
name
.
endswith
(
"_Permission"
)
:
return
''
raise
AttributeError
,
name
PermissionMapper
=
PM
...
...
lib/python/AccessControl/PermissionRole.py
View file @
b6c7f455
...
...
@@ -13,8 +13,8 @@
__doc__
=
'''Objects that implement Permission-based roles.
$Id: PermissionRole.py,v 1.1
4 2001/11/28 15:50:51 matt
Exp $'''
__version__
=
'$Revision: 1.1
4
$'
[
11
:
-
2
]
$Id: PermissionRole.py,v 1.1
5 2001/12/13 14:24:41 andreasjung
Exp $'''
__version__
=
'$Revision: 1.1
5
$'
[
11
:
-
2
]
_use_python_impl
=
0
import
os
...
...
@@ -40,7 +40,7 @@ if _use_python_impl:
name_trans
=
filter
(
lambda
c
,
an
=
string
.
letters
+
string
.
digits
+
'_'
:
c
not
in
an
,
map
(
chr
,
range
(
256
)))
name_trans
=
string
.
maketrans
(
string
.
join
(
name_trans
,
''
),
'_'
*
len
(
name_trans
))
name_trans
=
string
.
maketrans
(
''
.
join
(
name_trans
),
'_'
*
len
(
name_trans
))
def
rolesForPermissionOn
(
perm
,
object
,
default
=
(
'Manager'
,)):
"""Return the roles that have the given permission on the given object
...
...
lib/python/AccessControl/Role.py
View file @
b6c7f455
...
...
@@ -12,11 +12,10 @@
##############################################################################
"""Access control support"""
__version__
=
'$Revision: 1.5
2
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.5
3
$'
[
11
:
-
2
]
from
Globals
import
DTMLFile
,
MessageDialog
,
Dictionary
from
string
import
join
,
strip
,
split
,
find
from
Acquisition
import
Implicit
,
Acquired
,
aq_get
import
Globals
,
ExtensionClass
,
PermissionMapping
,
Products
from
Permission
import
Permission
...
...
@@ -209,7 +208,7 @@ class RoleManager(ExtensionClass.Base, PermissionMapping.RoleManager):
if
fails
:
return
MessageDialog
(
title
=
"Warning!"
,
message
=
"Some permissions had errors: "
+
join
(
fails
,
', '
),
+
', '
.
join
(
fails
),
action
=
'manage_access'
)
return
MessageDialog
(
title
=
'Success!'
,
...
...
@@ -380,13 +379,13 @@ class RoleManager(ExtensionClass.Base, PermissionMapping.RoleManager):
data
=
[]
_add
=
data
.
append
for
key
,
value
in
inst
.
items
():
if
find
(
key
,
'__roles__'
)
>=
0
:
if
key
.
find
(
'__roles__'
)
>=
0
:
_add
({
'name'
:
key
,
'value'
:
value
,
'class'
:
0
})
if
hasattr
(
value
,
'__roles__'
):
_add
({
'name'
:
'%s.__roles__'
%
key
,
'value'
:
value
.
__roles__
,
'class'
:
0
})
for
key
,
value
in
clas
.
items
():
if
find
(
key
,
'__roles__'
)
>=
0
:
if
key
.
find
(
'__roles__'
)
>=
0
:
_add
({
'name'
:
key
,
'value'
:
value
,
'class'
:
1
})
if
hasattr
(
value
,
'__roles__'
):
_add
({
'name'
:
'%s.__roles__'
%
key
,
'value'
:
value
.
__roles__
,
...
...
lib/python/AccessControl/SecurityInfo.py
View file @
b6c7f455
...
...
@@ -42,7 +42,6 @@ __version__='$Revision$'[11:-2]
import
Acquisition
,
PermissionRole
,
sys
from
string
import
lower
from
zLOG
import
LOG
,
WARNING
...
...
@@ -127,7 +126,7 @@ class SecurityInfo(Acquisition.Implicit):
booleans, or a callable (name, value) -> boolean.
"""
if
type
(
access
)
==
type
(
''
):
access
=
lower
(
access
)
access
=
access
.
lower
(
)
if
access
==
'allow'
:
access
=
1
elif
access
==
'deny'
:
...
...
lib/python/AccessControl/SecurityManager.py
View file @
b6c7f455
...
...
@@ -13,14 +13,14 @@
__doc__
=
'''short description
$Id: SecurityManager.py,v 1.1
1 2001/11/28 15:50:51 matt
Exp $'''
__version__
=
'$Revision: 1.1
1
$'
[
11
:
-
2
]
$Id: SecurityManager.py,v 1.1
2 2001/12/13 14:23:44 andreasjung
Exp $'''
__version__
=
'$Revision: 1.1
2
$'
[
11
:
-
2
]
import
ZopeSecurityPolicy
,
os
,
string
import
ZopeSecurityPolicy
,
os
_noroles
=
ZopeSecurityPolicy
.
_noroles
try
:
max_stack_size
=
string
.
atoi
(
os
.
environ
.
get
(
'Z_MAX_STACK_SIZE'
,
'100'
))
try
:
max_stack_size
=
int
(
os
.
environ
.
get
(
'Z_MAX_STACK_SIZE'
,
'100'
))
except
:
max_stack_size
=
100
if
os
.
environ
.
has_key
(
"ZSP_OWNEROUS_SKIP"
):
ownerous
=
0
...
...
lib/python/AccessControl/User.py
View file @
b6c7f455
...
...
@@ -12,12 +12,11 @@
##############################################################################
"""Access control package"""
__version__
=
'$Revision: 1.16
5
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.16
6
$'
[
11
:
-
2
]
import
Globals
,
socket
,
SpecialUsers
,
re
import
os
from
Globals
import
DTMLFile
,
MessageDialog
,
Persistent
,
PersistentMapping
from
string
import
join
,
strip
,
split
,
lower
,
upper
from
App.Management
import
Navigation
,
Tabs
from
Acquisition
import
Implicit
from
OFS.SimpleItem
import
Item
...
...
@@ -399,9 +398,9 @@ def readUserAccessFile(filename):
return
None
if
line
:
data
=
split
(
strip
(
line
),
':'
)
data
=
line
.
strip
().
split
(
':'
)
remote_user_mode
=
not
data
[
1
]
try
:
ds
=
split
(
data
[
2
],
' '
)
try
:
ds
=
data
[
2
].
split
(
' '
)
except
:
ds
=
[]
return
data
[
0
],
data
[
1
],
ds
,
remote_user_mode
else
:
...
...
@@ -558,9 +557,9 @@ class BasicUserFolder(Implicit, Persistent, Navigation, Tabs, RoleManager,
def
identify
(
self
,
auth
):
if
auth
and
lower
(
auth
[:
6
])
==
'basic '
:
try
:
name
,
password
=
tuple
(
split
(
decodestring
(
split
(
auth
)[
-
1
]),
':'
,
1
))
if
auth
and
auth
.
lower
().
startswith
(
'basic '
)
:
try
:
name
,
password
=
tuple
(
decodestring
(
auth
.
split
(
' '
)[
-
1
]).
split
(
':'
,
1
))
except
:
raise
'Bad Request'
,
'Invalid authentication token'
return
name
,
password
...
...
@@ -1125,14 +1124,14 @@ def domainSpecMatch(spec, request):
except: pass
_host=
split(host,
'
.
')
_addr=
split(addr,
'
.
')
_host=
host.split(
'
.
')
_addr=
addr.split(
'
.
')
_hlen=len(_host)
_alen=len(_addr)
for ob in spec:
sz=len(ob)
_ob=
split(ob,
'
.
')
_ob=
ob.split(
'
.
')
_sz=len(_ob)
mo = addr_match(ob)
...
...
lib/python/AccessControl/ZopeSecurityPolicy.py
View file @
b6c7f455
...
...
@@ -13,8 +13,8 @@
__doc__
=
'''Define Zope
\
'
s default security policy
$Id: ZopeSecurityPolicy.py,v 1.1
6 2001/11/28 15:50:52 matt
Exp $'''
__version__
=
'$Revision: 1.1
6
$'
[
11
:
-
2
]
$Id: ZopeSecurityPolicy.py,v 1.1
7 2001/12/13 14:25:19 andreasjung
Exp $'''
__version__
=
'$Revision: 1.1
7
$'
[
11
:
-
2
]
_use_python_impl
=
0
...
...
@@ -85,7 +85,7 @@ if _use_python_impl:
############################################################
# Provide special rules for the acquisition attributes
if
type
(
name
)
is
StringType
:
if
name
[:
3
]
==
'aq_'
and
name
not
in
valid_aq_
:
if
name
.
startswith
(
'aq_'
)
and
name
not
in
valid_aq_
:
return
0
containerbase
=
aq_base
(
container
)
...
...
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