Skip to content
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

merged correct #27

Merged
merged 2 commits into from
Feb 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions geonode/people/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,6 @@ class Profile(AbstractUser):
null=True,
help_text=_("role or position of the responsible person"),
)
<<<<<<< HEAD
# orcid = models.CharField(
# _('orcid'),
# max_length=20,
# blank=True,
# null=True,
# help_text=_('Uniquely identifies an individual or legal entity, according to various schemes. (e.g. 0000-0001-5000-0007)'))
=======
>>>>>>> 0e89afe806f359a1a0b700c233f292999249af5f
voice = models.CharField(
_("Voice"),
max_length=255,
Expand Down
47 changes: 0 additions & 47 deletions geonode/security/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,9 @@
delete_all_geofence_rules,
sync_resources_with_guardian,
_get_gwc_filters_and_formats,
<<<<<<< HEAD
=======
has_geolimits,
create_geofence_rules,
delete_geofence_rules_for_layer,
>>>>>>> 0e89afe806f359a1a0b700c233f292999249af5f
)


Expand Down Expand Up @@ -351,16 +348,13 @@ def test_set_bulk_permissions(self):
"""Test that after restrict view permissions on two layers
bobby is unable to see them"""

<<<<<<< HEAD
=======
rules_count = 0
if check_ogc_backend(geoserver.BACKEND_PACKAGE):
delete_all_geofence_rules()
# Reset GeoFence Rules
rules_count = geofence.get_rules_count()
self.assertEqual(rules_count, 0)

>>>>>>> 0e89afe806f359a1a0b700c233f292999249af5f
layers = Dataset.objects.all()[:2].values_list("id", flat=True)
layers_id = [str(x) for x in layers]
test_perm_dataset = Dataset.objects.get(id=layers[0])
Expand Down Expand Up @@ -389,18 +383,12 @@ def test_set_bulk_permissions(self):
resp = self.client.get(self.list_url)
self.assertGreaterEqual(len(self.deserialize(resp)["objects"]), 6)

<<<<<<< HEAD
perms = get_users_with_perms(test_perm_dataset)
_log(f"3. perms: {perms} ")
sync_geofence_with_guardian(test_perm_dataset, perms, user="bobby")
=======
# perms = get_users_with_perms(test_perm_dataset)
# _log(f"3. perms: {perms} ")
# batch = AutoPriorityBatch(get_first_available_priority(), f'test batch for {test_perm_dataset}')
# for u, p in perms.items():
# create_geofence_rules(test_perm_dataset, p, user=u, batch=batch)
# geofence.run_batch(batch)
>>>>>>> 0e89afe806f359a1a0b700c233f292999249af5f

# Check GeoFence Rules have been correctly created
rules_count = geofence.get_rules_count()
Expand All @@ -416,14 +404,9 @@ def test_set_bulk_permissions(self):
user = settings.OGC_SERVER["default"]["USER"]
passwd = settings.OGC_SERVER["default"]["PASSWORD"]

<<<<<<< HEAD
r = requests.get(f"{url}gwc/rest/seed/{test_perm_dataset.alternate}.json", auth=HTTPBasicAuth(user, passwd))
self.assertEqual(r.status_code, 400)
=======
test_url = f"{url}gwc/rest/seed/{test_perm_dataset.alternate}.json"
r = requests.get(test_url, auth=HTTPBasicAuth(user, passwd))
self.assertEqual(r.status_code, 400, f"GWC error for user: {user} URL: {test_url}\n{r.text}")
>>>>>>> 0e89afe806f359a1a0b700c233f292999249af5f

