[Zope-CMF] Proposal: Additional member properties to allow anonymous view of the member roster

Grégoire Weber gregoire.weber@switzerland.org
Tue, 05 Jun 2001 13:39:54 +0200


Hi!

For a demonstration I am customizing the CMF and I like to list 
the members (in my case: organisations) at the portals front page 
to allow fast access to the organisations sub front pages.

To allow this I made the following temporary changes (se code 
snippets below):
1) I declared public the getRoster() method in MembershipTool.py
2) I commented out the isManager check
3) I called getHomeUrl with verifyPermission=0 instead of 1

As you probably understand I don't realy like 
this kind of solution :-( !

So I propose to ..
   ... add the possibility to let the Manager decide which of the 
   Members would be visible in a anonymously viewed roster. Every member 
   could decide oon its own if it likes to be set to the anonymously 
   viewable roster or not.

   For this there is a need for two additional member properties *):
    - allows_anon_listing: The member allows to be listed anonymously
    - anon_listed: allows the manager to turn on/off anonymous listing

   Possibly we need another flag indicating a change in 
   'allows_anon_listing' to allow the Manager to check for changes.

Can somebody point me out the places in the code where I have to do 
the necessary changes? I would contribute the changes back to the 
community!

Comments?

Please reply to the list and to me directly. I only read the zope-cmf
digests once a day.

Greg

*) You probably find better names than I as native german speaking person!


-------------------------- python code snippet out of MembershipTool.py
#!! security.declareProtected( CMFCorePermissions.ListPortalMembers,
'getRoster' )
    security.declarePublic( CMFCorePermissions.ListPortalMembers,
'getRoster' )
    def getRoster(self):
        '''
        Return a list of mappings corresponding to those users who have
        made themselves "listed".  If Manager, return a list of all
        usernames.  The mapping contains the id and listed variables.
        '''
        isManager = _checkPermission('Manage portal', self)
        roster = []
        for member in self.listMembers():
#!!         if isManager or member.listed:
                roster.append({'id':member.getUserName(),
                               'listed':member.listed})
        return roster


------------------------------------------------------ DTML code snippet
<dtml-comment>Code to list all members</dtml-comment>
<dtml-let roster="portal_membership.getRoster()">
  <dtml-in roster mapping orphan=1 start=qs>
    <dtml-let homeUrl="portal_membership.getHomeUrl(id, verifyPermission=0)">
      <dtml-if homeUrl><a href="&dtml-homeUrl;">&dtml-id;</a>
      <dtml-else>&dtml-id;
      </dtml-if>
      <dtml-unless sequence-end>, </dtml-unless>
    </dtml-let>
  </dtml-in>
</dtml-let>

_____________________________________
Grégoire Weber
mailto:gregoire.weber@switzerland.org