cozy / cozy-client

Document store and React components for the Cozy platform
MIT License
13 stars 13 forks source link

Cannot access io.cozy.settings.bitwarden through a query #687

Open ptbrowne opened 4 years ago

ptbrowne commented 4 years ago

SettingsCollection uses the special /settings/ routes that do not let us access io.cozy.settings.bitwarden.

This means that it is not possible to use a Query to access io.cozy.settings.bitwarden.

Temporary solution is to use fetchJSON to access /data/io.cozy.settings.bitwarden.

I am not sure how to solve this problem. One alternative we should hardcode the available /settings/ routes ?

// https://github.com/cozy/cozy-stack/blob/master/web/settings/settings.go#L79
const settingsRoutes = [
    "disk"
    "passphrase"
    "hint"
    "capabilities"
    "instance"
    "flags"
    "sessions"
    "clients"
    "synchronized"
    "onboarded"
    "context"
    "warnings"
]

//  inside SettingCollection
async get(path) {
  if (settingsRoutes.contains(path)) {
   // use /settings
  } else {
    // use /data/io.cozy.settings/${path}
  }
}

As a user of the stack, I find it a bit confusing to have data/io.cozy.settings routes and settings routes. Should it be fixed at stack level ? For example by allowing to access io.cozy.settings documents through /settings/ (/settings/bitwarden) ? @nono Am I missing something here ? Is there a formal distinction between settings accessible through /settings and /data/io.cozy.settings ?

nono commented 4 years ago

Most of the routes on /settings cannot be replaced by a /data/io.cozy.settings route. They use information from the config file, from the cloudery, or from other databases (e.g. a couchdb view for io.cozy.files is used to compute the file usage).

For bitwarden, we may add a route /settings/bitwarden on the stack. But don't expect that I add this in the near future. I have a lot of other things that are more urgent and have an higher priority.