WildAid / o-fish-realm

Realm application code and sample data for the Officer's Fishery Information Sharing Hub (O-FISH). The mobile app allows fisheries officers to document and share critical information gathered during a routine vessel inspection. The web app allows agencies to gain insights from the aggregated information.
Apache License 2.0
23 stars 9 forks source link

Agency Admin needs to be able to insert to MenuData #155

Closed Sheeri closed 4 years ago

Sheeri commented 4 years ago

When trying to add menu data from the sandbox web ui, I was seeing behavior where the data did not appear to save.

The logs showed: role "Agency Admin" in "wildaid.MenuData" does not have insert permission for document with _id: ObjectID("5f753...034")

Under Rules -> mongodb-atlas -> Agency Admin role, the "Write" checkbox was selected but when I edited (with the pencil) I saw that only 'Search Documents" was checked, not "Insert Documents" (nor "Delete Documents").

I checked "Insert Documents" and hit SAVE and tried again, and this time my menu data saving worked.

Agency Admin at least needs Insert Documents privilege, at least until the new code to give default menu items is completed. If we decide we don't want Insert Documents, we will have to revoke the privilege in the sandbox environment.

am-MongoDB commented 4 years ago

The functionality is correct for non-sandbox mode, but we should either update the docs to manually add insert permissions when setting up a sandbox (alternatively, and maybe better add a trigger on the Agency collection to automatically bootstrap a MenuData document when creating a new agency) – that Trigger can be run as system, which skips the rule checking

Sheeri commented 4 years ago

Docs on how to set up a sandbox are a good idea - and low priority. I have created https://github.com/WildAid/wildaid.github.io/issues/75 to capture what needs to be documented.