diff --git a/umap/decorators.py b/umap/decorators.py
index c096c1f4..52faa127 100644
--- a/umap/decorators.py
+++ b/umap/decorators.py
@@ -26,9 +26,9 @@ def login_required_if_not_anonymous_allowed(view_func):
return wrapper
-def map_permissions_check(view_func):
+def can_edit_map(view_func):
"""
- Used for URLs dealing with the map.
+ Used for URLs dealing with editing the map.
"""
@wraps(view_func)
@@ -36,12 +36,11 @@ def map_permissions_check(view_func):
map_inst = get_object_or_404(Map, pk=kwargs["map_id"])
user = request.user
kwargs["map_inst"] = map_inst # Avoid rerequesting the map in the view
- if map_inst.edit_status >= map_inst.EDITORS:
- can_edit = map_inst.can_edit(user=user, request=request)
- if not can_edit:
- if map_inst.owner and not user.is_authenticated:
- return simple_json_response(login_required=str(LOGIN_URL))
- return HttpResponseForbidden()
+ can_edit = map_inst.can_edit(user=user, request=request)
+ if not can_edit:
+ if map_inst.owner and not user.is_authenticated:
+ return simple_json_response(login_required=str(LOGIN_URL))
+ return HttpResponseForbidden()
return view_func(request, *args, **kwargs)
return wrapper
diff --git a/umap/forms.py b/umap/forms.py
index af937ed7..636013eb 100644
--- a/umap/forms.py
+++ b/umap/forms.py
@@ -36,25 +36,7 @@ class SendLinkForm(forms.Form):
class UpdateMapPermissionsForm(forms.ModelForm):
class Meta:
model = Map
- fields = ("edit_status", "editors", "share_status", "owner")
-
-
-class AnonymousMapPermissionsForm(forms.ModelForm):
- def __init__(self, *args, **kwargs):
- super(AnonymousMapPermissionsForm, self).__init__(*args, **kwargs)
- help_text = _("Secret edit link is %s") % self.instance.get_anonymous_edit_url()
- self.fields["edit_status"].help_text = _(help_text)
-
- STATUS = (
- (Map.ANONYMOUS, _("Everyone can edit")),
- (Map.OWNER, _("Only editable with secret edit link")),
- )
-
- edit_status = forms.ChoiceField(choices=STATUS)
-
- class Meta:
- model = Map
- fields = ("edit_status",)
+ fields = ("editors", "share_status", "owner")
class DataLayerForm(forms.ModelForm):
diff --git a/umap/static/umap/js/umap.permissions.js b/umap/static/umap/js/umap.permissions.js
index 13dcb750..1904d1da 100644
--- a/umap/static/umap/js/umap.permissions.js
+++ b/umap/static/umap/js/umap.permissions.js
@@ -5,7 +5,6 @@ L.U.MapPermissions = L.Class.extend({
owner: null,
editors: [],
share_status: null,
- edit_status: null,
},
initialize: function (map) {
@@ -62,26 +61,10 @@ L.U.MapPermissions = L.Class.extend({
const helpText = L._('Secret edit link is:
{link}', {
link: this.options.anonymous_edit_url,
})
- fields.push([
- 'options.edit_status',
- {
- handler: 'IntSelect',
- label: L._('Who can edit'),
- selectOptions: this.map.options.anonymous_edit_statuses,
- helpText: helpText,
- },
- ])
+ L.DomUtil.create('p', 'help-text', container, helpText)
}
} else {
if (this.isOwner()) {
- fields.push([
- 'options.edit_status',
- {
- handler: 'IntSelect',
- label: L._('Who can edit'),
- selectOptions: this.map.options.edit_statuses,
- },
- ])
fields.push([
'options.share_status',
{
@@ -151,8 +134,6 @@ L.U.MapPermissions = L.Class.extend({
for (let i = 0; i < this.options.editors.length; i++)
formData.append('editors', this.options.editors[i].id)
}
- if (this.isOwner() || this.isAnonymousMap())
- formData.append('edit_status', this.options.edit_status)
if (this.isOwner()) {
formData.append('owner', this.options.owner && this.options.owner.id)
formData.append('share_status', this.options.share_status)
diff --git a/umap/templates/umap/map_table.html b/umap/templates/umap/map_table.html
index eb8cef5a..2150838b 100644
--- a/umap/templates/umap/map_table.html
+++ b/umap/templates/umap/map_table.html
@@ -5,7 +5,7 @@