feat: content not visible to guest users

This commit is contained in:
Shivam Mishra
2019-05-29 13:11:34 +05:30
parent 87a7438d38
commit ae2871f962
5 changed files with 55 additions and 37 deletions

View File

@@ -5,15 +5,17 @@ import frappe
no_cache = 1
def get_context(context):
if frappe.session.user == "Guest":
frappe.local.flags.redirect_location = '/lms'
raise frappe.Redirect
context.course = frappe.form_dict['course']
context.topic = frappe.form_dict['topic']
content = frappe.form_dict['content']
context.content_type = frappe.form_dict['type']
context.content = frappe.get_doc(context.content_type, content).as_dict()
context.previous = get_previous_content(context.topic, context.course, context.content, context.content_type)
context.next = get_next_content(context.topic, context.course, context.content, context.content_type)
def get_next_content(topic, course, content, content_type):