Fixes #349 (4 years and 3 months later, but we made it!), fixes #611 (well, relates to it / stems from / finishes this work)
Description
Currently when a user is an admin in one organisation, they're an admin in all of them. This PR allows for more granular permissions.
From a tech perspective, this is also interesting as it introduces ngrx. Before this work, to determine a user's permissions (necessary throughout the app!) we only needed that user's object. Now we also need to know the current team (e.g. if the user is looking at a map from a particular organisation, that is the current organisation and we need the user's permissions within that organisation). We already had facilities in place for sharing the team throughout the app, but they were really old and far from current best practice. As permissions are such a crucial thing that needs to work well for the whole app to work, I decided to do a bit more work to move this part of the architecture towards reactivity. And as we're going to be doing more extensive state management work very soon, it made perfect sense to add ngrx now for a simpler part of the state... that also could really benefit from it.
In general, the implementation here is a bit quick and dirty (ideally we wouldn't have done this work before changing the data model!), but also there's quite a few other smaller improvements to the code, hopefully balancing out the quick and dirty ones.
Issue
Fixes #349 (4 years and 3 months later, but we made it!), fixes #611 (well, relates to it / stems from / finishes this work)
Description
Currently when a user is an admin in one organisation, they're an admin in all of them. This PR allows for more granular permissions.
From a tech perspective, this is also interesting as it introduces ngrx. Before this work, to determine a user's permissions (necessary throughout the app!) we only needed that user's object. Now we also need to know the current team (e.g. if the user is looking at a map from a particular organisation, that is the current organisation and we need the user's permissions within that organisation). We already had facilities in place for sharing the team throughout the app, but they were really old and far from current best practice. As permissions are such a crucial thing that needs to work well for the whole app to work, I decided to do a bit more work to move this part of the architecture towards reactivity. And as we're going to be doing more extensive state management work very soon, it made perfect sense to add ngrx now for a simpler part of the state... that also could really benefit from it.
In general, the implementation here is a bit quick and dirty (ideally we wouldn't have done this work before changing the data model!), but also there's quite a few other smaller improvements to the code, hopefully balancing out the quick and dirty ones.