(req: AuthRequest)
| 158 | } |
| 159 | |
| 160 | export function getContextFromReq(req: AuthRequest): ReqContext { |
| 161 | if (!req.organization) { |
| 162 | throw new Error("Must be part of an organization to make that request"); |
| 163 | } |
| 164 | if (!req.userId || !req.email) { |
| 165 | throw new Error("Must be logged in"); |
| 166 | } |
| 167 | |
| 168 | return new ReqContextClass({ |
| 169 | org: req.organization, |
| 170 | auditUser: { |
| 171 | type: "dashboard", |
| 172 | id: req.userId, |
| 173 | email: req.email, |
| 174 | name: req.name || "", |
| 175 | }, |
| 176 | user: { |
| 177 | id: req.userId, |
| 178 | email: req.email, |
| 179 | name: req.name || "", |
| 180 | superAdmin: req.superAdmin, |
| 181 | }, |
| 182 | teams: req.teams, |
| 183 | req: req as Request, |
| 184 | }); |
| 185 | } |
| 186 | |
| 187 | async function resolveScopedSettingsForProject( |
| 188 | context: ReqContext, |
no outgoing calls
no test coverage detected
searching dependent graphs…