[Moin-user] setting variables depeding if a user is logged in.

Adam Shand adam at personaltelco.net
Tue Apr 9 17:10:25 EDT 2002


Hi,

Sorry for the delayed response, my real job was keeping me busy today :)

On Tue, 2002-04-09 at 14:58, Juergen Hermann wrote:
> The config for the public URL should make the wiki read-only. This is 
> certainly better and more stable than any config-manipulation.

I'd prefer to do it in moin_config.py because that way I get it fully
integrated, but yes I understand that I can do that.

> Read
> 
> HelpOnConfiguration/SecurityPolicy
>
> Note that the user, and thus the security policy, is created rather 
> early in the request cycle, so (re-)setting config vars there is ok
> for _most_ things. Or you check the HTTP_COOKIE directly in
> moin_config.py.

I have read that, but it's short on details, and I'm not a good enough
Python programmer to understand quite how the security class works.

Could an example code block be provided in which a test for HTTP_COOKIE
or the security policy test would enable a new set of configuration
variables?

I tried adding a second version of the sitename variable in this section
and it didn't change what displayed on the web site.

if 1:
    allowed_actions = ['AttachFile']

    from MoinMoin.security import Permissions
    class SecurityPolicy(Permissions):
        edit = 1
        delete = 0

        def __init__(self, user):
            self.user = user
            self.edit = self.edit and user.valid
            sitename = 'test site'


thanks.
adam.





More information about the Moin-user mailing list