Skip to content

Commit

Permalink
[api] Add user perms to the get_config call
Browse files Browse the repository at this point in the history
  • Loading branch information
romainr committed May 27, 2021
1 parent 3664886 commit 559d673
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion desktop/core/src/desktop/api2.py
Expand Up @@ -86,7 +86,7 @@ def decorator(*args, **kwargs):
@api_error_handler
def get_config(request):
config = get_cluster_config(request.user)
config['hue_config']['is_admin'] = is_admin(request.user);
config['hue_config']['is_admin'] = is_admin(request.user)
config['clusters'] = list(get_clusters(request.user).values())
config['documents'] = {
'types': list(Document2.objects.documents(user=request.user).order_by().values_list('type', flat=True).distinct())
Expand Down
5 changes: 5 additions & 0 deletions desktop/core/src/desktop/api_public.py
Expand Up @@ -17,13 +17,18 @@

from rest_framework.decorators import api_view

from desktop.auth.backend import rewrite_user

from desktop import api2 as desktop_api
from notebook import api as notebook_api


@api_view(["POST"])
def get_config(request):
django_request = request._request

django_request.user = rewrite_user(django_request.user)

return desktop_api.get_config(django_request)


Expand Down

0 comments on commit 559d673

Please sign in to comment.