rules_count = 0
if check_ogc_backend(geoserver.BACKEND_PACKAGE):
Expand Down Expand Up @@ -608,14 +591,8 @@ def test_perm_specs_synchronization(self):
layer = Dataset.objects.first()
# grab bobby
bobby = get_user_model().objects.get(username="bobby")
<<<<<<< HEAD
gf_services = _get_gf_services(layer, layer.get_all_level_info())
_, _, _disable_dataset_cache, _, _, _ = get_user_geolimits(layer, None, None, gf_services)
filters, formats = _get_gwc_filters_and_formats([_disable_dataset_cache])
=======
_disable_dataset_cache = has_geolimits(layer, None, None)
filters, formats = _get_gwc_filters_and_formats(_disable_dataset_cache)
>>>>>>> 0e89afe806f359a1a0b700c233f292999249af5f
self.assertListEqual(filters, [{"styleParameterFilter": {"STYLES": ""}}])
self.assertListEqual(
formats,
Expand Down Expand Up @@ -647,22 +624,14 @@ def test_perm_specs_synchronization(self):
rules_count = geofence.get_rules_count()
self.assertEqual(rules_count, 8)

<<<<<<< HEAD
rules_objs = get_geofence_rules(entries=8)
=======
rules_objs = geofence.get_rules()
>>>>>>> 0e89afe806f359a1a0b700c233f292999249af5f
self.assertEqual(len(rules_objs["rules"]), 8)
# Order is important
_limit_rule_position = -1
for cnt, rule in enumerate(rules_objs["rules"]):
if rule["service"] is None and rule["userName"] == "bobby":
self.assertEqual(rule["userName"], "bobby")
<<<<<<< HEAD
self.assertEqual(rule["workspace"], "CA")
=======
self.assertEqual(rule["workspace"], "geonode")
>>>>>>> 0e89afe806f359a1a0b700c233f292999249af5f
self.assertEqual(rule["layer"], "CA")
self.assertEqual(rule["access"], "LIMIT")

Expand Down Expand Up @@ -695,23 +664,15 @@ def test_perm_specs_synchronization(self):
rules_count = geofence.get_rules_count()
self.assertEqual(rules_count, 6)

<<<<<<< HEAD
rules_objs = get_geofence_rules(entries=6)
=======
rules_objs = geofence.get_rules()
>>>>>>> 0e89afe806f359a1a0b700c233f292999249af5f
self.assertEqual(len(rules_objs["rules"]), 6)
# Order is important
_limit_rule_position = -1
for cnt, rule in enumerate(rules_objs["rules"]):
if rule["roleName"] == "ROLE_BAR":
if rule["service"] is None:
self.assertEqual(rule["userName"], None)
<<<<<<< HEAD
self.assertEqual(rule["workspace"], "CA")
=======
self.assertEqual(rule["workspace"], "geonode")
>>>>>>> 0e89afe806f359a1a0b700c233f292999249af5f
self.assertEqual(rule["layer"], "CA")
self.assertEqual(rule["access"], "LIMIT")

Expand Down Expand Up @@ -747,11 +708,7 @@ def test_perm_specs_synchronization(self):
if rule["service"] is None:
self.assertEqual(rule["service"], None)
self.assertEqual(rule["userName"], None)
<<<<<<< HEAD
self.assertEqual(rule["workspace"], "CA")
=======
self.assertEqual(rule["workspace"], "geonode")
>>>>>>> 0e89afe806f359a1a0b700c233f292999249af5f
self.assertEqual(rule["layer"], "CA")
self.assertEqual(rule["access"], "LIMIT")

Expand Down Expand Up @@ -1311,11 +1268,7 @@ def test_perms_info(self):
# 7. change_dataset_style

def test_not_superuser_permissions(self):
<<<<<<< HEAD
geofence_rules_count = 0
=======
rules_count = 0
>>>>>>> 0e89afe806f359a1a0b700c233f292999249af5f
if check_ogc_backend(geoserver.BACKEND_PACKAGE):
delete_all_geofence_rules()
# Reset GeoFence Rules
Expand Down
20 changes: 0 additions & 20 deletions tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,23 +129,6 @@ def update(ctx):
allowed_hosts = [str(c) for c in current_allowed] + ['"geonode"', '"django"']

ctx.run(
<<<<<<< HEAD
"echo export GEONODE_INSPIRE_URL=\
{inspire_download_url} >> {override_fn}".format(
**envs
),
pty=True,
)
ctx.run(
"echo export GEONODE_AGROVOC_URL=\
{agrovoc_download_url} >> {override_fn}".format(
**envs
),
pty=True,
)
ctx.run(
=======
>>>>>>> 0e89afe806f359a1a0b700c233f292999249af5f
"echo export DJANGO_SETTINGS_MODULE=\
{local_settings} >> {override_fn}".format(
**envs
Expand Down Expand Up @@ -485,7 +468,6 @@ def collectmetrics(ctx):
def initialized(ctx):
print("**************************init file********************************")
ctx.run("date > /mnt/volumes/statics/geonode_init.lock")
<<<<<<< HEAD


@task
Expand Down Expand Up @@ -514,8 +496,6 @@ def initzalf(ctx):
--settings={_localsettings()}",
pty=True,
)
=======
>>>>>>> 0e89afe806f359a1a0b700c233f292999249af5f


def _docker_host_ip():
Expand Down