Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
Motion Bank
Services
Transcoder
Commits
05832f25
Commit
05832f25
authored
Sep 14, 2018
by
A. Koch
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix acl check for api service
parent
ff9850e3
Pipeline
#1271
passed with stage
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
2 deletions
+4
-2
src/lib/service.js
src/lib/service.js
+4
-2
No files found.
src/lib/service.js
View file @
05832f25
...
...
@@ -32,10 +32,11 @@ class Service extends TinyEmitter {
const
items
=
[]
for
(
let
entry
of
results
)
{
let
allowed
=
false
const
roles
=
req
.
user
?
req
.
user
.
profile
.
roles
:
[
'
public
'
]
if
(
entry
.
author
&&
entry
.
author
.
id
===
user
)
allowed
=
true
else
{
try
{
allowed
=
await
this
.
_acl
.
i
sAllowed
(
user
,
entry
.
uuid
,
'
get
'
)
allowed
=
await
this
.
_acl
.
areAnyRole
sAllowed
(
roles
,
entry
.
uuid
,
[
'
get
'
]
)
}
catch
(
err
)
{
api
.
captureException
(
err
)
...
...
@@ -49,12 +50,13 @@ class Service extends TinyEmitter {
async
getHandler
(
req
,
res
)
{
const
result
=
await
this
.
client
.
get
(
req
.
params
.
id
,
req
.
params
)
const
user
=
req
.
user
?
req
.
user
.
uuid
:
'
anon
'
const
roles
=
req
.
user
?
req
.
user
.
profile
.
roles
:
[
'
public
'
]
if
(
result
)
{
let
allowed
=
false
if
(
result
.
author
&&
result
.
author
.
id
===
user
)
allowed
=
true
else
{
try
{
allowed
=
await
this
.
_acl
.
isAllowed
(
user
,
result
.
uuid
,
'
get
'
)
allowed
=
await
this
.
_acl
.
areAnyRolesAllowed
(
roles
,
entry
.
uuid
,
[
'
get
'
]
)
}
catch
(
err
)
{
api
.
captureException
(
err
)
...
...
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