Commit 55029eb6 authored by 's avatar

Changed UFs so that only the top UF validates god.

parent 02994d98
"""Access control package""" """Access control package"""
__version__='$Revision: 1.12 $'[11:-2] __version__='$Revision: 1.13 $'[11:-2]
import Globals import Globals
from Persistence import Persistent from Persistence import Persistent
...@@ -71,7 +71,7 @@ class SuperUser: ...@@ -71,7 +71,7 @@ class SuperUser:
def __repr__(self): def __repr__(self):
return self._name return self._name
su=SuperUser() super=SuperUser()
class UserFolder(Implicit, Persistent, Item): class UserFolder(Implicit, Persistent, Item):
...@@ -94,8 +94,6 @@ class UserFolder(Implicit, Persistent, Item): ...@@ -94,8 +94,6 @@ class UserFolder(Implicit, Persistent, Item):
manage_options=( manage_options=(
{'icon':'AccessControl/UserFolder_icon.gif', 'label':'Contents', {'icon':'AccessControl/UserFolder_icon.gif', 'label':'Contents',
'action':'manage_main', 'target':'manage_main'}, 'action':'manage_main', 'target':'manage_main'},
# {'icon':'OFS/Help_icon.gif', 'label':'Help',
# 'action':'manage_help', 'target':'_new'},
) )
def _init(self): def _init(self):
...@@ -108,6 +106,11 @@ class UserFolder(Implicit, Persistent, Item): ...@@ -108,6 +106,11 @@ class UserFolder(Implicit, Persistent, Item):
try: return (self.aq_parent,) try: return (self.aq_parent,)
except: return () except: return ()
def _isTop(self):
try: t=self.aq_parent.aq_parent.acl_users
except: return 1
return 0
def userNames(self): def userNames(self):
return self._data.keys() return self._data.keys()
...@@ -118,8 +121,11 @@ class UserFolder(Implicit, Persistent, Item): ...@@ -118,8 +121,11 @@ class UserFolder(Implicit, Persistent, Item):
if lower(auth[:6])!='basic ': if lower(auth[:6])!='basic ':
return None return None
[name,password]=split(decodestring(split(auth)[-1]), ':') [name,password]=split(decodestring(split(auth)[-1]), ':')
if (name==su._name) and (password==su._password):
return su if self._isTop() and (name==super._name) and \
(password==super._password):
return super
try: user=self._data[name] try: user=self._data[name]
except: return None except: return None
if password!=user._password: if password!=user._password:
...@@ -133,7 +139,7 @@ class UserFolder(Implicit, Persistent, Item): ...@@ -133,7 +139,7 @@ class UserFolder(Implicit, Persistent, Item):
def manage_addUser(self,REQUEST,name,password,confirm,roles=[]): def manage_addUser(self,REQUEST,name,password,confirm,roles=[]):
""" """ """ """
if self._data.has_key(name): if self._data.has_key(name) or (name==super._name):
return MessageDialog(title='Illegal value', return MessageDialog(title='Illegal value',
message='An item with the specified name already exists', message='An item with the specified name already exists',
action='%s/manage' % REQUEST['PARENT_URL']) action='%s/manage' % REQUEST['PARENT_URL'])
...@@ -228,6 +234,9 @@ class UserFolderHandler: ...@@ -228,6 +234,9 @@ class UserFolderHandler:
# $Log: User.py,v $ # $Log: User.py,v $
# Revision 1.13 1997/09/19 17:52:04 brian
# Changed UFs so that only the top UF validates god.
#
# Revision 1.12 1997/09/17 14:59:42 brian # Revision 1.12 1997/09/17 14:59:42 brian
# *** empty log message *** # *** empty log message ***
# #
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment