Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
cern-search-rest-api
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Jira
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Container registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
webservices
cern-search
cern-search-rest-api
Commits
94e98863
Commit
94e98863
authored
6 years ago
by
Pablo Panero Vazquez
Browse files
Options
Downloads
Patches
Plain Diff
Improve debug logger
parent
6c606908
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
cern_search_rest_api/modules/cernsearch/permissions.py
+2
-1
2 additions, 1 deletion
cern_search_rest_api/modules/cernsearch/permissions.py
with
2 additions
and
1 deletion
cern_search_rest_api/modules/cernsearch/permissions.py
+
2
−
1
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
)):
...
...
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