Skip ke Konten
Menu
Pertanyaan ini telah diberikan tanda

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
Buang
Jawaban Terbai

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
Buang
Penulis

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 Terkait Replies Tampilan Aktivitas
1
Agu 23
5193
1
Jul 25
754
2
Jun 25
2349
3
Apr 25
2570
1
Apr 25
1952