@@ -4,10 +4,10 @@ |
||
4 | 4 | define("HOMEPAGE_URI_ADMIN", "https://tc.gccollab.ca/admin"); |
5 | 5 | |
6 | 6 | define("ID_TOKEN", "idToken"); |
7 | -define("ACCESS_TOKEN","accessToken"); |
|
8 | -define("REFRESH_TOKEN","refreshToken"); |
|
7 | +define("ACCESS_TOKEN", "accessToken"); |
|
8 | +define("REFRESH_TOKEN", "refreshToken"); |
|
9 | 9 | |
10 | -define("ROLE_ADMIN","administrator"); |
|
11 | -define("ROLE_APPLICANT","jobseeker"); |
|
12 | -define("ROLE_MANAGER","manager"); |
|
10 | +define("ROLE_ADMIN", "administrator"); |
|
11 | +define("ROLE_APPLICANT", "jobseeker"); |
|
12 | +define("ROLE_MANAGER", "manager"); |
|
13 | 13 | ?> |
14 | 14 | \ No newline at end of file |
@@ -78,7 +78,7 @@ |
||
78 | 78 | |
79 | 79 | //Ensure this token was meant for us |
80 | 80 | // Allow validating of keys created up a few seconds in the future, to allow for response time if we're currently waiting on a refreshing token |
81 | - $expectation = new ValidationData(time()+NETWORK_REQUEST_TIMEOUT); |
|
81 | + $expectation = new ValidationData(time() + NETWORK_REQUEST_TIMEOUT); |
|
82 | 82 | $expectation->setIssuer(OPENID_URI); |
83 | 83 | $expectation->setAudience(CLIENT_ID); |
84 | 84 | $claimIsValid = $token->validate($expectation); |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | $newUser->setUser_role(ROLE_APPLICANT); |
87 | 87 | $newUser->setIs_confirmed(true); |
88 | 88 | $user = UserController::registerUser($newUser); |
89 | - } else { |
|
89 | + }else { |
|
90 | 90 | throw Exception("Unable to access openId userInfo"); |
91 | 91 | } |
92 | 92 | return $user; |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | //if user_id is not null, then log the user in automatically |
106 | 106 | if ($existingUser) { |
107 | 107 | return $existingUser; |
108 | - } else { |
|
108 | + }else { |
|
109 | 109 | return null; |
110 | 110 | /* |
111 | 111 | //if user_id is null, then the user is not registered and we should register them automatically |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | $jobSeekerProfile = new JobSeekerProfile(); |
144 | 144 | JobSeekerController::addJobSeekerProfile($jobSeekerProfile, $userId); |
145 | 145 | } |
146 | - } else if ($user->getUser_role() === ROLE_ADMIN) { |
|
146 | + }else if ($user->getUser_role() === ROLE_ADMIN) { |
|
147 | 147 | |
148 | 148 | $userId = $user->getUser_id(); |
149 | 149 | |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | if ($oldUser->getEmail() != $updatedUser->getEmail()) { |
187 | 187 | $confEmailSent = UserController::confirmEmail($updatedUser); |
188 | 188 | $updatedUser->setIs_confirmed(false); |
189 | - } else { |
|
189 | + }else { |
|
190 | 190 | $updatedUser->setIs_confirmed($oldUser->getIs_confirmed()); |
191 | 191 | } |
192 | 192 | $updateSuccessful = UserDAO::updateUser($updatedUser); //do updates |
@@ -55,7 +55,7 @@ |
||
55 | 55 | $json = json_encode($result, JSON_PRETTY_PRINT); |
56 | 56 | echo($json); |
57 | 57 | |
58 | - } else { |
|
58 | + }else { |
|
59 | 59 | header('HTTP/1.0 401 Unauthorized'); |
60 | 60 | echo json_encode(array("failed" => 'Invalid arguments provided'), JSON_FORCE_OBJECT); |
61 | 61 | exit; |
@@ -32,11 +32,11 @@ |
||
32 | 32 | $userPermissions[] = new UserPermission(ROLE_ADMIN); |
33 | 33 | AuthenticationController::validateUser($userPermissions); |
34 | 34 | |
35 | - if(strlen($requestParams) > 1){ |
|
35 | + if (strlen($requestParams) > 1) { |
|
36 | 36 | $result = JobSeekerController::getJobSeekers(); |
37 | 37 | $json = json_encode($result, JSON_PRETTY_PRINT); |
38 | 38 | echo($json); |
39 | - } else { |
|
39 | + }else { |
|
40 | 40 | $result = array(); |
41 | 41 | $json = json_encode($result, JSON_PRETTY_PRINT); |
42 | 42 | echo($json); |
@@ -49,7 +49,7 @@ |
||
49 | 49 | $json = json_encode($fullJobApplication, JSON_PRETTY_PRINT); |
50 | 50 | echo($json); |
51 | 51 | |
52 | - } else { |
|
52 | + }else { |
|
53 | 53 | header('HTTP/1.0 400 Bad Request'); |
54 | 54 | echo json_encode(array("failed" => 'No request parameters provided'), JSON_FORCE_OBJECT); |
55 | 55 | exit; |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | $user_id_param_index = 4; |
23 | 23 | switch ($requestMethod) { |
24 | 24 | case 'GET': |
25 | - if(strlen($requestParams) > 1){ |
|
25 | + if (strlen($requestParams) > 1) { |
|
26 | 26 | //Manager Profile is public, no authentication needed |
27 | 27 | |
28 | 28 | $user_id = Utils::getParameterFromRequest($requestParams, $user_id_param_index); |
@@ -32,11 +32,11 @@ discard block |
||
32 | 32 | if ($result === false) { |
33 | 33 | header('HTTP/1.0 404 Not Found'); |
34 | 34 | echo json_encode(array("failed" => "Manager Profile does not exist for specified user"), JSON_FORCE_OBJECT); |
35 | - } else { |
|
35 | + }else { |
|
36 | 36 | $json = json_encode($result, JSON_PRETTY_PRINT); |
37 | 37 | echo($json); |
38 | 38 | } |
39 | - } else { |
|
39 | + }else { |
|
40 | 40 | $result = array(); |
41 | 41 | $json = json_encode($result, JSON_PRETTY_PRINT); |
42 | 42 | echo($json); |
@@ -29,9 +29,9 @@ discard block |
||
29 | 29 | $userId = Utils::getParameterFromRequest($requestParams, $user_id_param_index); |
30 | 30 | $locale = Utils::getLocaleFromRequest($requestParams); |
31 | 31 | |
32 | - if(strlen($requestParams) > 1){ |
|
32 | + if (strlen($requestParams) > 1) { |
|
33 | 33 | |
34 | - if(strlen($userId) > 0){ |
|
34 | + if (strlen($userId) > 0) { |
|
35 | 35 | |
36 | 36 | //This is viewable by admins and the specified user |
37 | 37 | $userPermissions = []; |
@@ -44,15 +44,15 @@ discard block |
||
44 | 44 | |
45 | 45 | echo($json); |
46 | 46 | |
47 | - } else { |
|
47 | + }else { |
|
48 | 48 | header('HTTP/1.0 400 Bad Request'); |
49 | - echo json_encode(array("failed"=>"No user id provided"),JSON_FORCE_OBJECT); |
|
49 | + echo json_encode(array("failed"=>"No user id provided"), JSON_FORCE_OBJECT); |
|
50 | 50 | exit; |
51 | 51 | } |
52 | 52 | |
53 | - } else { |
|
53 | + }else { |
|
54 | 54 | header('HTTP/1.0 400 Bad Request'); |
55 | - echo json_encode(array("failed"=>'No request parameters provided'),JSON_FORCE_OBJECT); |
|
55 | + echo json_encode(array("failed"=>'No request parameters provided'), JSON_FORCE_OBJECT); |
|
56 | 56 | exit; |
57 | 57 | } |
58 | 58 | /* |
@@ -28,8 +28,8 @@ discard block |
||
28 | 28 | |
29 | 29 | switch ($requestMethod) { |
30 | 30 | case 'GET': |
31 | - if(strlen($requestParams) > 1){ |
|
32 | - $user_id = Utils::getParameterFromRequest($requestParams,4); |
|
31 | + if (strlen($requestParams) > 1) { |
|
32 | + $user_id = Utils::getParameterFromRequest($requestParams, 4); |
|
33 | 33 | |
34 | 34 | //Admins, and the owning applicant have permission to view |
35 | 35 | $userPermissions = []; |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | $result = JobSeekerController::getJobSeekerProfileByUserId(intval($user_id)); |
41 | 41 | $json = json_encode($result, JSON_PRETTY_PRINT); |
42 | 42 | echo($json); |
43 | - } else { |
|
43 | + }else { |
|
44 | 44 | $result = array(); |
45 | 45 | $json = json_encode($result, JSON_PRETTY_PRINT); |
46 | 46 | echo($json); |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | if (strlen($requestParams) > 1) { |
74 | 74 | $jobSeekerJSON = json_decode($jsonBody, TRUE); |
75 | 75 | //var_dump($jobSeekerJSON); |
76 | - $user_id = Utils::getParameterFromRequest($requestParams,4); |
|
76 | + $user_id = Utils::getParameterFromRequest($requestParams, 4); |
|
77 | 77 | |
78 | 78 | //Admins, and the owning applicant have permission to modify |
79 | 79 | $userPermissions = []; |
@@ -100,9 +100,9 @@ discard block |
||
100 | 100 | |
101 | 101 | //$json = json_encode($result, JSON_PRETTY_PRINT); |
102 | 102 | echo($result); |
103 | - } else { |
|
103 | + }else { |
|
104 | 104 | header('HTTP/1.0 400 Bad Request'); |
105 | - echo json_encode(array("failed"=>'No request parameters provided'),JSON_FORCE_OBJECT); |
|
105 | + echo json_encode(array("failed"=>'No request parameters provided'), JSON_FORCE_OBJECT); |
|
106 | 106 | exit; |
107 | 107 | } |
108 | 108 | break; |