feat: made all the cohort pages public

There is some info on the page that is only accessible to mentors and
admins and not shown to other users.
This commit is contained in:
Anand Chitipothu
2021-12-05 01:04:46 +05:30
parent fe31a64175
commit 7001ddc96f
6 changed files with 41 additions and 37 deletions

View File

@@ -3,10 +3,6 @@ from . import utils
def get_context(context):
context.no_cache = 1
if frappe.session.user == "Guest":
frappe.local.flags.redirect_location = "/login?redirect-to=" + frappe.request.path
raise frappe.Redirect()
course = utils.get_course()
cohort = course and utils.get_cohort(course, frappe.form_dict["cohort"])
if not cohort:
@@ -18,9 +14,6 @@ def get_context(context):
is_mentor = mentor is not None
is_admin = cohort.is_admin(user) or "System Manager" in frappe.get_roles()
if not is_admin and not is_mentor :
frappe.throw("Permission Deined", frappe.PermissionError)
utils.add_nav(context, "All Courses", "/courses")
utils.add_nav(context, course.title, "/courses/" + course.name)
utils.add_nav(context, "Cohorts", "/courses/" + course.name + "/manage")