-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* [Backport Resolves #7392] Fix upload/replace/append layer * [Fixes #7718] Permissions assignments on Remote Services * [Fixes #7718] Permissions assignments on Remote Services * [Fixes #7718] Permissions assignments on Remote Services * [Fixes #7718] Permissions assignments on Remote Services * [Fixes #7718] Pep8 issues fixed * [Fixes #7718] Permissions assignments on Remote Services * [Fixes #7718] remove unused imports * [Fixes #7718] Fix broken migrations * [CircelCI] Tests fix * [Fixes #7718] db startup error * [Fixes #7718] Fix impovements from ISSUE * Update views.py * Update service_detail.html * [Fixes #7718] Fix count layers on services list, now is based on visible resources Co-authored-by: afabiani <[email protected]> (cherry picked from commit 0c71f23)
- Loading branch information
1 parent
701e68a
commit 9e28a29
Showing
14 changed files
with
213 additions
and
38 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
37 changes: 37 additions & 0 deletions
37
geonode/people/migrations/0033_set_contributors_permissions.py
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Assign the contributors group to users according to #7364 | ||
|
||
from django.contrib.auth.models import Group, Permission | ||
from django.contrib.contenttypes.models import ContentType | ||
from django.db import migrations | ||
from django.db.migrations.operations import RunPython | ||
from geonode.base.models import ResourceBase | ||
|
||
|
||
def assign_permissions_to_contributors(apps, schema_editor): | ||
contributors = Group.objects.filter(name='contributors') | ||
if contributors.exists(): | ||
contr_obj = contributors.first() | ||
perm, _ = Permission.objects.get_or_create( | ||
name='Can add resources', | ||
codename='add_resourcebase', | ||
content_type=ContentType.objects.get_for_model(ResourceBase) | ||
) | ||
contr_obj.permissions.add(perm) | ||
perm_exists = contr_obj.permissions.filter(codename='base_addresourcebase') | ||
if perm_exists.exists(): | ||
contr_obj.permissions.remove(perm_exists.first()) | ||
contr_obj.save() | ||
perm_to_remove = Permission.objects.filter(codename='base_addresourcebase') | ||
if perm_to_remove.exists(): | ||
perm_to_remove.delete() | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('people', '0032_set_contributors_group'), | ||
] | ||
|
||
operations = [ | ||
RunPython(assign_permissions_to_contributors) | ||
] |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Generated by Django 2.2.20 on 2021-06-28 09:55 | ||
|
||
from django.db import migrations | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('services', '0043_auto_20210519_1308'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterModelOptions( | ||
name='service', | ||
options={'permissions': (('add_resourcebase_from_service', 'Can add resources to Service'),)}, | ||
), | ||
] |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Generated by Django 2.2.20 on 2021-06-29 13:55 | ||
|
||
from django.db import migrations | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('services', '0044_auto_20210628_0955'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterModelOptions( | ||
name='service', | ||
options={'permissions': (('add_resourcebase_from_service', 'Can add resources to Service'), ('change_resourcebase_metadata', 'Can change resources metadata'))}, | ||
), | ||
] |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.