jqgrid (plugin_wiki) and @auth.requires_login()

35 views
Skip to first unread message

Richard Vézina

unread,
Sep 30, 2010, 3:32:32 PM9/30/10
to web...@googlegroups.com
Hello,

Is it possible to make jqgrid sensible to be "@auth.requires_login()"?

When there is a session that ends because no activity has been detect during long moment there is no message when user try to use the jqgrid control : search or refresh button...

I understand that it is a plugin that uses javascript, but maybe we can create a mechanism that could serve any plugin embeded. What do you think?

Regards.

Richard


Bruno Rocha

unread,
Sep 30, 2010, 3:41:36 PM9/30/10
to web...@googlegroups.com
Thats not the best way, but I do:

``{{if auth.is_logged_in():}}``:template
``table:xxxx``:jqgrid
``{{pass}}``:template

Ugly, but works.


2010/9/30 Richard Vézina <ml.richa...@gmail.com>

mdipierro

unread,
Sep 30, 2010, 3:45:54 PM9/30/10
to web2py-users
There should be no need for that.

the

``
...

``:widget

is always embedded in a page that has permissions. So it will only be
visible to users who have access to that page.
the issue is the ajax callback.
That is already restricted to logged in users

http://code.google.com/p/cube2py/source/browse/controllers/plugin_wiki.py

@auth.requires_login()
def jqgrid():
...

Massimo





On Sep 30, 2:41 pm, Bruno Rocha <rochacbr...@gmail.com> wrote:
> Thats not the best way, but I do:
>
> ``{{if auth.is_logged_in():}}``:template
> ``table:xxxx``:jqgrid
> ``{{pass}}``:template
>
> Ugly, but works.
>
> 2010/9/30 Richard Vézina <ml.richard.vez...@gmail.com>

Bruno Rocha

unread,
Sep 30, 2010, 3:57:21 PM9/30/10
to web...@googlegroups.com
I use that way, when I need the page to be public, but protecting just some parts of the page.

2010/9/30 mdipierro <mdip...@cs.depaul.edu>



--

http://rochacbruno.com.br

Richard Vézina

unread,
Sep 30, 2010, 4:03:26 PM9/30/10
to web...@googlegroups.com
Ok, but :

@auth.requires_login()
def jqgrid():

is already in the plugin_wiki controller.

Problem is still there.

Do we have to find a solution for the ajax callback?

Just to be sure we understand the problem correctly :

If the logged user has been on the page that uses jqgrid and he lets the browser open for a wild on that page and come back and wants to sort the data the plugin fail. It seems to work, but nothing changes. It looks like the system is not working for lambda user.

Richard

mdipierro

unread,
Sep 30, 2010, 4:07:35 PM9/30/10
to web2py-users
I see. The problem is that the user has been logged off. the callback
knows but the page no because was not reloaded.

let me think about this one. Suggestions are welcome.

Massimo

On Sep 30, 3:03 pm, Richard Vézina <ml.richard.vez...@gmail.com>
wrote:
> Ok, but :
>
> @auth.requires_login()
> def jqgrid():
>
> is already in the plugin_wiki controller.
>
> Problem is still there.
>
> Do we have to find a solution for the ajax callback?
>
> Just to be sure we understand the problem correctly :
>
> If the logged user has been on the page that uses jqgrid and he lets the
> browser open for a wild on that page and come back and wants to sort the
> data the plugin fail. It seems to work, but nothing changes. It looks like
> the system is not working for lambda user.
>
> Richard
>
> On Thu, Sep 30, 2010 at 3:45 PM, mdipierro <mdipie...@cs.depaul.edu> wrote:
> > There should be no need for that.
>
> > the
>
> > ``
> > ...
>
> > ``:widget
>
> > is always embedded in a page that has permissions. So it will only be
> > visible to users who have access to that page.
> > the issue is the ajax callback.
> >  That is already restricted to logged in users
>
> >http://code.google.com/p/cube2py/source/browse/controllers/plugin_wik...

Richard Vézina

unread,
Sep 30, 2010, 4:20:43 PM9/30/10
to web...@googlegroups.com
Try like this :

{{if auth.is_logged_in():}}
{{=plugin_wiki.widget('jqgrid',tablename,col_width=80,width=900,height=500)}}
{{pass}}

And that not solve the pb I decribe in most detail.

Richard

mdipierro

unread,
Sep 30, 2010, 4:53:54 PM9/30/10
to web2py-users
The only way to solve the problem without changing pluginwiki is to
add an ajax keepalive. I.e. a script in the page the makes an ajax
call every few minutes (20?) to a dummy controller action.

On Sep 30, 3:20 pm, Richard Vézina <ml.richard.vez...@gmail.com>
wrote:
> Try like this :
>
> {{if auth.is_logged_in():}}
> {{=plugin_wiki.widget('jqgrid',tablename,col_width=80,width=900,height=500)}}
> {{pass}}
>
> And that not solve the pb I decribe in most detail.
>
> Richard
>
> On Thu, Sep 30, 2010 at 3:41 PM, Bruno Rocha <rochacbr...@gmail.com> wrote:
> > Thats not the best way, but I do:
>
> > ``{{if auth.is_logged_in():}}``:template
> > ``table:xxxx``:jqgrid
> > ``{{pass}}``:template
>
> > Ugly, but works.
>
> > 2010/9/30 Richard Vézina <ml.richard.vez...@gmail.com>

Bruno Rocha

unread,
Sep 30, 2010, 4:54:58 PM9/30/10
to web...@googlegroups.com
2010/9/30 mdipierro <mdip...@cs.depaul.edu>
I see. The problem is that the user has been logged off. the callback
knows but the page no because was not reloaded.

let me think about this one. Suggestions are welcome.

What if the ajaxcallback changes the HTTP header location? which will redirect the page to the login page.
 

Massimo

Bruno Rocha

unread,
Sep 30, 2010, 5:08:42 PM9/30/10
to web...@googlegroups.com
when session has expired ajax callback function could return this script:

window.location = 'user'

then user will be redirected to login page

That works for me




2010/9/30 Bruno Rocha <rocha...@gmail.com>



--

http://rochacbruno.com.br
Reply all
Reply to author
Forward
0 new messages