Hi,
I am trying to grok Dulcinea's
User/Contact/Address/History/Event/PermissionManager and associated
classes. Nice to have such a functional set such as these, btw, and I
really like the simple History/Event model.
I was thrown off by what seems to be a little detail in name usage,
that made it a lot less efficient for me to understand the
PermissionManager. This is that the label "admin" seems to be used both
for a user (contact) with admin permissions, as well as the
permission_manager itself (for the users db).
In particular, (in contact.py) wouldn't:
class ContactAdmin(DulcineaPersistent, PermissionManager):
...
that, notice, is not a User, be more appropriately named something like:
class ContactPermissionManager(DulcineaPersistent, PermissionManager):
...
and, consequently the usage of "admin" in the ContactDatabase class,
should be replaced with "pm" or so. I.e.
class ContactDatabase(DulcineaUserDatabase):
user_class = Contact
pm_is = ContactPermissionManager
users_is = spec(
mapping({str:user_class}, PersistentDict),
"Maps user_ids to user instances")
def __init__(self, pm=None):
DulcineaUserDatabase.__init__(self)
system_user = self.user_class("SYSTEM")
self.add_user(system_user)
self.pm = pm or ContactPermissionManager()
self.pm.set_permission('system', system_user)
def get_pm(self):
return self.pm
The usage of the term "admin" in class Contact should stay as is, as it
does not surprise me in any way ;-)
Having said all this, I suspect that using "admin" for both these
objects was a deliberate choice, and I must therefore be
misunderstanding something. Was there a particular reason for this?
Thanks, mario