WatWowMap/ReactMap

Parent in geojson file breaks "Scan Area menu" when area restrictions is used

Closed this issue · 5 comments

jepke commented
  1. When user has no role matching any of the area restrictions all are shown on both the map and in Scan areas

Expected behavior (when area restriction is used): Nothing is shown on the map, perhaps a notification popup to contact the admin.
Personal workaround: Create a tiny fake fence and have guild id as role in arearestriction.

  1. When using parent in the geojson file in combination with area restrictions the Scan Area menu list will stay empty.

Likely cause is that parent is prepended to the area name causing a miss match in filtering.
Suburb becomes City-Suburb in user.perms.areaRestrictions

"properties": {
        "name": "Suburb",
        "parent": "City"
},

Expected behavior: List of areas that are allowed in Scan areas

jepke commented

Tested with these settings.

			{
				"roles": [
					"12345678123458678"
				],
				"areas": [
					"AAAA",
					"A",
					"B",
					"C"
				]
			}
{
	"type": "FeatureCollection",
	"features": [
		{
			"type": "Feature",
			"properties": {
				"name": "A",
				"parent": "AAAA"
			},
			"geometry": {
				"coordinates": [
					[]
				],
				"type": "Polygon"
			}
		},
		{
			"type": "Feature",
			"properties": {
				"name": "B",
				"parent": "AAAA"
			},
			"geometry": {
				"coordinates": [
					[]
				],
				"type": "Polygon"
			}
		},
		{
			"type": "Feature",
			"properties": {
				"name": "C",
				"parent": "AAAA"
			},
			"geometry": {
				"coordinates": [
					[]
				],
				"type": "Polygon"
			}
		},
		{
			"type": "Feature",
			"properties": {
				"name": "AAAA"
			},
			"geometry": {
				"coordinates": [
					[]
				],
				"type": "Polygon"
			}
		}
	]
}
jepke commented

When parent property is removed from the geojson files it works as intended. And only shows areas the user has access to.

Likely filtering. objects in the scanAreas array become {parentname}-{areaname} where its probably looking for {areaname}

I tried removing parent from the properties, but it didn't work for me.

I noticed that lat/lon are swapped in areas.json. Is it possible that it interferes with the geometry check here:

polygon(scanArea.geometry.coordinates),
?

jepke commented

I tried removing parent from the properties, but it didn't work for me.

I noticed that lat/lon are swapped in areas.json. Is it possible that it interferes with the geometry check here:

polygon(scanArea.geometry.coordinates),

?

geojson is lon/lat is the correct way https://www.rfc-editor.org/rfc/rfc7946#section-3.1.1

Hm this was fixed. Not sure why it didn't close on merge.