Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
L
leximpact-socio-fiscal-ui
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
leximpact
Simulateur socio-fiscal
leximpact-socio-fiscal-ui
Commits
96b852e6
Commit
96b852e6
authored
1 year ago
by
Toufic Batache
Browse files
Options
Downloads
Patches
Plain Diff
Allow external user to publish private budget simulation
parent
68f2c77c
No related branches found
No related tags found
1 merge request
!174
Ajout des demandes du calcul budget
Pipeline
#11113
passed
1 year ago
Stage: build
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/routes/simulations_budget/+server.ts
+16
-1
16 additions, 1 deletion
src/routes/simulations_budget/+server.ts
with
16 additions
and
1 deletion
src/routes/simulations_budget/+server.ts
+
16
−
1
View file @
96b852e6
import
{
auditRequire
,
cleanAudit
,
type
Audit
}
from
"
@auditors/core
"
import
fs
from
"
fs-extra
"
import
jwt
from
"
jsonwebtoken
"
import
path
from
"
path
"
import
{
error
,
json
}
from
"
@sveltejs/kit
"
import
type
{
DisplayMode
}
from
"
$lib/displays
"
import
config
from
"
$lib/server/config
"
import
type
{
CachedSimulation
}
from
"
$lib/simulations
"
import
type
{
User
}
from
"
$lib/users
"
import
type
{
RequestHandler
}
from
"
./$types
"
...
...
@@ -47,7 +49,20 @@ function auditBody(audit: Audit, dataUnknown: unknown): [unknown, unknown] {
}
export
const
POST
:
RequestHandler
=
async
({
locals
,
request
,
url
})
=>
{
if
(
locals
.
user
===
undefined
)
{
let
user
=
locals
.
user
const
requestJwtToken
=
request
.
headers
.
get
(
"
jwt-token
"
)
if
(
requestJwtToken
!==
null
)
{
try
{
user
=
jwt
.
verify
(
requestJwtToken
,
config
.
jwtSecret
)
as
User
}
catch
(
e
)
{
console
.
warn
(
`Invalid JSON Web Token for id_token:
${
requestJwtToken
}
.
${
e
}
`
,
)
}
}
if
(
user
===
undefined
)
{
throw
error
(
401
,
"
Unauthorized
"
)
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment