From 964bd347051974ffe44720500a1b84cc45b2f194 Mon Sep 17 00:00:00 2001
From: Fang Lin
Date: Wed, 10 Jul 2024 12:52:45 -0700
Subject: [PATCH] Feat/muwm 5342 (#3124)
MUWM-5342: enhance support page
---
.github/workflows/cicd.yml | 3 +-
docker/settings.py | 12 +-
docker/urls.py | 2 +-
myuw/data/quicklinks.csv | 6 +-
myuw/data/resource_link_import.csv | 2 +-
.../restclients/customform/_common/netid.html | 2 +-
.../restclients/customform/_common/regid.html | 4 +-
.../restclients/customform/book/iacourse.html | 9 -
.../grad/services/students/v1/api/id.html | 4 +-
.../customform/iasystem/evaluation.html | 4 +-
.../restclients/customform/myplan/index.html | 2 +-
.../restclients/customform/sws/advisers.html | 11 --
.../restclients/customform/sws/course.html | 43 +++++
.../restclients/customform/sws/degree.html | 13 --
.../restclients/customform/sws/notices.html | 12 --
.../restclients/customform/sws/student.html | 41 +++++
.../supporttools/custom_sidebar_links.html | 91 +++++-----
myuw/test/views/test_rest_search.py | 161 +++++++++++++++++-
myuw/views/rest_search.py | 108 +++++++++---
package.json | 8 +-
setup.py | 4 +-
21 files changed, 393 insertions(+), 149 deletions(-)
delete mode 100644 myuw/templates/restclients/customform/sws/advisers.html
create mode 100644 myuw/templates/restclients/customform/sws/course.html
delete mode 100644 myuw/templates/restclients/customform/sws/degree.html
delete mode 100644 myuw/templates/restclients/customform/sws/notices.html
create mode 100644 myuw/templates/restclients/customform/sws/student.html
diff --git a/.github/workflows/cicd.yml b/.github/workflows/cicd.yml
index eb95dc453b..404ffc650d 100644
--- a/.github/workflows/cicd.yml
+++ b/.github/workflows/cicd.yml
@@ -159,7 +159,7 @@ jobs:
runs-on: ubuntu-22.04
container:
- image: node:14.6.0-stretch
+ image: node:20
steps:
- name: Checkout Repo
@@ -183,6 +183,7 @@ jobs:
container:
image: cypress/browsers:node14.16.0-chrome90-ff88
+ # this image works. later images failed
steps:
- name: Checkout Repo
diff --git a/docker/settings.py b/docker/settings.py
index e39df8196e..46cb8208ed 100644
--- a/docker/settings.py
+++ b/docker/settings.py
@@ -10,15 +10,15 @@
INSTALLED_APPS += [
'uw_oidc',
- 'compressor',
- 'django_client_logger',
'django_user_agents',
- 'hx_toolkit',
- 'persistent_message',
- 'rc_django',
- 'userservice',
'supporttools',
+ 'userservice',
+ 'rc_django', # after supporttools
+ 'persistent_message',
'blti',
+ 'hx_toolkit',
+ 'compressor',
+ 'django_client_logger',
'myuw.apps.MyUWConfig',
'webpack_loader',
]
diff --git a/docker/urls.py b/docker/urls.py
index 5054d1808c..8a5e4cf759 100644
--- a/docker/urls.py
+++ b/docker/urls.py
@@ -6,9 +6,9 @@
urlpatterns += [
+ re_path(r'^', include('myuw.urls')),
re_path(r'^support', include('userservice.urls')),
re_path(r'^restclients/', include('rc_django.urls')),
re_path(r'^persistent_message/', include('persistent_message.urls')),
re_path(r'^logging/', include('django_client_logger.urls')),
- re_path(r'^', include('myuw.urls')),
]
diff --git a/myuw/data/quicklinks.csv b/myuw/data/quicklinks.csv
index 00537a6c51..6cc5725b3b 100644
--- a/myuw/data/quicklinks.csv
+++ b/myuw/data/quicklinks.csv
@@ -15,11 +15,11 @@ http://www.washington.edu/students/timeschd/T/,Time Schedule - Tacoma,tacoma,stu
http://www.washington.edu/students/timeschd/95index.html,Time Schedule - PCE,,student,yes
https://wellbeing.uw.edu/,Husky Health & Well-Being,seattle,student,
https://scout.uw.edu,Scout,,student,
-https://gsuite.google.com/dashboard,Google Apps,,student,
+https://itconnect.uw.edu/tools-services-support/software-computers/productivity-platforms/google-productivity-platform/,Google Apps,,student,
https://www.office.com/,Office 365 Apps,,student,
-https://gsuite.google.com/dashboard,Google Apps,,faculty,
+https://itconnect.uw.edu/tools-services-support/software-computers/productivity-platforms/google-productivity-platform/,Google Apps,,faculty,
https://www.office.com/,Office 365 Apps,,faculty,
-https://gsuite.google.com/dashboard,Google Apps,,employee,
+https://itconnect.uw.edu/tools-services-support/software-computers/productivity-platforms/google-productivity-platform/,Google Apps,,employee,
https://www.office.com/,Office 365 Apps,,employee,
https://washington.zoom.us/,Zoom,,,
https://uwnetid.washington.edu/manage/?forward,Email Forwarding,,alumni,
diff --git a/myuw/data/resource_link_import.csv b/myuw/data/resource_link_import.csv
index 05319fcb50..cf68dbf2a8 100644
--- a/myuw/data/resource_link_import.csv
+++ b/myuw/data/resource_link_import.csv
@@ -37,7 +37,7 @@ Academics,Tools and Software,all,https://uw.hosted.panopto.com/,Panopto Lecture
Academics,Tools and Software,all,https://itconnect.uw.edu/tools-services-support/software-computers/uware/,Other Software and Hardware Services,,,,,,,no
Academics,Tools and Software,all,https://itconnect.uw.edu/learn/tools/,Help with Teaching and Learning Tools,,,,,,,no
Academics,Tools and Software,all,http://www.linkedinlearning.uw.edu/,LinkedIn Learning,,,,,,,no
-Academics,Tools and Software,all,https://gsuite.google.com/dashboard,Google Apps,,,,,,,no
+Academics,Tools and Software,all,https://itconnect.uw.edu/tools-services-support/software-computers/productivity-platforms/google-productivity-platform/,Google Apps,,,,,,,no
Academics,Tools and Software,all,https://www.office.com/,Office 365 Apps,,,,,,,no
"Email, and Accounts and Identity",Email,all,https://outlook.office365.com/uw.edu,UW Office 365 Email,,,,,,,no
"Email, and Accounts and Identity",Email,all,http://mail.google.com/a/uw.edu,UW Gmail,,,,,,,no
diff --git a/myuw/templates/restclients/customform/_common/netid.html b/myuw/templates/restclients/customform/_common/netid.html
index c86144e665..0e2909fc3f 100644
--- a/myuw/templates/restclients/customform/_common/netid.html
+++ b/myuw/templates/restclients/customform/_common/netid.html
@@ -2,7 +2,7 @@
{% csrf_token %}
-
+
diff --git a/myuw/templates/restclients/customform/_common/regid.html b/myuw/templates/restclients/customform/_common/regid.html
index 267b12a7d0..cdada96d6c 100644
--- a/myuw/templates/restclients/customform/_common/regid.html
+++ b/myuw/templates/restclients/customform/_common/regid.html
@@ -1,8 +1,8 @@
-
+
-
+
diff --git a/myuw/templates/restclients/customform/myplan/index.html b/myuw/templates/restclients/customform/myplan/index.html
index 22612bea78..1488bea24d 100644
--- a/myuw/templates/restclients/customform/myplan/index.html
+++ b/myuw/templates/restclients/customform/myplan/index.html
@@ -2,7 +2,7 @@ MyPlan
diff --git a/myuw/templates/restclients/customform/sws/degree.html b/myuw/templates/restclients/customform/sws/degree.html
deleted file mode 100644
index 4662b92946..0000000000
--- a/myuw/templates/restclients/customform/sws/degree.html
+++ /dev/null
@@ -1,13 +0,0 @@
-SWS Degree Status
-{% include "restclients/customform/_common/regid.html" %}
-
-Regids:
-
- - javerage: 9136CCB8F66711D5BE060004AC494FFE
- - javg001: 9136CCB8F66711D5BE060004AC494001
- - javg002: 9136CCB8F66711D5BE060004AC494002
- - javg003: 9136CCB8F66711D5BE060004AC494003
- - javg004: 9136CCB8F66711D5BE060004AC494004
- - jbothell: FE36CCB8F66711D5BE060004AC494FCD
- - eight: 12345678901234567890123456789012
-
diff --git a/myuw/templates/restclients/customform/sws/notices.html b/myuw/templates/restclients/customform/sws/notices.html
deleted file mode 100644
index da8e053305..0000000000
--- a/myuw/templates/restclients/customform/sws/notices.html
+++ /dev/null
@@ -1,12 +0,0 @@
-SWS Student Notices
-{% include "restclients/customform/_common/regid.html" %}
-
-Regids:
-
- - japplicant: 9136CCB8F66711D5BE060004AC494DDD
- - javerage: 9136CCB8F66711D5BE060004AC494FFE
- - jbothell: FE36CCB8F66711D5BE060004AC494FCD
- - jinter: 9136CCB8F66711D5BE060004AC494F31
- - jnew: FE36CCB8F66711D5BE060004AC494F31
- - eight: 12345678901234567890123456789012
-
diff --git a/myuw/templates/restclients/customform/sws/student.html b/myuw/templates/restclients/customform/sws/student.html
new file mode 100644
index 0000000000..4b8c3f9cf6
--- /dev/null
+++ b/myuw/templates/restclients/customform/sws/student.html
@@ -0,0 +1,41 @@
+SWS Student
+
+
diff --git a/myuw/templates/supporttools/custom_sidebar_links.html b/myuw/templates/supporttools/custom_sidebar_links.html
index c63ec7fd77..7ff298af14 100644
--- a/myuw/templates/supporttools/custom_sidebar_links.html
+++ b/myuw/templates/supporttools/custom_sidebar_links.html
@@ -33,21 +33,18 @@ Content Management
Web Services
- {% url 'restclients_proxy' 'sws' 'student/v5.json' as sws_url %}
- {% if sws_url %}
- - {{ restclients_sws_link|default:"Browse Student Web Service" }}
- {% endif %}
-
- {% url 'restclients_proxy' 'pws' 'identity/v2.json' as pws_url %}
- {% if pws_url %}
- - {{ restclients_pws_link|default:"Browse Person Web Service" }}
+ {% url 'myuw_rest_search' 'sws' 'course.html' as course_url %}
+ {% if course_url %}
+ -
+ SWS Course
+
{% endif %}
-
- {% url 'restclients_proxy' 'gws' 'group_sws/v3/search' as gws_url %}
- {% if gws_url %}
- -
- {{ restclients_gws_link|default:"Search Groups Web Service" }}
-
+
+ {% url 'myuw_rest_search' 'sws' 'student.html' as student_url %}
+ {% if student_url %}
+ -
+ SWS Student
+
{% endif %}
{% url 'myuw_rest_search' 'hfs' 'accounts.html' as hfs_url %}
@@ -57,6 +54,13 @@ Web Services
{% endif %}
+ {% url 'myuw_rest_search' 'book' 'iacourse.html' as iacourse_url %}
+ {% if iacourse_url %}
+ -
+ IA Course Digital Materials
+
+ {% endif %}
+
{% url 'myuw_rest_search' 'iasystem' 'index.html' as ias_url %}
{% if ias_url %}
-
@@ -64,13 +68,6 @@
Web Services
{% endif %}
- {% url 'restclients_proxy' 'pws' 'idcard/v1/photo' as idcard_url %}
- {% if idcard_url %}
- -
- {{ restclients_pws_link|default:"ID Photo Search" }}
-
- {% endif %}
-
{% url 'myuw_rest_search' 'libcurrics' 'index.html' as libcurrics_url %}
{% if libcurrics_url %}
-
@@ -99,27 +96,6 @@
Web Services
{% endif %}
- {% url 'myuw_rest_search' 'sws' 'notices.html' as notices_url %}
- {% if notices_url %}
- -
- Notices
-
- {% endif %}
-
- {% url 'myuw_rest_search' 'sws' 'advisers.html' as advisers_url %}
- {% if advisers_url %}
- -
- Undergrad Academic Advisers
-
- {% endif %}
-
- {% url 'myuw_rest_search' 'sws' 'degree.html' as degree_url %}
- {% if degree_url %}
- -
- Undergrad Degree Status
-
- {% endif %}
-
{% url 'myuw_rest_search' 'uwnetid' 'password.html' as pw_url %}
{% if pw_url %}
-
@@ -141,19 +117,36 @@
Web Services
{% endif %}
- {% url 'myuw_rest_search' 'book' 'iacourse.html' as iacourse_url %}
- {% if iacourse_url %}
- -
- IA Courses
-
- {% endif %}
-
{% url 'myuw_rest_search' 'upass' 'index.html' as upass_url %}
{% if upass_url %}
-
UPASS
{% endif %}
+
+ {% url 'restclients_proxy' 'sws' 'student/v5.json' as sws_url %}
+ {% if sws_url %}
+ - {{ restclients_sws_link|default:"Browse Student Web Service" }}
+ {% endif %}
+
+ {% url 'restclients_proxy' 'pws' 'identity/v2.json' as pws_url %}
+ {% if pws_url %}
+ - {{ restclients_pws_link|default:"Browse Person Web Service" }}
+ {% endif %}
+
+ {% url 'restclients_proxy' 'gws' 'group_sws/v3/search' as gws_url %}
+ {% if gws_url %}
+ -
+ {{ restclients_gws_link|default:"Search Groups Web Service" }}
+
+ {% endif %}
+
+ {% url 'restclients_proxy' 'pws' 'idcard/v1/photo' as idcard_url %}
+ {% if idcard_url %}
+ -
+ {{ restclients_pws_link|default:"ID Photo Search" }}
+
+ {% endif %}
{% url 'restclients_errors' as url %}
diff --git a/myuw/test/views/test_rest_search.py b/myuw/test/views/test_rest_search.py
index 7ed54763bf..36362b6b11 100644
--- a/myuw/test/views/test_rest_search.py
+++ b/myuw/test/views/test_rest_search.py
@@ -5,14 +5,44 @@
from django.test.utils import override_settings
from django.urls import reverse
from myuw.test.api import MyuwApiTest
+from myuw.views.rest_search import (
+ get_input_value, get_regid, get_employee_number, get_student_number,
+ get_student_system_key
+)
@override_settings(
RESTCLIENTS_ADMIN_AUTH_MODULE='rc_django.tests.can_proxy_restclient')
class RestSearchViewTest(MyuwApiTest):
+ def test_get_regid(self):
+ self.assertEqual(
+ get_regid("javerage"), "9136CCB8F66711D5BE060004AC494FFE")
+ self.assertEqual(
+ get_regid("9136CCB8F66711D5BE060004AC494FFE"),
+ "9136CCB8F66711D5BE060004AC494FFE")
+
+ def test_get_employee_number(self):
+ self.assertEqual(
+ get_employee_number("javerage"), "123456789")
+ self.assertEqual(
+ get_employee_number("123456789"), "123456789")
+
+ def test_get_student_number(self):
+ self.assertEqual(
+ get_student_number("javerage"), "1033334")
+ self.assertEqual(
+ get_student_number("1033334"), "1033334")
+
+ def test_get_student_system_key(self):
+ self.assertEqual(
+ get_student_system_key("javerage"), "000083856")
+ self.assertEqual(
+ get_student_system_key("000083856"), "000083856")
+
def test_post(self):
self.set_user('javerage')
+ self.assertEqual(get_input_value({}, "uwnetid"), "")
# hfs
url = reverse("myuw_rest_search", args=["hfs", "accounts"])
@@ -21,7 +51,15 @@ def test_post(self):
self.assertEqual(
response.url, "/restclients/view/hfs/myuw/v1/javerage")
- # bookstore
+ # iacourses
+ url = reverse("myuw_rest_search", args=["book", "iacourse"])
+ response = self.client.post(url, {"uwregid": "javerage"})
+ self.assertEqual(response.status_code, 302)
+ self.assertEqual(response.url, (
+ "/restclients/view/book/uw/iacourse_status.json%3Fregid="
+ "9136CCB8F66711D5BE060004AC494FFE"))
+
+ # book
url = reverse("myuw_rest_search", args=["book", "index"])
response = self.client.post(url, {
"sln1": "123", "quarter": "spring", "returnlink": "t"})
@@ -33,11 +71,12 @@ def test_post(self):
# myplan
url = reverse("myuw_rest_search", args=["myplan", "index"])
response = self.client.post(url, {
- "uwregid": "ABC", "year": "2013", "quarter": "spring"})
+ "uwregid": "javerage", "year": "2013", "quarter": "spring"})
self.assertEqual(response.status_code, 302)
self.assertEqual(
response.url,
- "/restclients/view/myplan/plan/v1/2013,spring,1,ABC")
+ "/restclients/view/myplan/plan/v1/2013,spring,1," +
+ "9136CCB8F66711D5BE060004AC494FFE")
# libraries
url = reverse("myuw_rest_search", args=["libraries", "accounts"])
@@ -50,11 +89,31 @@ def test_post(self):
# iasystem
url = reverse("myuw_rest_search", args=[
"iasystem_uw", "uw/api/v1/evaluation"])
- response = self.client.post(url, {"student_id": "123456"})
+ response = self.client.post(
+ url,
+ {
+ 'term_name': 'Winter', 'curriculum_abbreviation': 'TRAIN',
+ 'course_number': '100', 'section_id': 'A', 'year': '2013',
+ 'instructor_id': '', 'student_id': 'javerage'
+ })
self.assertEqual(response.status_code, 302)
self.assertEqual(response.url, (
- "/restclients/view/iasystem_uw/api/" +
- "v1/evaluation?student_id=123456"))
+ "/restclients/view/iasystem_uw/api/v1/evaluation?term_name=" +
+ "Winter&curriculum_abbreviation=TRAIN&course_number=100&" +
+ "section_id=A&year=2013&instructor_id=&student_id=1033334"))
+
+ response = self.client.post(
+ url,
+ {
+ 'term_name': 'Winter', 'curriculum_abbreviation': 'TRAIN',
+ 'course_number': '100', 'section_id': 'A', 'year': '2013',
+ 'instructor_id': 'bill', 'student_id': ''
+ })
+ self.assertEqual(response.status_code, 302)
+ self.assertEqual(response.url, (
+ "/restclients/view/iasystem_uw/api/v1/evaluation?term_name=" +
+ "Winter&curriculum_abbreviation=TRAIN&course_number=100&" +
+ "section_id=A&year=2013&instructor_id=123456782&student_id="))
# uwnetid
url = reverse("myuw_rest_search", args=["uwnetid", "password"])
@@ -76,22 +135,106 @@ def test_post(self):
url = reverse("myuw_rest_search", args=[
"grad", "services/students/v1/api/committee"])
response = self.client.post(url, {
- "id": "12345", "csrfmiddlewaretoken": "0000000"})
+ "id": "seagrad", "csrfmiddlewaretoken": "0000000"})
self.assertEqual(response.status_code, 302)
self.assertEqual(response.url, (
"/restclients/view/grad/services/" +
- "students/v1/api/committee?id=12345"))
+ "students/v1/api/committee?id=001000002"))
# notices
- url = reverse("myuw_rest_search", args=["sws", "notices"])
+ url = reverse("myuw_rest_search", args=["sws", "student"])
response = self.client.post(url, {
"uwregid": "12345678123456781234567812345678",
+ "res": 'notice',
"csrfmiddlewaretoken": "0000000"})
self.assertEqual(response.status_code, 302)
self.assertEqual(response.url, (
"/restclients/view/sws/student/v5/notice/" +
"12345678123456781234567812345678.json"))
+ # person
+ url = reverse("myuw_rest_search", args=["sws", "student"])
+ response = self.client.post(url, {
+ "uwregid": "12345678123456781234567812345678",
+ "res": 'person',
+ "csrfmiddlewaretoken": "0000000"})
+ self.assertEqual(response.status_code, 302)
+ self.assertEqual(response.url, (
+ "/restclients/view/sws/student/v5/person/" +
+ "12345678123456781234567812345678.json"))
+
+ # degree
+ url = reverse("myuw_rest_search", args=["sws", "student"])
+ response = self.client.post(url, {
+ "uwregid": "12345678123456781234567812345678",
+ "res": 'degree',
+ "csrfmiddlewaretoken": "0000000"})
+ self.assertEqual(response.status_code, 302)
+ self.assertEqual(response.url, (
+ "/restclients/view/sws/student/v5/person/" +
+ "12345678123456781234567812345678/degree.json%3Fdeg_status=all"))
+
+ # adviser
+ url = reverse("myuw_rest_search", args=["sws", "student"])
+ response = self.client.post(url, {
+ "uwregid": "12345678123456781234567812345678",
+ "res": 'adviser',
+ "csrfmiddlewaretoken": "0000000"})
+ self.assertEqual(response.status_code, 302)
+ self.assertEqual(response.url, (
+ "/restclients/view/sws/student/v5/person/" +
+ "12345678123456781234567812345678/advisers.json"))
+
+ # Financial
+ url = reverse("myuw_rest_search", args=["sws", "student"])
+ response = self.client.post(url, {
+ "uwregid": "12345678123456781234567812345678",
+ "res": 'financial',
+ "csrfmiddlewaretoken": "0000000"})
+ self.assertEqual(response.status_code, 302)
+ self.assertEqual(response.url, (
+ "/restclients/view/sws/student/v5/person/" +
+ "12345678123456781234567812345678/financial.json"))
+ self.maxDiff = None
+
+ # enrollment
+ url = reverse("myuw_rest_search", args=["sws", "student"])
+ response = self.client.post(url, {
+ "uwregid": "javerage",
+ "res": 'enrollment',
+ "csrfmiddlewaretoken": "0000000"})
+ self.assertEqual(response.status_code, 302)
+ self.assertEqual(response.url, (
+ "/restclients/view/sws/student/v5/enrollment.json%3Freg_id=" +
+ "9136CCB8F66711D5BE060004AC494FFE&" +
+ "transcriptable_course=all&verbose=true"))
+
+ # Course section
+ url = reverse("myuw_rest_search", args=["sws", "course"])
+ response = self.client.post(url, {
+ "uwregid": "12345678123456781234567812345678",
+ "quarter": 'spring',
+ "year": 2013,
+ "csrfmiddlewaretoken": "0000000"})
+ self.assertEqual(response.status_code, 302)
+ self.assertEqual(response.url, (
+ "/restclients/view/sws/student/v5/section.json%3Fyear=2013&" +
+ "quarter=spring&future_terms=2&curriculum_abbreviation=&" +
+ "course_number=®_id=12345678123456781234567812345678&" +
+ "search_by=Instructor&include_secondaries=on&" +
+ "sln=&transcriptable_course=all"))
+ response = self.client.post(url, {
+ "sln": "12345",
+ "quarter": 'spring',
+ "year": 2013,
+ "csrfmiddlewaretoken": "0000000"})
+ self.assertEqual(response.status_code, 302)
+ self.assertEqual(response.url, (
+ "/restclients/view/sws/student/v5/section.json%3Fyear=2013&" +
+ "quarter=spring&future_terms=2&curriculum_abbreviation=&" +
+ "course_number=®_id=&search_by=&include_secondaries=on&" +
+ "sln=12345&transcriptable_course=all"))
+
# upass
url = reverse("myuw_rest_search", args=["upass", "index"])
response = self.client.post(url, {
diff --git a/myuw/views/rest_search.py b/myuw/views/rest_search.py
index 9cfe9c7442..55daad6bbc 100644
--- a/myuw/views/rest_search.py
+++ b/myuw/views/rest_search.py
@@ -4,6 +4,7 @@
import logging
import re
from rc_django.views.rest_proxy import RestSearchView
+from myuw.dao.pws import pws
logger = logging.getLogger(__name__)
@@ -25,17 +26,19 @@ def get_proxy_url(self, request, service, url):
if service == "book":
if "iacourse" == url:
url = "uw/iacourse_status.json?regid={}".format(
- request.POST["uwregid"])
+ get_regid(get_input_value(request.POST, "uwregid")))
else:
url = "uw/json_utf8_202007.ubs"
url = "{}?quarter={}&sln1={}&returnlink=t".format(
"uw/json_utf8_202007.ubs",
- request.POST["quarter"],
- request.POST["sln1"])
+ get_input_value(request.POST, "quarter"),
+ get_input_value(request.POST, "sln1"))
elif service == "grad":
params = self.format_params(request)
+ params['id'] = get_student_system_key(params['id'])
elif service == "hfs":
- url = "myuw/v1/{}".format(request.POST["uwnetid"])
+ url = "myuw/v1/{}".format(
+ get_input_value(request.POST, "uwnetid"))
elif re.match(r'^iasystem', service):
if url.endswith('/evaluation'):
index = url.find('/')
@@ -43,34 +46,99 @@ def get_proxy_url(self, request, service, url):
index += 1
url = url[index:]
params = self.format_params(request)
+ if len(params['instructor_id']) > 0:
+ params['instructor_id'] = get_employee_number(
+ params['instructor_id'].strip())
+ if len(params['student_id']) > 0:
+ params['student_id'] = get_student_number(
+ params['student_id'].strip())
+
elif service == "myplan":
url = "plan/v1/{},{},1,{}".format(
- request.POST["year"],
- request.POST["quarter"],
- request.POST["uwregid"])
- elif service == "sws":
- if "advisers" == url:
- url = "student/v5/person/{}/advisers.json".format(
- request.POST["uwregid"])
- elif "degree" == url:
- url = "student/v5/person/{}/degree.json?deg_status=all".format(
- request.POST["uwregid"])
- elif "notices" == url:
- url = "student/v5/notice/{}.json".format(
- request.POST["uwregid"])
+ get_input_value(request.POST, "year"),
+ get_input_value(request.POST, "quarter"),
+ get_regid(get_input_value(request.POST, "uwregid")))
+
+ elif service == "sws" and "course" == url:
+ year = get_input_value(request.POST, "year")
+ quarter = get_input_value(request.POST, "quarter")
+ cabbr = get_input_value(request.POST, "curriculum_abbreviation")
+ course_number = get_input_value(request.POST, "course_number")
+ sln = get_input_value(request.POST, "sln")
+ regid = get_input_value(request.POST, "uwregid")
+ if len(regid) > 0:
+ regid = get_regid(regid)
+ search_by = "Instructor"
+ else:
+ search_by = ""
+ url = (
+ f"student/v5/section.json?year={year}&quarter={quarter}&" +
+ f"future_terms=2&curriculum_abbreviation={cabbr}&" +
+ f"course_number={course_number}®_id={regid}&" +
+ f"search_by={search_by}&include_secondaries=on&" +
+ f"sln={sln}&transcriptable_course=all")
+ elif service == "sws" and "student" == url:
+ regid = get_regid(get_input_value(request.POST, "uwregid"))
+ res = get_input_value(request.POST, "res")
+ if "adviser" == res:
+ url = f"student/v5/person/{regid}/advisers.json"
+ elif "degree" == res:
+ url = f"student/v5/person/{regid}/degree.json?deg_status=all"
+ elif "enrollment" == res:
+ url = "student/v5/{}={}{}".format(
+ "enrollment.json?reg_id",
+ regid,
+ "&transcriptable_course=all&verbose=true")
+ elif "financial" == res:
+ url = f"student/v5/person/{regid}/financial.json"
+ elif "notice" == res:
+ url = f"student/v5/notice/{regid}.json"
+ elif "person" == res:
+ url = f"student/v5/person/{regid}.json"
+
elif service == "upass":
url = "upassdataws/api/person/v1/membershipstatus/{}".format(
- request.POST["uwnetid"])
+ get_input_value(request.POST, "uwnetid"))
elif service == "uwnetid":
if "password" == url:
url = "nws/v1/uwnetid/{}/password".format(
- request.POST["uwnetid"])
+ get_input_value(request.POST, "uwnetid"))
elif "subscription" == url:
url = "nws/v1/uwnetid/{}/subscription/60,64,105".format(
- request.POST["uwnetid"])
+ get_input_value(request.POST, "uwnetid"))
else:
service, url, params = super().get_proxy_url(request, service, url)
logger.debug(
"Exit MyUWRestProxyView url: {}".format(url))
return service, url, params
+
+
+def get_input_value(post_req, name):
+ if name in post_req and len(post_req[name]):
+ return post_req[name].strip()
+ return ''
+
+
+def get_regid(userid):
+ if userid and len(userid) == 32:
+ return userid
+ return pws.get_person_by_netid(userid).uwregid
+
+
+def get_employee_number(userid):
+ if userid and userid.isdigit():
+ return userid
+ return pws.get_person_by_netid(userid).employee_id
+
+
+def get_student_number(userid):
+ if userid and userid.isdigit():
+ return userid
+ return pws.get_person_by_netid(userid).student_number
+
+
+def get_student_system_key(userid):
+ if userid and userid.isdigit():
+ return userid
+ return pws.get_person_by_netid(userid).student_system_key
diff --git a/package.json b/package.json
index 6379332a3f..d10c4b59f9 100644
--- a/package.json
+++ b/package.json
@@ -49,11 +49,11 @@
"coveralls": "3.1.0",
"css.escape": "1.5.1",
"cypress": "7.7.0",
- "eslint": "7.30.0",
+ "eslint": "7.32.0",
"eslint-config-google": "0.14.0",
- "eslint-config-prettier": "7.1.0",
- "eslint-plugin-jest": "24.3.6",
- "eslint-plugin-vue": "7.13.0",
+ "eslint-config-prettier": "7.2.0",
+ "eslint-plugin-jest": "24.7.0",
+ "eslint-plugin-vue": "7.20.0",
"faker": "5.5.3",
"html-webpack-plugin": "5.6.0",
"jest": "26.6.3",
diff --git a/setup.py b/setup.py
index 096407a1a8..cffbe0cce2 100644
--- a/setup.py
+++ b/setup.py
@@ -32,6 +32,7 @@
'urllib3',
'uw-memcached-clients~=1.0',
'UW-Django-SAML2~=1.8',
+ 'django-userservice~=3.1',
'aws-message-client~=1.6',
'UW-RestClients-Core~=1.4',
'UW-RestClients-Bookstore~=1.3',
@@ -52,11 +53,10 @@
'UW-RestClients-Trumba~=1.4',
'UW-RestClients-UPass~=2.1',
'UW-RestClients-UWNetID~=1.1',
- 'django-userservice~=3.1',
- 'UW-RestClients-Django-Utils~=2.3',
'Uw-Django-Oidc<1.0',
'Django-SupportTools~=3.6',
'Django-Persistent-Message~=1.3',
+ 'UW-RestClients-Django-Utils~=2.3',
'Django-Safe-EmailBackend~=1.2',
'django_client_logger~=3.1',
'UW-HX-Toolkit~=2.7',