folder context for invokeFactory

2 messages Options
Embed this post
Permalink
Vijay Ramachandran () folder context for invokeFactory
Reply Threaded More More options
Print post
Permalink
Hello.

I'm trying to create an object in an external method using invokeFactory. I do this by getting the member who called the script:

    mt = getToolByName(self, 'portal_membership')
    if mt.isAnonymousUser():
        return
    else:
        member = mt.getAuthenticatedMember()
        username = member.getUserName()

and I create the object on "member" above:
  member.invokeFactory("Tour", id = tour_id)

This works if I run the script as the administrative user, and creates the object in the admin's "my folder". However, if I do this as any other user, I get an insufficient permissions error:

"Insufficient Privileges: You do not have sufficient privileges to view this page."

The url for the above page is "acl_users/credentials_cookie_auth/require_login?came_from=external method endpoint"

I've traced it down to the invokeFactory call causing this error. I've tried various suggestions I've read on the web to solve this, but nothing so far. If I access the "My Folder" area via the web, I'm able to create objects in it, so I think that if I get the "My Folder" of the "member" above, the invokeFactory should work. I don't know how to do this though. Is this the right line of thinking? If so, how can I access the "My Folder" given an authenticated user object? If not, what is the right way to allow creation of objects in a user's folder?

thanks!
Vijay

I've tr
Vijay Ramachandran () Re: folder context for invokeFactory
Reply Threaded More More options
Print post
Permalink
Ok, calling portal_membership.getHomeFolder() gave a folder object, where the user has privileges to create objects.

Sorry for following up to my own mail - but thought that it might save others some trouble in the future.

regards,
Vijay