Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
webservices
cern-search
cern-search-rest-api
Commits
94e98863
Commit
94e98863
authored
Sep 25, 2018
by
Pablo Panero
Browse files
Improve debug logger
parent
6c606908
Changes
1
Hide whitespace changes
Inline
Side-by-side
cern_search_rest_api/modules/cernsearch/permissions.py
View file @
94e98863
...
...
@@ -90,11 +90,12 @@ def has_owner_permission(user, record=None):
# Allow based in the '_access' key
user_provides
=
get_user_provides
()
es_index
,
doc
=
get_index_from_request
(
record
)
current_app
.
logger
.
debug
(
'Using index {idx}'
.
format
(
idx
=
es_index
))
current_app
.
logger
.
debug
(
'Using index {idx}
and doc {doc}
'
.
format
(
idx
=
es_index
,
doc
=
doc
))
if
current_search_client
.
indices
.
exists
([
es_index
]):
mapping
=
current_search_client
.
indices
.
get_mapping
([
es_index
])
if
mapping
is
not
None
:
current_app
.
logger
.
debug
(
'Using mapping for {idx}'
.
format
(
idx
=
es_index
))
current_app
.
logger
.
debug
(
'Mapping {mapping}'
.
format
(
mapping
=
mapping
))
# set.isdisjoint() is faster than set.intersection()
create_access_groups
=
mapping
[
es_index
][
'mappings'
][
doc
][
'_meta'
][
'_owner'
].
split
(
','
)
if
user_provides
and
not
set
(
user_provides
).
isdisjoint
(
set
(
create_access_groups
)):
...
...
Write
Preview
Supports
Markdown
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