Commit b09d70e
SIMSBIOHUB 878: Team Middleware for Authorization (#339)
* update middleware
* explicit pk names
* feat: adds service for team authorization
* test: TeamAuthorizationService
* feat: creates models for team authorization
* feat: adds repository for team authorization queries
* test: TeamAuthorizationRepository
* refact: calls TeamAuthorizationService to determine if user is authorized
* test: AuthorizationService
* refact: repository methods use queryBuilder pattern so queries read like sql
* refact: sql statement to find team policy by submission_feature_id
* test: findTeamPolicyBySubmissionFeature repository method
* refact: calls repository method to find a team policy by submission_feature_id to determine if the user is authorized
* test: TeamAuthorizationService
* misc fix
* feat: adds team discriminator to data_request routes
* refact: removes the not yet implemented 'ticket' discriminator type
* refact: adds system_user discriminator to confirm user is in the system
* feat: updates '/data-requests' route handler to support team_ids filter
* feat: adds method to TeamRepository to get teams by system_user_id
* feat: adds method to TeamService to get team_ids by system_user_id
* feat: adds team_ids filter to DataRequestRepository
* refact: findDataRequests to use system_user_id to get data_requests for the user's teams
* test: DataRequestRepository team_ids filter
* test: DataRequestService
* fix: joins team_member and team tables to get teams for system_user_id
* fix: misc
* refact: removes policy from TeamAuthorizationEntity and makes submissionId required
* refact: removes team_ids param
* misc
* refact: adds service method to get data requests by system user id
* misc
* refact: adds repository method to get data requests associated to the system user's team
* refact: for non-admin data-request route calls findDataRequestsBySystemUserId with system_user_id
* refact: parseQueryParams to be less verbose
* refact: removes findTeamMembershipByPolicy
* refact: removes getTeamIdsBySystemUserId
* refact: returns record_end_date and throws an error if expired
* cleanup
* misc
* refact: returns false if the record has expired instead of throwing an error
* clean up
* refact: reduces duplication by mutating the base query to apply filters
* fix: failing tests
---------
Co-authored-by: Macgregor Aubertin-Young <macgregor.aubertin-young@gov.bc.ca>1 parent 0d5b4af commit b09d70e
File tree
16 files changed
+723
-154
lines changed- api/src
- models
- paths
- data-request
- {dataRequestId}
- submission/{submissionId}/features/{submissionFeatureId}
- repositories
- authorization
- services
- authorization
16 files changed
+723
-154
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| 10 | + | |
9 | 11 | | |
| 12 | + | |
10 | 13 | | |
11 | 14 | | |
12 | 15 | | |
| |||
29 | 32 | | |
30 | 33 | | |
31 | 34 | | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
32 | 67 | | |
33 | 68 | | |
34 | 69 | | |
| |||
52 | 87 | | |
53 | 88 | | |
54 | 89 | | |
55 | | - | |
| 90 | + | |
56 | 91 | | |
| 92 | + | |
57 | 93 | | |
58 | 94 | | |
59 | 95 | | |
60 | 96 | | |
61 | 97 | | |
| 98 | + | |
62 | 99 | | |
63 | | - | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
64 | 103 | | |
65 | 104 | | |
66 | 105 | | |
67 | 106 | | |
68 | 107 | | |
69 | 108 | | |
70 | | - | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
71 | 116 | | |
72 | 117 | | |
73 | 118 | | |
74 | 119 | | |
75 | 120 | | |
76 | 121 | | |
77 | | - | |
| 122 | + | |
78 | 123 | | |
| 124 | + | |
79 | 125 | | |
80 | 126 | | |
81 | 127 | | |
82 | 128 | | |
83 | 129 | | |
| 130 | + | |
84 | 131 | | |
85 | | - | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
86 | 135 | | |
87 | 136 | | |
88 | 137 | | |
| |||
97 | 146 | | |
98 | 147 | | |
99 | 148 | | |
100 | | - | |
| 149 | + | |
101 | 150 | | |
102 | 151 | | |
103 | 152 | | |
| |||
109 | 158 | | |
110 | 159 | | |
111 | 160 | | |
| 161 | + | |
112 | 162 | | |
113 | 163 | | |
114 | 164 | | |
115 | 165 | | |
116 | 166 | | |
117 | | - | |
118 | | - | |
| 167 | + | |
| 168 | + | |
119 | 169 | | |
120 | 170 | | |
121 | 171 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
4 | 3 | | |
5 | 4 | | |
6 | 5 | | |
| |||
20 | 19 | | |
21 | 20 | | |
22 | 21 | | |
23 | | - | |
24 | | - | |
| 22 | + | |
25 | 23 | | |
26 | 24 | | |
27 | 25 | | |
| |||
72 | 70 | | |
73 | 71 | | |
74 | 72 | | |
75 | | - | |
| 73 | + | |
76 | 74 | | |
77 | 75 | | |
78 | 76 | | |
| |||
139 | 137 | | |
140 | 138 | | |
141 | 139 | | |
| 140 | + | |
142 | 141 | | |
143 | 142 | | |
144 | | - | |
| 143 | + | |
145 | 144 | | |
146 | 145 | | |
147 | 146 | | |
| |||
190 | 189 | | |
191 | 190 | | |
192 | 191 | | |
193 | | - | |
| 192 | + | |
194 | 193 | | |
195 | 194 | | |
196 | | - | |
| 195 | + | |
197 | 196 | | |
198 | | - | |
199 | | - | |
200 | | - | |
201 | | - | |
202 | | - | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
203 | 202 | | |
204 | 203 | | |
205 | 204 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
| 14 | + | |
15 | 15 | | |
16 | | - | |
| 16 | + | |
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
20 | 25 | | |
21 | 26 | | |
22 | 27 | | |
23 | 28 | | |
24 | 29 | | |
25 | 30 | | |
26 | 31 | | |
27 | | - | |
| 32 | + | |
28 | 33 | | |
29 | | - | |
| 34 | + | |
30 | 35 | | |
31 | 36 | | |
32 | 37 | | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
33 | 43 | | |
34 | 44 | | |
35 | 45 | | |
36 | 46 | | |
37 | 47 | | |
38 | 48 | | |
39 | 49 | | |
40 | | - | |
| 50 | + | |
41 | 51 | | |
42 | | - | |
| 52 | + | |
43 | 53 | | |
44 | 54 | | |
45 | 55 | | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
46 | 61 | | |
47 | 62 | | |
48 | 63 | | |
| |||
Lines changed: 3 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
| 17 | + | |
| 18 | + | |
18 | 19 | | |
19 | | - | |
| 20 | + | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
| |||
Lines changed: 58 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
0 commit comments