Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
1 Rispondi
6156 Visualizzazioni

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
Abbandona
Risposta migliore

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
Abbandona
Autore

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.

Post correlati Risposte Visualizzazioni Attività
1
ago 23
5790
2
set 25
3578
1
lug 25
1172
2
giu 25
2697
3
apr 25
2808