feat: allow cohort admins to add mentors

Issue #271
This commit is contained in:
Anand Chitipothu
2021-12-05 02:10:58 +05:30
parent 2f994628c3
commit 3cd4e64957
4 changed files with 84 additions and 8 deletions

View File

@@ -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 {