MCPcopy
hub / github.com/growthbook/growthbook / getContextFromReq

Function getContextFromReq

packages/back-end/src/services/organizations.ts:160–185  ·  view source on GitHub ↗
(req: AuthRequest)

Source from the content-addressed store, hash-verified

158}
159
160export 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
187async function resolveScopedSettingsForProject(
188 context: ReqContext,

Callers 15

app.tsFile · 0.90
deleteMetricFunction · 0.90
getMetricsFunction · 0.90
getMetricUsageFunction · 0.90
postLegacyMetricAnalysisFunction · 0.90
getMetricFunction · 0.90
postAutoGeneratedMetricsFunction · 0.90
postMetricsFunction · 0.90
putMetricFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…