feat(influxdb): add unauthorized error code
feat(testing): export ErrorsEqual method
feat(authorizer): add Authorize method that authorizers permissions
feat(authorizer): add org service that authorizes actions to a wrapped org service
feat(http): use authorized org service in org handler
feat(authorizer): rename Authorize to IsAllowed
I did this with a dumb editor macro, so some comments changed too.
Also rename root package from platform to influxdb.
In interest of minimizing risk, anyone importing the root package has
now aliased it to "platform" so that no changes beyond imports were
necessary in those files.
Lastly, replace the old platform module to local path /dev/null so that
nobody can accidentally reintroduce a platform dependency while
migrating platform code to influxdb.
feat(platform): add functional options for platform errors
fix(testing): set dashboard ids properly in dashboard tests
feat(bolt): add dashboard specific views
fix(bolt): delete view when cell is removed or dashboard is deleted
As of https://github.com/influxdata/platform/pull/2192 a panic was
introduced in the startup of platform. It is the result of
`Error{Code,Op,Message}` being passed a `(*platform.Error)(nil)`
instead of an `(error)(nil)`.
Specifically
```
if err == nil {
return ""
} else if e, ok := err.(*Error); ok && e.Code != "" {
return e.Code
}
```
will panic when err is `(*platform.Error)(nil)` as the `err == nil`
check will fail and the `e, ok := err.(*Error); ok && e.Code != ""` will
succeed and panic on `e.Code`, as `e` is nil.
This panic could have been avoided if all methods returned `error`
instead of `*platform.Error`.