BiologicalRecordsCentre / UKBMS-online

Issue tracking for UKBMS online recording site
2 stars 0 forks source link

Site Assignment page not working #205

Closed IanMiddlebrook closed 3 years ago

IanMiddlebrook commented 3 years ago

Hi @DavidRoy

I'm not sure that the Site Assignment page is working properly https://ukbms.org/site-assignment

Twice now I have used that page to 'unallocate' a recorder from a transect, by unchecking the relevant box. But I then find that they are still allocated. So I've had to go to the individual Site Details page to break the link.

As far as I can tell, allocating sites to recorders on this page is working OK, it's just 'unallocating' that doesn't seem to make a difference.

Thanks, Ian

DavidRoy commented 3 years ago

Can you give specific examples - site and recorder to help @Gary-van-Breda track this down?

IanMiddlebrook commented 3 years ago

Hi @DavidRoy

Specifically, I was trying to remove the transect Buckland Wood and WCBS square ST1914 from the account of Nigel Cottle.

I used the Site Assignment page to do this, and he got back in touch to say they were still there. So I went to the Site Assignment page again and repeated the action. Then I masqueraded as Nigel Cottle to check his Site List, and they were still there.

So I then had to go to the Site Details page for each of those sites to remove him.

Thanks, Ian

Gary-van-Breda commented 3 years ago

When the site is de-assigned, it fetches all the location attributes used to allocate the user: this fetch is done straight to the warehouse from the JS in the browser, and this is getting blocked on account of "CORS missing allow origin". Given that we can do this OK for reports, it feels like this is a warehouse config issue. @BirenRathod do you know how we can allow CORS for url https://warehouse1.indicia.org.uk/index.php/services/data/location_attribute_value ?

BirenRathod commented 3 years ago

@Gary-van-Breda I have implemented the CORS settings now, can you see if that is working?

Gary-van-Breda commented 3 years ago

I'm still getting the same problem: Console in Firefox is showing: Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://warehouse1.indicia.org.uk//index.php/services/data/location_attribute_value?mode=json&auth_token=****&reset_timeout=true&nonce=****&location_id=3094&location_attribute_id=58&value=515. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing).

Chrome: Access to XMLHttpRequest at 'https://warehouse1.indicia.org.uk//index.php/services/data/location_attribu…16d888a…&location_id=3094&location_attribute_id=58&value=515' from origin 'https://ukbms.org' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

The following call works OK: https://warehouse1.indicia.org.uk/index.php/services/report/requestReport?report=reports_for_prebuilt_forms/UKBMS/ebms_region_locations.xml&mode=json&reportSource=local&callback=jQuery3510030561107236772078_1618491232930&auth_token=****&nonce=****&location_type_ids=777&region_type_id=1103&region_location_id=1953&_=1618491232931

BirenRathod commented 3 years ago

@Gary-van-Breda you can try by removing //. I don't know at present that could be a main problem.

Gary-van-Breda commented 3 years ago

@BirenRathod : I've done it on a test system, and still getting the same problem.

BirenRathod commented 3 years ago

@Gary-van-Breda do you know the folder on the warehouse for data service?

BirenRathod commented 3 years ago

@Gary-van-Breda I checked all service folders, and I didn't fine any separate settings that I have placed in it. so that is not a problem. Could you try on a different browser? I can't think of anything else.

Gary-van-Breda commented 3 years ago

Slaps forehead... it needs to be JSONP: will try again.

Gary-van-Breda commented 3 years ago

@BirenRathod Thanks for the help.

@IanMiddlebrook : A codefix has been deployed. I've assigned myself to Aberlady Bay, then de-assigned myself, and it has worked OK.

IanMiddlebrook commented 3 years ago

Great - thanks @Gary-van-Breda