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
69201a89
Commit
69201a89
authored
Jan 15, 1998
by
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added security to User Folders (!)
parent
f14aa7b5
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
44 additions
and
30 deletions
+44
-30
lib/python/AccessControl/User.py
lib/python/AccessControl/User.py
+39
-25
lib/python/AccessControl/addUser.dtml
lib/python/AccessControl/addUser.dtml
+1
-1
lib/python/AccessControl/editUser.dtml
lib/python/AccessControl/editUser.dtml
+1
-1
lib/python/AccessControl/mainUser.dtml
lib/python/AccessControl/mainUser.dtml
+3
-3
No files found.
lib/python/AccessControl/User.py
View file @
69201a89
"""Access control package"""
"""Access control package"""
__version__
=
'$Revision: 1.3
4
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.3
5
$'
[
11
:
-
2
]
from
PersistentMapping
import
PersistentMapping
from
PersistentMapping
import
PersistentMapping
...
@@ -12,7 +12,8 @@ from Acquisition import Implicit
...
@@ -12,7 +12,8 @@ from Acquisition import Implicit
from
OFS.SimpleItem
import
Item
from
OFS.SimpleItem
import
Item
from
base64
import
decodestring
from
base64
import
decodestring
from
ImageFile
import
ImageFile
from
ImageFile
import
ImageFile
import
App.Undo
from
Role
import
RoleManager
import
Globals
,
App
.
Undo
...
@@ -72,9 +73,11 @@ nobody=User('Anonymous User','',('Anonymous',))
...
@@ -72,9 +73,11 @@ nobody=User('Anonymous User','',('Anonymous',))
class
UserFolder
(
Implicit
,
Persistent
,
Navigation
,
Tabs
,
Item
,
class
UserFolder
(
Implicit
,
Persistent
,
Navigation
,
Tabs
,
RoleManager
,
App
.
Undo
.
UndoSupport
):
Item
,
App
.
Undo
.
UndoSupport
):
""" """
""" """
__roles__
=
[
'Manager'
,
'Shared'
]
meta_type
=
'User Folder'
meta_type
=
'User Folder'
id
=
'acl_users'
id
=
'acl_users'
title
=
'User Folder'
title
=
'User Folder'
...
@@ -85,12 +88,22 @@ class UserFolder(Implicit, Persistent, Navigation, Tabs, Item,
...
@@ -85,12 +88,22 @@ class UserFolder(Implicit, Persistent, Navigation, Tabs, Item,
manage_options
=
(
manage_options
=
(
{
'icon'
:
icon
,
'label'
:
'Contents'
,
{
'label'
:
'Contents'
,
'action'
:
'manage_main'
},
'action'
:
'manage_main'
,
'target'
:
'manage_main'
},
{
'label'
:
'Security'
,
'action'
:
'manage_access'
},
{
'icon'
:
'App/undo_icon.gif'
,
'label'
:
'Undo'
,
{
'label'
:
'Undo'
,
'action'
:
'manage_UndoForm'
},
'action'
:
'manage_UndoForm'
,
'target'
:
'manage_main'
},
)
__ac_permissions__
=
(
(
'View management screens'
,
[
'manage_menu'
,
'manage_main'
,
'manage_copyright'
,
'manage_tabs'
,
'manage_UndoForm'
]),
(
'Undo changes'
,
[
'manage_undo_transactions'
]),
(
'Change permissions'
,
[
'manage_access'
]),
(
'Manage users'
,
[
'manage_users'
]),
(
'Shared permission'
,
[
''
]),
)
)
def
__init__
(
self
):
def
__init__
(
self
):
self
.
data
=
PersistentMapping
()
self
.
data
=
PersistentMapping
()
...
@@ -143,6 +156,8 @@ class UserFolder(Implicit, Persistent, Navigation, Tabs, Item,
...
@@ -143,6 +156,8 @@ class UserFolder(Implicit, Persistent, Navigation, Tabs, Item,
_add_User
=
HTMLFile
(
'addUser'
,
globals
())
_add_User
=
HTMLFile
(
'addUser'
,
globals
())
_editUser
=
HTMLFile
(
'editUser'
,
globals
())
_editUser
=
HTMLFile
(
'editUser'
,
globals
())
manage
=
manage_main
=
_mainUser
def
_addUser
(
self
,
name
,
password
,
confirm
,
roles
,
REQUEST
=
None
):
def
_addUser
(
self
,
name
,
password
,
confirm
,
roles
,
REQUEST
=
None
):
if
not
name
or
not
password
or
not
confirm
:
if
not
name
or
not
password
or
not
confirm
:
return
MessageDialog
(
return
MessageDialog
(
...
@@ -165,7 +180,7 @@ class UserFolder(Implicit, Persistent, Navigation, Tabs, Item,
...
@@ -165,7 +180,7 @@ class UserFolder(Implicit, Persistent, Navigation, Tabs, Item,
message
=
'Shared is not a legal role name'
,
message
=
'Shared is not a legal role name'
,
action
=
'manage_main'
)
action
=
'manage_main'
)
self
.
data
[
name
]
=
User
(
name
,
password
,
roles
)
self
.
data
[
name
]
=
User
(
name
,
password
,
roles
)
return
self
.
_mainUser
(
self
,
REQUEST
)
if
REQUEST
:
return
self
.
_mainUser
(
self
,
REQUEST
)
def
_changeUser
(
self
,
name
,
password
,
confirm
,
roles
,
REQUEST
=
None
):
def
_changeUser
(
self
,
name
,
password
,
confirm
,
roles
,
REQUEST
=
None
):
if
not
name
or
not
password
or
not
confirm
:
if
not
name
or
not
password
or
not
confirm
:
...
@@ -191,9 +206,9 @@ class UserFolder(Implicit, Persistent, Navigation, Tabs, Item,
...
@@ -191,9 +206,9 @@ class UserFolder(Implicit, Persistent, Navigation, Tabs, Item,
user
=
self
.
data
[
name
]
user
=
self
.
data
[
name
]
user
.
__
=
password
user
.
__
=
password
user
.
roles
=
roles
user
.
roles
=
roles
return
self
.
_mainUser
(
self
,
REQUEST
)
if
REQUEST
:
return
self
.
_mainUser
(
self
,
REQUEST
)
def
_delUser
(
self
,
names
,
REQUEST
=
None
):
def
_delUser
s
(
self
,
names
,
REQUEST
=
None
):
if
not
names
:
if
not
names
:
return
MessageDialog
(
return
MessageDialog
(
title
=
'Illegal value'
,
title
=
'Illegal value'
,
...
@@ -207,9 +222,9 @@ class UserFolder(Implicit, Persistent, Navigation, Tabs, Item,
...
@@ -207,9 +222,9 @@ class UserFolder(Implicit, Persistent, Navigation, Tabs, Item,
action
=
'manage_main'
)
action
=
'manage_main'
)
for
name
in
names
:
for
name
in
names
:
del
self
.
data
[
name
]
del
self
.
data
[
name
]
return
self
.
_mainUser
(
self
,
REQUEST
)
if
REQUEST
:
return
self
.
_mainUser
(
self
,
REQUEST
)
def
manage_
main
(
self
,
submit
=
None
,
REQUEST
=
None
):
def
manage_
users
(
self
,
submit
=
None
,
REQUEST
=
None
,
RESPONSE
=
None
):
""" """
""" """
if
submit
==
'Add...'
:
if
submit
==
'Add...'
:
return
self
.
_add_User
(
self
,
REQUEST
)
return
self
.
_add_User
(
self
,
REQUEST
)
...
@@ -223,27 +238,25 @@ class UserFolder(Implicit, Persistent, Navigation, Tabs, Item,
...
@@ -223,27 +238,25 @@ class UserFolder(Implicit, Persistent, Navigation, Tabs, Item,
return
self
.
_editUser
(
self
,
REQUEST
,
user
=
user
,
password
=
user
.
__
)
return
self
.
_editUser
(
self
,
REQUEST
,
user
=
user
,
password
=
user
.
__
)
if
submit
==
'Add'
:
if
submit
==
'Add'
:
name
=
reqattr
(
REQUEST
,
'name'
)
name
=
reqattr
(
REQUEST
,
'name'
)
password
=
reqattr
(
REQUEST
,
'password'
)
password
=
reqattr
(
REQUEST
,
'password'
)
confirm
=
reqattr
(
REQUEST
,
'confirm'
)
confirm
=
reqattr
(
REQUEST
,
'confirm'
)
roles
=
reqattr
(
REQUEST
,
'roles'
)
roles
=
reqattr
(
REQUEST
,
'roles'
)
return
self
.
_addUser
(
name
,
password
,
confirm
,
roles
,
REQUEST
)
return
self
.
_addUser
(
name
,
password
,
confirm
,
roles
,
REQUEST
)
if
submit
==
'Change'
:
if
submit
==
'Change'
:
name
=
reqattr
(
REQUEST
,
'name'
)
name
=
reqattr
(
REQUEST
,
'name'
)
password
=
reqattr
(
REQUEST
,
'password'
)
password
=
reqattr
(
REQUEST
,
'password'
)
confirm
=
reqattr
(
REQUEST
,
'confirm'
)
confirm
=
reqattr
(
REQUEST
,
'confirm'
)
roles
=
reqattr
(
REQUEST
,
'roles'
)
roles
=
reqattr
(
REQUEST
,
'roles'
)
return
self
.
_changeUser
(
name
,
password
,
confirm
,
roles
,
REQUEST
)
return
self
.
_changeUser
(
name
,
password
,
confirm
,
roles
,
REQUEST
)
if
submit
==
'Delete'
:
if
submit
==
'Delete'
:
names
=
reqattr
(
REQUEST
,
'names'
)
names
=
reqattr
(
REQUEST
,
'names'
)
return
self
.
_delUser
(
names
,
REQUEST
)
return
self
.
_delUser
s
(
names
,
REQUEST
)
return
self
.
_mainUser
(
self
,
REQUEST
)
return
self
.
_mainUser
(
self
,
REQUEST
)
manage
=
manage_main
# Copy/Paste support
# Copy/Paste support
...
@@ -264,6 +277,7 @@ class UserFolder(Implicit, Persistent, Navigation, Tabs, Item,
...
@@ -264,6 +277,7 @@ class UserFolder(Implicit, Persistent, Navigation, Tabs, Item,
'<EM>Cannot change the id of a UserFolder</EM>'
)
'<EM>Cannot change the id of a UserFolder</EM>'
)
Globals
.
default__class_init__
(
UserFolder
)
class
UserFolderHandler
:
class
UserFolderHandler
:
...
...
lib/python/AccessControl/addUser.dtml
View file @
69201a89
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
To add a new user, enter the name, password, confirmation and
To add a new user, enter the name, password, confirmation and
roles for the new user and click "Add".
roles for the new user and click "Add".
<FORM ACTION="manage_
main
" METHOD="POST">
<FORM ACTION="manage_
users
" METHOD="POST">
<TABLE>
<TABLE>
<TR>
<TR>
<TD VALIGN="TOP">
<TD VALIGN="TOP">
...
...
lib/python/AccessControl/editUser.dtml
View file @
69201a89
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
<BODY BGCOLOR="#FFFFFF" LINK="#000099" VLINK="#555555">
<BODY BGCOLOR="#FFFFFF" LINK="#000099" VLINK="#555555">
<!--#var manage_tabs-->
<!--#var manage_tabs-->
<FORM ACTION="manage_
main
" METHOD="POST">
<FORM ACTION="manage_
users
" METHOD="POST">
<TABLE>
<TABLE>
<TR>
<TR>
<TD VALIGN="TOP">
<TD VALIGN="TOP">
...
...
lib/python/AccessControl/mainUser.dtml
View file @
69201a89
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
<BODY BGCOLOR="#FFFFFF" LINK="#000099" VLINK="#555555">
<BODY BGCOLOR="#FFFFFF" LINK="#000099" VLINK="#555555">
<!--#var manage_tabs-->
<!--#var manage_tabs-->
<FORM ACTION="manage_
main
" METHOD="POST">
<FORM ACTION="manage_
users
" METHOD="POST">
<!--#if user_names-->
<!--#if user_names-->
The following users have been defined. Click on a user to edit
The following users have been defined. Click on a user to edit
that user.
that user.
...
@@ -17,11 +17,11 @@ that user.
...
@@ -17,11 +17,11 @@ that user.
<INPUT TYPE="CHECKBOX" NAME="names:list" VALUE="<!--#var sequence-item-->">
<INPUT TYPE="CHECKBOX" NAME="names:list" VALUE="<!--#var sequence-item-->">
</TD>
</TD>
<TD ALIGN="LEFT" VALIGN="TOP">
<TD ALIGN="LEFT" VALIGN="TOP">
<A HREF="manage_
main
?name=<!--#var sequence-item fmt=url-quote-->&submit=Edit">
<A HREF="manage_
users
?name=<!--#var sequence-item fmt=url-quote-->&submit=Edit">
<IMG SRC="<!--#var SCRIPT_NAME-->/p_/User_icon" ALT="Click to edit user"
<IMG SRC="<!--#var SCRIPT_NAME-->/p_/User_icon" ALT="Click to edit user"
BORDER="0">
BORDER="0">
</A>
</A>
<A HREF="manage_
main
?name=<!--#var sequence-item fmt=url-quote-->&submit=Edit">
<A HREF="manage_
users
?name=<!--#var sequence-item fmt=url-quote-->&submit=Edit">
<!--#var sequence-item-->
<!--#var sequence-item-->
</A>
</A>
</TD>
</TD>
...
...
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