Ir al contenido
Menú
Se marcó esta pregunta
1 Responder
5747 Vistas

I am trying to make my website private only. 

I have seen some older solutions. I'm on V15. Is there an updated way to do this?

Avatar
Descartar
Mejor respuesta

Hi Brent:

You can make "pages" private by setting the "Visibility" in the page properties to anything other than "Public". 

You can access the page properties by going to Pages > Manage Pages, and selecting the "gear" icon next to the page that you want to make private.

If you need to make dynamically generated content like the Shop private, that can done by customizing the controller class for that page and setting auth="user" on the route definition.


EDIT (in response to Ricardo's question):

The Shop pages are dynamically generated using a controller class. 

https://github.com/odoo/odoo/blob/15.0/addons/website_sale/controllers/main.py#L219

The access control for the out of the box controller class is defined as public (auth="public"). If you extend the class and set auth="user", the Shop will be accessible only to logged in users.

Here's an example of how to extend a controller class.

https://github.com/odoo/odoo/blob/15.0/addons/website_sale/controllers/main.py#L125

Hope this helps.

Avatar
Descartar
Autor

This worked perfectly.

I was trying to do it from the back-end.

Hi Paresh
"If you need to make dynamically generated content like the Shop private, that can done by customizing the controller class for that page and setting auth="user" on the route definition".

Can you please specify more about limiting access to the shop?

Thanks

Hi Ricardo,

I had come across this post on limiting access to the shopping pages.
https://www.odoo.com/forum/help-1/how-to-hide-shop-and-cart-for-non-logged-users-on-the-website-192424#answer-192425

It works, though at time it is a bit misleading to a non logged in user as it brings up blank page.

Hope this helps!

Best regards
Jaideep

@Ricardo: I have posted an update to my earlier post in response to your questions.

Publicaciones relacionadas Respuestas Vistas Actividad
1
ago 23
4948
1
jul 25
529
2
jun 25
2171
3
abr 25
2426
1
abr 25
1549