crusttech / crust-server

Apache License 2.0
87 stars 21 forks source link

Refactor messaging/repository/permissions #29

Closed titpetric closed 5 years ago

titpetric commented 5 years ago

We need to refactor the messaging/repository/permissions in the following way:

  1. move the permissions repository and test files into service/rules.go, rename structs accordingly,
  2. drop the "Organisation" parameter for API calls, and derive Organisation from context
  3. add a dummy organisation (id=1) into context so we can implement 2. accordingly

We already agreed with @darh to currently support 1 organisation (hard locked on ID=1), so we leave the door open in the future to support multi tenancy. The organisation ID should be a single string inside the context (or uint64 to be consistent). It MUST not be a []string, as organisations must be fully independant (no sharing users, but there might be "shadowed" users, TBD).

titpetric commented 5 years ago

@mitjaziv I'd like you to start this towards a PR, discuss point 3. with darh, what the best place would be to add the Organisation ID into the context (it should play nice with our "social" auth system, as well as didmos if used). Point 1 and 2 are not blocking