Upload to the correct sensor

Fixes #369

Also improves reporting in preparation for #345

Moves away from using object metadata and instead uses plain maps to
pass around metadata.

Fixes for authentication issues as well.

Not updating devices and sensors at the moment.
Merge pull request #370 from MastodonC/feature/upload-to-correct-sensor

Upload to correct sensor
New programme/project manager authn logic

- New programme/project manager authn logic
  - roles->role
  - Changes to editable.
  - use new has-* functions
- Updated UI for user management: dropdowns for role for each programme
  and project
- Updated the entire UI with the new allowed? logic
- Minor fixes to the UI