diff --git a/hknweb/settings/common.py b/hknweb/settings/common.py index ac01a86a..7bd96123 100644 --- a/hknweb/settings/common.py +++ b/hknweb/settings/common.py @@ -15,6 +15,8 @@ from hknweb.utils import DATETIME_12_HOUR_FORMAT +from enum import Enum + # Build paths inside the project like this: os.path.join(BASE_DIR, ...) BASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) @@ -179,7 +181,49 @@ CAND_GROUP = "candidate" OFFICER_GROUP = "officer" EXEC_GROUP = "exec" - +MEMBER_GROUP = "member" + +# committee groups +ACT_GROUP = "act" +BRIDGE_GROUP = "bridge" +COMPSERV_GROUP = "compserv" +DECAL_GROUP = "decal" +INDREL_GROUP = "indrel" +PRODEV_GROUP = "prodev" +SERV_GROUP = "serv" +STUDREL_GROUP = "studrel" +TUTORING_GROUP = "tutoring" + +COMMITTEE_GROUPS = ( + ACT_GROUP, + BRIDGE_GROUP, + COMPSERV_GROUP, + DECAL_GROUP, + INDREL_GROUP, + PRODEV_GROUP, + SERV_GROUP, + STUDREL_GROUP, + TUTORING_GROUP, +) + +# exec groups +CSEC_GROUP = "csec" +PRES_GROUP = "pres" +RSEC_GROUP = "rsec" +TRES_GROUP = "tres" +IVP_GROUP = "ivp" +EVP_GROUP = "evp" +DEPREL_GROUP = "deprel" + +EXEC_GROUPS = ( + CSEC_GROUP, + PRES_GROUP, + RSEC_GROUP, + TRES_GROUP, + IVP_GROUP, + EVP_GROUP, + DEPREL_GROUP, +) # Note: both candidate and officer group should have permission to add officer challenges diff --git a/hknweb/studentservices/views.py b/hknweb/studentservices/views.py index c5ce4b9b..2a946f78 100644 --- a/hknweb/studentservices/views.py +++ b/hknweb/studentservices/views.py @@ -11,8 +11,8 @@ from hknweb.events.views.event_transactions.show_event import show_details_helper from hknweb.utils import ( allow_public_access, - login_and_access_level, GROUP_TO_ACCESSLEVEL, + login_and_committee, ) from hknweb.studentservices.models import ( CourseGuideNode, @@ -192,7 +192,7 @@ def course_description(request, slug): return render(request, "studentservices/course_description.html", context=context) -@login_and_access_level(GROUP_TO_ACCESSLEVEL["officer"]) +@login_and_committee(settings.TUTORING_GROUP) def edit_description(request, slug): course = get_object_or_404(CourseDescription, slug=slug) if request.method == "GET": @@ -211,7 +211,7 @@ def edit_description(request, slug): return render(request, "studentservices/course_edit.html", context=context) -@login_and_access_level(GROUP_TO_ACCESSLEVEL["officer"]) +@login_and_committee(settings.TUTORING_GROUP) def delete_description(request, slug): course = get_object_or_404(CourseDescription, slug=slug) diff --git a/hknweb/templates/about/people.html b/hknweb/templates/about/people.html index 6ba5a987..e0c3f978 100644 --- a/hknweb/templates/about/people.html +++ b/hknweb/templates/about/people.html @@ -17,22 +17,24 @@ } @@ -53,7 +55,7 @@ {% block content %}
- {% if is_officer %} + {% if viewer_in_bridge %}