From 22057af92d466055718e3cb4cccebe20e28ee505 Mon Sep 17 00:00:00 2001
From: xuechen5 <xuechen5@illinois.edu>
Date: Tue, 3 Nov 2020 07:39:52 -0600
Subject: [PATCH] Added security-role for PreRegistered Patient

---
 iTrust/WebRoot/WEB-INF/web.xml                | 27 ++++++++++++++++++-
 .../src/edu/ncsu/csc/itrust/enums/Role.java   |  4 ++-
 2 files changed, 29 insertions(+), 2 deletions(-)

diff --git a/iTrust/WebRoot/WEB-INF/web.xml b/iTrust/WebRoot/WEB-INF/web.xml
index 85aff0a..aa258d6 100644
--- a/iTrust/WebRoot/WEB-INF/web.xml
+++ b/iTrust/WebRoot/WEB-INF/web.xml
@@ -84,7 +84,11 @@
 	</security-role>
 	<security-role>
 		<role-name>tester</role-name>
-	</security-role>		
+	</security-role>
+	
+	<security-role>
+		<role-name>preRegisteredPatient</role-name>
+	</security-role>	
 
 
 	<!-- Define all role-based authorization folders
@@ -95,6 +99,7 @@
 		/auth/admin/*         - JSPs for Administrators only
 		/auth/staff/*         - JSPs for only hospital staff (hcps, uaps, admin, lt)
 		/auth/patient/*       - JSPs for patients only
+		/auth/preRegisteredPatient/*       - JSPs for preRegisteredPatients only
 		/auth/lt/*       	  - JSPs for LTs only
 		
 		If any user attempts to access a folder that their role is not authorized for, 
@@ -126,6 +131,9 @@
 			<role-name>tester</role-name>
 			<role-name>pha</role-name>
 			<role-name>lt</role-name>
+			
+			<role-name>preRegisteredPatient</role-name>
+			
 		</auth-constraint>
 	</security-constraint>
 
@@ -278,6 +286,23 @@
 		</auth-constraint>
 	</security-constraint>
 	
+	
+	<security-constraint>
+		<display-name>PreRegisteredPatient Only</display-name>
+		<web-resource-collection>
+			<web-resource-name>
+				Only PreRegisteredPatient are Allowed
+			</web-resource-name>
+			<!-- Define the context-relative URL(s) to be protected -->
+			<url-pattern>/auth/preRegisteredPatient/*</url-pattern>
+		</web-resource-collection>
+		<auth-constraint>
+			<!-- Anyone with one of the listed roles may access this area -->
+			<role-name>preRegisteredPatient</role-name>
+		</auth-constraint>
+	</security-constraint>
+	
+	
 	<security-constraint>
 		<display-name>PHA Only</display-name>
 		<web-resource-collection>
diff --git a/iTrust/src/edu/ncsu/csc/itrust/enums/Role.java b/iTrust/src/edu/ncsu/csc/itrust/enums/Role.java
index 7449b84..4e22329 100644
--- a/iTrust/src/edu/ncsu/csc/itrust/enums/Role.java
+++ b/iTrust/src/edu/ncsu/csc/itrust/enums/Role.java
@@ -1,10 +1,12 @@
 package edu.ncsu.csc.itrust.enums;
 
 /**
- * The iTrust user roles: Patient, ER, HCP, UAP, LT, PHA, Administrator and Tester.
+ * The iTrust user roles: Pre-registered Patient, Patient, ER, HCP, UAP, LT, PHA, Administrator and Tester.
  * Consult the requirements for the contextual meanings of these individual choices.
  */
 public enum Role {
+	/**PRE-REGISTERED PATIENT*/
+	PREREGISTEREDPATIENT("preRegisteredPatient", "Patients", 0L), 
 	/**PATIENT*/
 	PATIENT("patient", "Patients", 0L), 
 	/**ER*/
-- 
GitLab