[Zope-CMF] Only LoginForm anonymously viewable?

Rémi Houdaille Remi.Houdaille@akeirou.com
Tue, 18 Sep 2001 10:24:41 +0000


Chris Withers a écrit :

> If I want only the login form of my CMF to be anonymously viewable, how do I go
> about doing it?
> (especially as the login form is FS-based)

The way I do it (not so good... but in case it helps)

1) remove permissions for anonymous on the portal :
     either through the ZMI
     or in the python code (CMFDefault/Portal.py or whatever you replaced it with) :

     in setupPermissions, remove the permission inheritance (last parameter to mp()
     set to 0 instead of 1), and add :
     mp('View', ['Member','Manager',], 0)
2) add anonymous view permission specifically to login_form and logged_out :
     I tried to do that in Python in manage_addCMFSite but this DID NOT work for me
:-(
     So I currently set the view permission the following way :
     - "customize" login_form (and logged_out) through the ZMI,
     - give the permissions to the customized versions throught the ZMI,
     - do this each time you create a new portal instance :'-(

Rémi

PS: here is the code not working in python (seems to have no effect) in case
somebody can point out my mistake.

    gen = PortalGenerator()
    p = gen.create(self, id, create_userfolder)
    gen.setupDefaultProperties(p, title, description,
                               email_from_address, email_from_name,
                               validate_email)
    # added code for anonymous permissions (NOT WORKING) :
    logout = p.restrictedTraverse('portal_skins/generic/logged_out')
    logout.manage_permission('View', ['Anonymous','Member','Manager',], 1)
    login = p.restrictedTraverse('portal_skins/generic/login_form')
    login.manage_permission('View', ['Anonymous','Member','Manager',], 1)