-
-
Notifications
You must be signed in to change notification settings - Fork 237
Allow to define permissions for each datalayer instead of for the whole map #1307
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
f3866ca
to
e81e82b
Compare
@@ -8,8 +8,12 @@ | |||
|
|||
from .models import Map, DataLayer | |||
|
|||
DEFAULT_LATITUDE = settings.LEAFLET_LATITUDE if hasattr(settings, "LEAFLET_LATITUDE") else 51 | |||
DEFAULT_LONGITUDE = settings.LEAFLET_LONGITUDE if hasattr(settings, "LEAFLET_LONGITUDE") else 2 | |||
DEFAULT_LATITUDE = ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Black noise :(
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DEFAULT_LATITUDE = ( | |
DEFAULT_LATITUDE = getattr(settings, "LEAFLET_LATITUDE", 51) |
Even shorter 😎
cdbb5fa
to
e3cf017
Compare
74b614a
to
6f85cb8
Compare
try { | ||
Object.defineProperty(this, 'isDirty', { | ||
get: function () { | ||
return isDirty || this.dirty_datalayers.length | ||
return isDirty |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure why this check on dirty_datalayers
was here before. As I can see, the isDirty
status should always be set when a datalayer is made dirty…
isDirty = status | ||
self.checkDirty() | ||
this.checkDirty() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure this change is harmless. It works in our browser, but may it break on some older versions ?
But keep it for now, for data migration, and just in case
And only save the map in case of an `advanced` `editMode`.
Revert "Fix existing permissions related tests" This reverts commit 36d7d87. WIP
They now differ from the Map.edit_status ones
In some places we need to know if a given datalayer can accept new features, or not, whether because being readonly or being remote
3fddac9
to
157146d
Compare
This bug has been introduced with this change: 8b4842f That was not the correct fix, and this one should be the proper one. We don't want to edit the permissions reference until we do save, otherwise user cannot save as it is already no more the owner. So: - change permissions.options - save - commit those changes to map.options.permissions - use only those values to check for isOwner and isAnonymousMap
Work in progress!
cf #584
Todo list:
can_edit
logicedit_status
in the frontenddelete Map.edit_status (certainly not in this PR just in case)Datalayer.options.editMode
add unittests for(it's json dumped in aeditMode
value returned by back-office<script>
in a HTML page, so it's better to use integration tests, which test the behaviour instead of the key itself, and are already done)