Pier: Invoking a PRCommand from outside, on-the-fly-login, redirect to users page

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Pier: Invoking a PRCommand from outside, on-the-fly-login, redirect to users page

Matthias Berth-2
Hi,

I have tried various ways to accomplish this, so far with limited
success, any pointers would be appreciated :-)

Here is my scenario:

- a user fills in a web form on a non-Pier web site

- the form is submitted via HTTP post to a URL on the Pier site, like so:

 http://the.piersite.net/seaside/pier?command=DoSomething

- DoSomething is a PRCommand that requires a login

- the user logs in

- Pier shows a confirmation form that summarizes the data from the original form

- user clicks OK

- DoSomething is executed

- Pier shows the home page of the user
 http://the.piersite.net/seaside/pier/accounts/joeuser?command=PRViewCommand


I can have DoSomething execute successfully, but I cannot make the
change to the users home page.

Maybe my approach is wrong:

- I use Seaside 2.7b with the latest Pier, Magritte etc

- I use Pier Unix security

- DoSomething is a PRCommand that implements isValidIn: aContext on
the class side as aContext isLoggedIn. This, together with configuring
PUPierMain as the main class will invoke the on-the-fly login.

- I have a made a patch to PRPierMain>>commandFrom: such that the
newly created PRCCommand will have a chance to read additional data
from the external HTTP Request (inside DoSomething>>processRequest:)

- DoSomething answers a custom subclass of WAComponent (say,
ConfirmView) in its asComponent method

- the ConfirmView knows the DoSomething command so it can display the
users data, with a button "Confirm". Clicking the Confirm button will
send the message confirm to the view

ConfirmView>>confirm
        command user: self context user..
        command execute

- I can see that the command executes successfully. Inside
DoSomething>>execute I have
        self
                answer: (self context
                              structure: self user account "account is
a PRStructure"
                              view: UserAccountView)

- I have inspected the command at this point, and answer gets the
right contents.

- However, when I click on the button, the Confirm view just stays there.

Do you see any chance to get this working? I have tried to look at
Pier Blog and others, but they all seem to use #answer: without
problems.

I'd be thankful for any hints, or alternative ways to achieve the page
flow I described.

Cheers

Matthias

_______________________________________________
SmallWiki, Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: Pier: Invoking a PRCommand from outside, on-the-fly-login, redirect to users page

keith1y
Matthias,

I tried some stuff in the PRPierControlPanel which operates on pier, yet
runs in the context of the seaside/config

For code which does this check out the Magma-PersistencyManager and it
depends upon Seaside28Jetsam.

This is the crucial bit non trivial bit for me, where self responds to
#context

ControlPanel-callWidget: widget  titled: title

    PRCurrentContext use: self during: [
        WARenderLoop new call: (widget
            addDecoration: (WAWindowDecoration new
                title: title;
                yourself);
            yourself) ]

FYI: This was working in 2.7, but no longer works in 2.8

best regards

Keith



_______________________________________________
SmallWiki, Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: Pier: Invoking a PRCommand from outside, on-the-fly-login, redirect to users page

Matthias Berth-2
Keith,

thanks, interesting. So this snippet lets you render the Pier widget
from another Seaside app, and all the interactions etc work as
expected? Can I interpret it as embedding parts of Pier in a Seaside
app?

PRCurrentContext use: self during: [...] looks pretty mysterious to me.

I'm not sure, but I think that everything is already set up more or
less to run inside Pier once I have logged in. The login executes a
Pier command, and Confirm is another Pier command, both of them are
successful, it's only that Confirm does not go where I want it to go.


Cheers

Matthias

On 8/3/07, Keith Hodges <[hidden email]> wrote:

> Matthias,
>
> I tried some stuff in the PRPierControlPanel which operates on pier, yet
> runs in the context of the seaside/config
>
> For code which does this check out the Magma-PersistencyManager and it
> depends upon Seaside28Jetsam.
>
> This is the crucial bit non trivial bit for me, where self responds to
> #context
>
> ControlPanel-callWidget: widget  titled: title
>
>     PRCurrentContext use: self during: [
>         WARenderLoop new call: (widget
>             addDecoration: (WAWindowDecoration new
>                 title: title;
>                 yourself);
>             yourself) ]
>
> FYI: This was working in 2.7, but no longer works in 2.8
>
> best regards
>
> Keith
>
>
>
> _______________________________________________
> SmallWiki, Magritte, Pier and Related Tools ...
> https://www.iam.unibe.ch/mailman/listinfo/smallwiki
>

_______________________________________________
SmallWiki, Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: Pier: Invoking a PRCommand from outside, on-the-fly-login, redirect to users page

Lukas Renggli-2
I slightly refactored your changes so that they are in the right  
package and that they match the way Seaside implements these methods.  
PRCommand now understands #updateUrl: and #initialRequest: (the  
former #processRequest:).

These changes makes some of the Pier code much simpler and generally  
more powerful. Thanks for providing the initial implementation. To  
see an example of the interplay of these methods have a look at  
PRViewCommand that implements #updateUrl: and #initialRequest:.

HTH,
Lukas

On 03.08.2007, at 16:08, Matthias Berth wrote:

> Keith,
>
> thanks, interesting. So this snippet lets you render the Pier widget
> from another Seaside app, and all the interactions etc work as
> expected? Can I interpret it as embedding parts of Pier in a Seaside
> app?
>
> PRCurrentContext use: self during: [...] looks pretty mysterious to  
> me.
>
> I'm not sure, but I think that everything is already set up more or
> less to run inside Pier once I have logged in. The login executes a
> Pier command, and Confirm is another Pier command, both of them are
> successful, it's only that Confirm does not go where I want it to go.
>
>
> Cheers
>
> Matthias
>
> On 8/3/07, Keith Hodges <[hidden email]> wrote:
>> Matthias,
>>
>> I tried some stuff in the PRPierControlPanel which operates on  
>> pier, yet
>> runs in the context of the seaside/config
>>
>> For code which does this check out the Magma-PersistencyManager  
>> and it
>> depends upon Seaside28Jetsam.
>>
>> This is the crucial bit non trivial bit for me, where self  
>> responds to
>> #context
>>
>> ControlPanel-callWidget: widget  titled: title
>>
>>     PRCurrentContext use: self during: [
>>         WARenderLoop new call: (widget
>>             addDecoration: (WAWindowDecoration new
>>                 title: title;
>>                 yourself);
>>             yourself) ]
>>
>> FYI: This was working in 2.7, but no longer works in 2.8
>>
>> best regards
>>
>> Keith
>>
>>
>>
>> _______________________________________________
>> SmallWiki, Magritte, Pier and Related Tools ...
>> https://www.iam.unibe.ch/mailman/listinfo/smallwiki
>>
>
> _______________________________________________
> SmallWiki, Magritte, Pier and Related Tools ...
> https://www.iam.unibe.ch/mailman/listinfo/smallwiki

--
Lukas Renggli
http://www.lukas-renggli.ch


_______________________________________________
SmallWiki, Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki