[Solved] Issues with Private Web Page View (Web Generator)

Hi there,

This is a follow-up from this thread: Private Web View

I was previously able to limit webpage view for a page I have created.
However, I am unable to replicate this function with a page that is created using Web Generator.

Edit:
To clarify further, I was able to enforce permission in a particular page. However, the same code does not work for my individual meeting. After logout, I refresh the same link, I am still able to access the information.

Here is my python code

from future import unicode_literals
import frappe
from frappe import _
from frappe.model.document import Document
from frappe.website.website_generator import WebsiteGenerator
from frappe.website.render import clear_cache

class Meeting1(WebsiteGenerator):
website = frappe._dict(
template = “www/meeting.html”
)

def validate(self):
self.page_name = self.name.lower()
# self.validate_attendees()

@frappe.whitelist(allow_guest=False)
def get_context(self, context):
clear_cache()
check_user = 0
# if login_test():
if not context.doc.has_website_permission(“read”):
frappe.throw(_(“Not Permitted”), frappe.PermissionError)
check_user = -1

  if (check_user == 0):
  	context.parents = [{"name": "meetings", "title": "Meetings"}]

Can someone point me in the correct direction? Thank you! :slight_smile:

Maybe its cached?

Try adding

context.no_cache = True in get_context method

It works! Thank you so much @rmehta ! :slight_smile: :slight_smile: