Allow to define permissions for each datalayer instead of for the whole map - #1307
Merged
Conversation
yohanboniface
force-pushed
the
datalayer-editstatus
branch
from
September 7, 2023 08:35
f3866ca to
e81e82b
Compare
yohanboniface
commented
Sep 7, 2023
|
|
||
| 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 = ( |
Contributor
There was a problem hiding this comment.
Suggested change
| DEFAULT_LATITUDE = ( | |
| DEFAULT_LATITUDE = getattr(settings, "LEAFLET_LATITUDE", 51) |
Even shorter 😎
yohanboniface
marked this pull request as draft
September 7, 2023 08:37
yohanboniface
force-pushed
the
datalayer-editstatus
branch
3 times, most recently
from
September 12, 2023 09:38
cdbb5fa to
e3cf017
Compare
yohanboniface
force-pushed
the
datalayer-editstatus
branch
from
September 18, 2023 18:01
74b614a to
6f85cb8
Compare
yohanboniface
commented
Sep 19, 2023
| Object.defineProperty(this, 'isDirty', { | ||
| get: function () { | ||
| return isDirty || this.dirty_datalayers.length | ||
| return isDirty |
Member
Author
There was a problem hiding this comment.
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…
yohanboniface
commented
Sep 20, 2023
| if (!isDirty && status) self.fire('isdirty') | ||
| isDirty = status | ||
| self.checkDirty() | ||
| this.checkDirty() |
Member
Author
There was a problem hiding this comment.
Not sure this change is harmless. It works in our browser, but may it break on some older versions ?
yohanboniface
marked this pull request as ready for review
September 20, 2023 08:48
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
yohanboniface
force-pushed
the
datalayer-editstatus
branch
from
September 22, 2023 15:32
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Work in progress!
cf #584
Todo list:
can_editlogicedit_statusin the frontenddelete Map.edit_status (certainly not in this PR just in case)Datalayer.options.editModeadd unittests for(it's json dumped in aeditModevalue 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)