[Zope] Next try at user auth and role creation

Oliver Andrich oli@rz-online.net
Mon, 20 Mar 2000 22:59:06 +0100


Hi,

well I use the following code snippet in my factory method of the product I am
developing.

<dtml-with "manage_clone(Home, REQUEST['new_id'], REQUEST)">
        <dtml-call "manage_changeProperties(
                        company_name=REQUEST['new_company_name'],
                        title='OS Job Tracking System für ' + REQUEST['new_company_name']
                    )">
        <dtml-call "acl_users.manage_users(submit='Add Role', REQUEST=REQUEST)">
        <dtml-call "manage_defined_roles(submit='Add Role', REQUEST=REQUEST)">
    </dtml-with>

I set the role element of my REQUEST object to a string, which is the name of
the new role. When I look a manage_defined_roles in
lib/python/AccessControl/Roles.py it searches for a submit element in the
REQUEST object that has a certain value. Otherwise it calls manage_access. 

Well, I set submit to the required value, so that _addRole is called. Then I
get the error

    Error Type: AttributeError
    Error Value: aq_acquire

And when I call it without setting the parameters at all

    Error Type: KeyError
    Error Value: SCRIPT_NAME

When I call it with REQUEST=REQUEST I get the first error again.

Any idea what is wrong with my call? I am not using any external method or so
from product, but I develop the product in Zope and use only DTML scripting,
cause this is sufficient for my task.

I am running Zope 2.1.4 as a standalon zserver. May be this helps too.

Any hint would be really fine.

Best regards,

    Oliver Andrich

On Mon, Mar 20, 2000 at 11:03:15AM -0800, Michel Pelletier wrote:
> Oliver Andrich wrote:
> > 
> > Hi,
> > 
> > sofar I solved the creation process of user accounts. This was quite easy
> > after I read the code for this. But now I have problems adding new roles via a
> > specialized interface. I setup tghe REQUEST object correctly, then I call
> > manage_defined_roles and I get various errors.
> 
> What kind of errors?
> 
> > Is their any method at all to
> > create Roles besides the management interface of Zope or via External Methods?
> 
> You should be able to call a method that adds roles just like the
> managment interface does.  Have you checked out
> lib/python/AccessControl/access.dtml?  At the bottom is a second form
> that lets you add roles.
> 
> -Michel