Skip to Content
Menu
This question has been flagged
3 Replies
3343 Views

I need to make some pages only available to members.(logged users).

is there any (simple) way to achieve that ?

odoo v12.

Avatar
Discard
Best Answer

Hi,

Simply you can add auth="user" in the controller which render the corresponding page. Once you give the auth="user" in the route the page can be accessed only by the logged in users, if the user iis not logged in system will redirect the user to login page while accessing the same page.

Sample:

@http.route(['/my/task/<model("project.task"):task>'], type='http', auth="user", website=True)
def my_task(self, task=None, **kw):
return request.render("website_project.my_task", {'task': task, 'user': request.env.user})

Thanks

Avatar
Discard
Author Best Answer

thank you! now  I just need to know :

 where are stored the controllers for the webpages?

should I use nano to edit the controller, or may I use the web interface?

thanks in advance.

Avatar
Discard