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
cf1b13a8
Commit
cf1b13a8
authored
Nov 05, 2005
by
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- converted interface to z3 interface.
parent
b446f040
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
61 additions
and
49 deletions
+61
-49
lib/python/AccessControl/IUserFolder.py
lib/python/AccessControl/IUserFolder.py
+0
-18
lib/python/AccessControl/User.py
lib/python/AccessControl/User.py
+26
-21
lib/python/AccessControl/interfaces.py
lib/python/AccessControl/interfaces.py
+17
-0
lib/python/AccessControl/tests/testUserFolder.py
lib/python/AccessControl/tests/testUserFolder.py
+18
-10
No files found.
lib/python/AccessControl/IUserFolder.py
deleted
100644 → 0
View file @
b446f040
class
IStandardUserFolder
:
def
getUser
(
self
,
name
):
"""
Returns the user object specified by name. If there is no
user named 'name' in the user folder, return None.
"""
def
getUsers
(
self
):
"""
Returns a sequence of all user objects which reside in the user
folder.
"""
def
getUserNames
(
self
):
"""
Returns a sequence of names of the users which reside in the user
folder.
"""
lib/python/AccessControl/User.py
View file @
cf1b13a8
...
@@ -7,30 +7,36 @@
...
@@ -7,30 +7,36 @@
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
# FOR A PARTICULAR PURPOSE
.
#
#
##############################################################################
##############################################################################
"""Access control package
"""
"""Access control package
.
__version__
=
'$Revision: 1.182 $'
[
11
:
-
2
]
$Id$
"""
import
os
import
os
import
re
import
socket
from
base64
import
decodestring
import
Globals
,
socket
,
SpecialUsers
,
re
import
Globals
from
Globals
import
DTMLFile
,
MessageDialog
,
Persistent
,
PersistentMapping
from
App.Management
import
Navigation
,
Tabs
from
Acquisition
import
Implicit
from
Acquisition
import
Implicit
from
App.Management
import
Navigation
,
Tabs
from
Globals
import
DTMLFile
,
MessageDialog
,
Persistent
,
PersistentMapping
from
OFS.SimpleItem
import
Item
from
OFS.SimpleItem
import
Item
from
base64
import
decodestring
from
App.ImageFile
import
ImageFile
from
Role
import
RoleManager
,
DEFAULTMAXLISTUSERS
from
PermissionRole
import
_what_not_even_god_should_do
,
rolesForPermissionOn
import
AuthEncoding
from
AccessControl
import
getSecurityManager
from
zExceptions
import
Unauthorized
,
BadRequest
from
zExceptions
import
Unauthorized
,
BadRequest
from
AccessControl.SecurityManagement
import
newSecurityManager
from
zope.interface
import
implements
from
AccessControl.SecurityManagement
import
noSecurityManager
from
AccessControl.ZopeSecurityPolicy
import
_noroles
import
AuthEncoding
import
SpecialUsers
from
interfaces
import
IStandardUserFolder
from
PermissionRole
import
_what_not_even_god_should_do
,
rolesForPermissionOn
from
Role
import
RoleManager
,
DEFAULTMAXLISTUSERS
from
SecurityManagement
import
getSecurityManager
from
SecurityManagement
import
newSecurityManager
from
SecurityManagement
import
noSecurityManager
from
ZopeSecurityPolicy
import
_noroles
_marker
=
[]
_marker
=
[]
...
@@ -978,7 +984,7 @@ class BasicUserFolder(Implicit, Persistent, Navigation, Tabs, RoleManager,
...
@@ -978,7 +984,7 @@ class BasicUserFolder(Implicit, Persistent, Navigation, Tabs, RoleManager,
def
_setId
(
self
,
id
):
def
_setId
(
self
,
id
):
if
id
!=
self
.
id
:
if
id
!=
self
.
id
:
raise
Globals
.
MessageDialog
(
raise
MessageDialog
(
title
=
'Invalid Id'
,
title
=
'Invalid Id'
,
message
=
'Cannot change the id of a UserFolder'
,
message
=
'Cannot change the id of a UserFolder'
,
action
=
'./manage_main'
,)
action
=
'./manage_main'
,)
...
@@ -1001,7 +1007,9 @@ class BasicUserFolder(Implicit, Persistent, Navigation, Tabs, RoleManager,
...
@@ -1001,7 +1007,9 @@ class BasicUserFolder(Implicit, Persistent, Navigation, Tabs, RoleManager,
""" returns true if domain auth mode is set to true"""
""" returns true if domain auth mode is set to true"""
return
getattr
(
self
,
'_domain_auth_mode'
,
None
)
return
getattr
(
self
,
'_domain_auth_mode'
,
None
)
class
UserFolder
(
BasicUserFolder
):
class
UserFolder
(
BasicUserFolder
):
"""Standard UserFolder object
"""Standard UserFolder object
A UserFolder holds User objects which contain information
A UserFolder holds User objects which contain information
...
@@ -1009,6 +1017,8 @@ class UserFolder(BasicUserFolder):
...
@@ -1009,6 +1017,8 @@ class UserFolder(BasicUserFolder):
UserFolders function chiefly to control access by authenticating
UserFolders function chiefly to control access by authenticating
users and binding them to a collection of roles."""
users and binding them to a collection of roles."""
implements
(
IStandardUserFolder
)
meta_type
=
'User Folder'
meta_type
=
'User Folder'
id
=
'acl_users'
id
=
'acl_users'
title
=
'User Folder'
title
=
'User Folder'
...
@@ -1090,10 +1100,6 @@ class UserFolder(BasicUserFolder):
...
@@ -1090,10 +1100,6 @@ class UserFolder(BasicUserFolder):
Globals
.
default__class_init__
(
UserFolder
)
Globals
.
default__class_init__
(
UserFolder
)
def
manage_addUserFolder
(
self
,
dtself
=
None
,
REQUEST
=
None
,
**
ignored
):
def
manage_addUserFolder
(
self
,
dtself
=
None
,
REQUEST
=
None
,
**
ignored
):
""" """
""" """
f
=
UserFolder
()
f
=
UserFolder
()
...
@@ -1122,7 +1128,6 @@ addr_match=re.compile(r'((\d{1,3}\.){1,3}\*)|((\d{1,3}\.){3}\d{1,3})').match
...
@@ -1122,7 +1128,6 @@ addr_match=re.compile(r'((\d{1,3}\.){1,3}\*)|((\d{1,3}\.){3}\d{1,3})').match
host_match
=
re
.
compile
(
r'(([\
_
0-9a-zA-Z\
-]*
\.)*[0-9a-zA-Z\
-]*)
').match
host_match
=
re
.
compile
(
r'(([\
_
0-9a-zA-Z\
-]*
\.)*[0-9a-zA-Z\
-]*)
').match
def domainSpecMatch(spec, request):
def domainSpecMatch(spec, request):
host=''
host=''
addr=''
addr=''
...
...
lib/python/AccessControl/interfaces.py
View file @
cf1b13a8
...
@@ -263,3 +263,20 @@ class IRoleManager(IPermissionMappingSupport):
...
@@ -263,3 +263,20 @@ class IRoleManager(IPermissionMappingSupport):
def
possible_permissions
():
def
possible_permissions
():
"""
"""
"""
"""
class
IStandardUserFolder
(
Interface
):
def
getUser
(
name
):
"""Get the user object specified by name.
If there is no user named 'name' in the user folder, return None.
"""
def
getUsers
():
"""Get a sequence of all user objects which reside in the user folder.
"""
def
getUserNames
():
"""Get a sequence of names of the users which reside in the user folder.
"""
lib/python/AccessControl/tests/testUserFolder.py
View file @
cf1b13a8
...
@@ -7,23 +7,23 @@
...
@@ -7,23 +7,23 @@
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
# FOR A PARTICULAR PURPOSE
.
#
#
##############################################################################
##############################################################################
"""User folder tests
"""User folder tests.
"""
__rcs_id__
=
'$Id$'
$Id$
__version__
=
'$Revision: 1.10 $'
[
11
:
-
2
]
"""
import
os
,
sys
,
base64
,
unittest
import
unittest
import
Testing
import
Zope2
Zope2
.
startup
()
from
Testing.makerequest
import
makerequest
import
os
,
sys
,
base64
import
transaction
import
transaction
from
Testing.makerequest
import
makerequest
import
Zope2
Zope2
.
startup
()
from
AccessControl
import
Unauthorized
from
AccessControl
import
Unauthorized
from
AccessControl.SecurityManagement
import
newSecurityManager
from
AccessControl.SecurityManagement
import
newSecurityManager
...
@@ -65,6 +65,13 @@ class UserFolderTests(unittest.TestCase):
...
@@ -65,6 +65,13 @@ class UserFolderTests(unittest.TestCase):
user
=
user
.
__of__
(
self
.
uf
)
user
=
user
.
__of__
(
self
.
uf
)
newSecurityManager
(
None
,
user
)
newSecurityManager
(
None
,
user
)
def
test_z3interfaces
(
self
):
from
AccessControl.interfaces
import
IStandardUserFolder
from
AccessControl.User
import
UserFolder
from
zope.interface.verify
import
verifyClass
verifyClass
(
IStandardUserFolder
,
UserFolder
)
def
testGetUser
(
self
):
def
testGetUser
(
self
):
self
.
failIfEqual
(
self
.
uf
.
getUser
(
'user1'
),
None
)
self
.
failIfEqual
(
self
.
uf
.
getUser
(
'user1'
),
None
)
...
@@ -239,6 +246,7 @@ class UserFolderTests(unittest.TestCase):
...
@@ -239,6 +246,7 @@ class UserFolderTests(unittest.TestCase):
self
.
failUnless
(
uf
.
_isPasswordEncrypted
(
user
.
__
))
self
.
failUnless
(
uf
.
_isPasswordEncrypted
(
user
.
__
))
self
.
failUnless
(
pw_validate
(
user
.
__
,
PASSWORD
))
self
.
failUnless
(
pw_validate
(
user
.
__
,
PASSWORD
))
class
UserTests
(
unittest
.
TestCase
):
class
UserTests
(
unittest
.
TestCase
):
def
testGetUserName
(
self
):
def
testGetUserName
(
self
):
...
...
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