@@ -13,9 +13,12 @@ def get_context(context):
|
||||
return
|
||||
|
||||
page = frappe.form_dict.get("page")
|
||||
is_admin = subgroup.is_manager(frappe.session.user) or "System Manager" in frappe.get_roles()
|
||||
is_mentor = subgroup.is_mentor(frappe.session.user)
|
||||
is_admin = cohort.is_admin(frappe.session.user) or "System Manager" in frappe.get_roles()
|
||||
|
||||
if page not in ["mentors", "students", "admin"] or (page == "admin" and not is_admin):
|
||||
if (page not in ["mentors", "students", "join-requests", "admin"]
|
||||
or (page == "join-requests" and not (is_mentor or is_admin))
|
||||
or (page == "admin" and not is_admin)):
|
||||
frappe.local.flags.redirect_location = subgroup.get_url() + "/mentors"
|
||||
raise frappe.Redirect
|
||||
|
||||
@@ -30,6 +33,7 @@ def get_context(context):
|
||||
context.stats = get_stats(subgroup)
|
||||
context.page = page
|
||||
context.is_admin = is_admin
|
||||
context.is_mentor = is_mentor
|
||||
|
||||
def get_stats(subgroup):
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user