Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
portal factory for anonymous users
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  3 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Deichi  
View profile  
 More options Oct 17 2006, 4:01 am
From: "Deichi" <deichm...@werkbank.com>
Date: Tue, 17 Oct 2006 01:01:36 -0700
Local: Tues, Oct 17 2006 4:01 am
Subject: portal factory for anonymous users
Hello altogether,

the README.txt states, that "Registrant objects CANNOT use
portal_factory; if you try to do things that way, anonymous users will
not be able to register for events."
and some stuff about bugs in the permissions.

That's all nonsense. You only have to overwrite the standard
invokeFactory procedure.
I "stole" this from one of (I think) jensens' products. If found it
through a comment on plone.org somewhere, but can't find it right now.
I use this code for my own Registrant object since a while and it works
fine:

security.declarePrivate('anonymousInvokeFactory')
def anonymousInvokeFactory(self, container, type_name, id,
REQUEST=None, *args, **kw):
    """
    Anonymous cannot add objects with InvokeFactory, so this is a
special
    method to do it with. Must be called from other function to limit
    possibillities of abuse.
    """
    user = self.getWrappedOwner()
    newSecurityManager(REQUEST, user)
    container.invokeFactory(type_name, id, REQUEST=REQUEST, *args,
**kw)

security.declarePublic('addAnonymousParticipant')
def addAnonymousParticipant(self, fieldnames=None, REQUEST=None):
    """
    Lets anonymous users add participants
    """
    message = '?portal_status_message=%s'
    if fieldnames is None:
        fieldnames = []
    kw = {}
    for fieldname in fieldnames:
        if fieldname in REQUEST:
            if hasattr(REQUEST[fieldname],'decode'):
                kw[fieldname] = REQUEST[fieldname].decode('latin-1')
            else:
                kw[fieldname] = REQUEST[fieldname]
    # generate an id
    now = self.ZopeTime().strftime('%Y%m%dZ%H%M%S')
    id = 'participant.%s.%s' % (now, random.randint(1,1000000))
    self.anonymousInvokeFactory(self, 'Participant', id,
REQUEST=REQUEST, **kw)
    newParticipant = getattr(self, id)
    # set attributes
    for key, val in kw.items():
        if key=='image':
            newParticipant.setImage(val,val.filename)
        else:
            setattr(newParticipant, key, val)
    # reindex in the catalog
    newParticipant.reindexObject()
    # Redirect back to form
    absolute_url = self.absolute_url()
    message = message % 'Sucessfully added participant'
    REQUEST.RESPONSE.redirect('%s/thankyou%s' % (absolute_url, message)
)

That's only a way it works in this class and not all stuff in here is
necessary of course, but it should make the way clear how to implement
the factory into EventRegistration.

Regards,
Deichi


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Justin Ryan  
View profile  
 More options Oct 17 2006, 10:25 am
From: "Justin Ryan" <justi...@gmail.com>
Date: Tue, 17 Oct 2006 09:25:45 -0500
Local: Tues, Oct 17 2006 10:25 am
Subject: Re: portal factory for anonymous users

Diechi - please write a patch, this product is mostly abandoned.  A branch
would be nice, but trunk is fine.

Have you looked at SignupSheet?

On 10/17/06, Deichi <deichm...@werkbank.com> wrote:

--
Justizin, Independent Interactivity Architect
ACM SIGGRAPH SysMgr, Reporter
http://www.siggraph.org/

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Deichi  
View profile  
 More options Oct 18 2006, 8:00 am
From: "Deichi" <deichm...@werkbank.com>
Date: Wed, 18 Oct 2006 05:00:04 -0700
Local: Wed, Oct 18 2006 8:00 am
Subject: Re: portal factory for anonymous users

Justin Ryan wrote:
> Diechi - please write a patch, this product is mostly abandoned.  A branch
> would be nice, but trunk is fine.

I currently don't have the time for that :(
Is it abandonded because of that? ;)

> Have you looked at SignupSheet?

Indeed. That's what I use now, but both Products would need some work
to link them together.
In fact it is a property of an event if it offers a sign up sheet or
not and which one.

Regards,
Deichi


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google