Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
Motion Bank
Services
Motion Bank API
Commits
b36737aa
Commit
b36737aa
authored
Aug 29, 2018
by
A. Koch
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix author and profile flow
parent
fe4b08bc
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
2 deletions
+5
-2
src/lib/service.js
src/lib/service.js
+1
-1
src/middleware/author.js
src/middleware/author.js
+4
-1
No files found.
src/lib/service.js
View file @
b36737aa
...
...
@@ -29,7 +29,7 @@ class Service extends TinyEmitter {
async
findHandler
(
req
,
res
)
{
let
results
=
await
this
.
_client
.
find
(
JSON
.
parse
(
req
.
query
.
query
||
'
{}
'
),
req
.
params
)
const
userId
=
req
.
user
?
req
.
user
.
uuid
:
'
anon
'
const
roles
=
req
.
user
?
req
.
user
[
`
${
config
.
api
.
auth0AppMetadataPrefix
}
roles`
]
||
[]
:
[]
const
roles
=
req
.
user
?
req
.
user
.
profile
[
`
${
config
.
api
.
auth0AppMetadataPrefix
}
roles`
]
||
[]
:
[]
const
items
=
[]
for
(
let
entry
of
results
)
{
let
allowed
=
false
...
...
src/middleware/author.js
View file @
b36737aa
const
{
ObjectUtil
}
=
require
(
'
mbjs-utils
'
)
const
setup
=
async
function
(
api
,
profileService
)
{
api
.
app
.
use
(
async
(
req
,
res
,
next
)
=>
{
if
(
req
.
user
)
{
...
...
@@ -7,7 +9,8 @@ const setup = async function (api, profileService) {
},
user
:
req
.
user
}
req
.
user
.
profile
=
await
profileService
.
getHandler
(
r
)
const
result
=
await
profileService
.
getHandler
(
r
)
req
.
user
.
profile
=
ObjectUtil
.
merge
({},
req
.
user
.
profile
,
result
.
data
)
if
(
req
.
method
.
toLowerCase
()
===
'
post
'
)
{
req
.
body
.
author
=
{
id
:
req
.
user
.
uuid
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment