Skip to content

Commit

Permalink
Merge pull request #5588 from GeoNode/t-book-patch-1
Browse files Browse the repository at this point in the history
[Fixes #5587] Set permissions for current user when DEFAULT_ANONYMOUS…
  • Loading branch information
Alessio Fabiani authored Feb 3, 2020
2 parents 6b3a2a6 + 202778d commit 8550d30
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions geonode/templates/_permissions_form_js.html
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,14 @@
Utils.Extend(UsersAjaxAdapter, AjaxAdapter);

var initialValues = [];

// In case resources are private we add the current user
{% if DEFAULT_ANONYMOUS_VIEW_PERMISSION is False %}
{% if request.resolver_match.url_name == 'layer_upload' or request.resolver_match.url_name == 'document_upload' %}
var initialValues = [{name: "{{request.user}}", id:"{{request.user}}"}];
{% endif %}
{% endif %}

$(default_perms).each(function (index, perm) {
initialValues.push({ id: perm, name: perm });
});
Expand Down

0 comments on commit 8550d30

Please sign in to comment.