Can you show the code where you are calling the add_product() method? Using 
the @auth.requires_login() decorator is not the only way to control access. 
You can also do "if auth.user:" to test for login before allowing a method 
to be called.

Anthony

On Sunday, April 14, 2013 7:06:15 AM UTC-4, Reza Shah wrote:
>
> Hi,
>
> I'm learning web2py and i want to put my business logic inside a class in 
> module.
> I like to have a behaviour similar to user controller inside default.py 
> which exposes several functions.
>
> I have a controller item which i put inside default.py
> def item():
>      return dict(form=product())
>
> in module i create product class
>
> class Product(object):
>      def __init__:
>
>      def list(self):
>
>      @auth.requires_login()
>      def add_product(self):
>
> The Product.list function can be accessed by anyone, but for adding new 
> product need user login first.
> Is this possible? 
> Does the auth can used directly or i need to import something first?
>
> Thank,
> Reza
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to