Commit Graph

107 Commits (0e6f14931bb923ec6cc7286f031a411a371ac110)

Author SHA1 Message Date
Luke Morris 59b6979812 Merge branch 'master' into feature/annotationz-pre-pl-with-master 2018-02-15 12:03:10 -08:00
Luke Morris 67ac6a5a2f Merge branch 'master' into feature/mappings 2018-02-09 11:42:07 -08:00
Alex P 66b41abdce Merge branch 'master' into feature/annotationz-pre-pl-with-master 2018-02-08 16:38:47 -08:00
Michael Desa efd691d1b5 Add Mappings CUDA routes 2018-02-05 16:47:44 -05:00
Michael Desa 8b60388d81 Add correct implementation of mappings 2018-02-05 14:54:39 -05:00
Chris Goller 7555783638 Update influxdb annotation store to support update/delete 2018-01-18 21:50:46 -06:00
Michael Desa 8fa2eabdb3 Fix RouteMatchesPrincipal if org isnt on principal 2018-01-17 12:42:32 -05:00
Michael Desa 23a4c34a17 Populate links response with organiation on JWT 2018-01-17 12:26:28 -05:00
Michael Desa f3c57f1e3f Add correct users route to all routes 2018-01-16 17:03:46 -05:00
Michael Desa 2d7828b602 Nest user routes under organization
Add global user routes
2018-01-16 16:45:58 -05:00
Chris Goller 243ccb1ffb Add basic REST routes for annotations 2018-01-12 17:17:14 -06:00
Michael Desa 0d6a508a00 Modify CRUD user handlers for global operations
Add raw query param middleware performing raw ops

This commit introduces middleware that allows SuperAdmin Users to
specify a query param `raw=true` which will give them raw access to the
data store. Raw access means that it is not in behind the usual
organization facade.

Currently, only the user routes use this middleware.
2018-01-09 13:43:33 -05:00
Michael Desa 2151413ece Add /chronograf/v1/env endpoint to expose env vars
Some environment variables are needed by the front end. This PR
introduces a route so that those environment variables can be exposed.
Additionally, a new environment variable TELEGRAF_SYSTEM_INTERVAL was
added. This env var controls the rate at which the host list page will
update its red/green status.
2018-01-03 11:52:40 -08:00
Chris Goller 45301fb012 Fix cell replacement to return query config 2017-12-19 13:43:39 -06:00
Michael Desa 4496c361d7 Add PUT /config/:section route 2017-12-13 09:28:39 -08:00
Michael Desa 5ec549db0f Add /config/:section endpoint 2017-12-13 09:04:44 -08:00
Michael de Sa fcd25ad580 Implement Config GET service method
Signed-off-by: Jared Scheib <jared.scheib@gmail.com>
2017-12-12 17:06:57 -08:00
Jared Scheib 808163fe69 Merge branch 'multitenancy' into multitenancy_fix_layouts 2017-12-05 16:03:05 -08:00
Michael Desa fc0d525022 Remove /mappings in place of /layouts
Remove POST/PUT/DELETE methods to /layouts
2017-12-05 17:07:09 -05:00
Jared Scheib 93f11e1325 Merge remote-tracking branch 'origin/master' into multitenancy 2017-12-05 11:43:23 -08:00
Chris Goller 3f760c1b1b Update oauth logout to include basepath 2017-12-01 15:35:39 -06:00
Michael Desa d53fcea236 Change MeOrganization to UpdateMe 2017-11-10 16:17:46 -05:00
Michael Desa 85bb71033c Expose some organization routes to admins
Cleanup tests appropriately

Prevent Admins from patching organizations
2017-11-10 12:48:10 -05:00
Michael Desa 6f66dd8a47 Change SuperAdminRoleName to SuperAdminStatus
SuperAdmin is not a role type, but it a status of a user that is
tangentially related to a users role in an organization. This renames
the variable to reflect that difference.
2017-11-07 13:59:51 -05:00
Michael Desa 859d94ab15 Move user roles and role names to roles package 2017-11-06 11:27:13 -05:00
Michael Desa a9d5bf9c05 WIP cleanup 2017-10-31 20:58:40 -04:00
Michael Desa 5f63e2738a Refactor data stores into a common interface 2017-10-31 16:41:17 -04:00
Michael de Sa 10c63ee00c Add organization field to principal in auth tests
Signed-off-by: Jared Scheib <jared.scheib@gmail.com>
2017-10-27 13:19:43 -07:00
Michael Desa bf6c77ee5f Provide route to change current users organization
Add current Organization to JWT.
Use OrganizationUsersStore to retrieve Users that are not me.

Signed-off-by: Michael de Sa <mjdesa@gmail.com>
2017-10-26 18:06:52 -04:00
Michael Desa 0842e8c479 Add CRUD routes for organizations 2017-10-20 15:42:34 -04:00
Michael de Sa c261ffadde Update route authorization by Role
Signed-off-by: Jared Scheib <jared.scheib@gmail.com>
2017-10-19 14:33:08 -05:00
Michael Desa 34414df016 Fix wrong authorization level on selected routes
Fix leaking of username on failed authorization

Add comment to chronograf.UserQuery

Fix logic in hasPrivilege method
2017-10-18 15:45:06 -04:00
Michael Desa fb6d91df9f Wrap routes with Authorization middleware 2017-10-18 12:40:17 -04:00
Jared Scheib 0d2715048d Rename Role CRUD methods & structs w Source prefix
Move server/roles.go and server/roles_test.go into server/sources.go and
server/sources_test.go respectively.

Signed-off-by: Michael de Sa <mjdesa@gmail.com>
2017-10-12 19:25:33 -04:00
Michael de Sa 1a6b446bf8 Add All route & operation for Chronograf Users
Signed-off-by: Jared Scheib <jared.scheib@gmail.com>
2017-10-09 15:03:50 -07:00
Jared Scheib 37183d871c Implement CRUD routes & operations for Chronograf User
Move source Users code into source_users and source_users_test files.
Use the UsersStore for both InfluxDB and Chronograf users.

Signed-off-by: Michael de Sa <mjdesa@gmail.com>
2017-10-09 14:16:24 -07:00
Jared Scheib 90aaa8104d Refactor CustomLinks transform into routes.go and new links.go
Rename generateCustomLinks to NewCustomLinks
Handle error from NewCustomLinks per app convention
2017-06-26 15:30:33 -05:00
Jared Scheib 7d6eaf925a Generate custom links from env var and multiple CLI flags
Signed-off-by: Chris Goller <goller@gmail.com>
2017-06-26 11:48:47 -07:00
Jared Scheib 613dcc64ac WIP Parse custom links from CLI 2017-06-23 15:12:02 -07:00
Jared Scheib 7e359239e5 Refactor statusFeedURL to be set in CLI 'default'
Reverts to a clean separation of concerns between mux.go vs AllRoutes
AllRoutes now expects a StatusFeed url directly
2017-06-15 13:51:22 -07:00
Jared Scheib 8af550fa6f Add default InfluxData JSON feed url 2017-06-13 19:23:52 -07:00
Jared Scheib 25bde527a6 Add status-feed-url build flag within new externalLinks prop in AllRoutes 2017-06-13 13:40:20 -07:00
Jared Scheib 6806f62ac0 Refactor /chronograf/v1 to not return logoutLink if not using auth
Use logoutLink to determine if logout menu item is shown

Signed-off-by: Chris Goller <güllère@gmail.com>
2017-05-30 17:34:55 -07:00
Tim Raymond 24160ed6ef Force prefixing in several locations
The Basepath option should be applied in anything that will be consumed
by the React application. This is because from its perspective, the
proxy sitting between it and the backend wants those prefixes regardless
of what it does with them before handing the request back to the
Chronograf backend. Consequently, there's situations in the backend
where we need to have the `opts.Basepath` or the `basepath` that we
alter when `opts.PrefixRoutes` is set. The `basepath` is strictly for
altering routing decisions made by the backend.

There's subtle places where routes are supplied to the frontend that
need to always have the `opts.Basepath` set as well. Another commit
addressed the "Location" header of Redirects, for example.
2017-05-08 14:40:50 -07:00
Tim Raymond 5cf21f6cbd Add PrefixedRedirect function
The router that we use has a feature that will automatically redirect
routes in certain situations where it feels a trailing slash would be
appropriate. Because the underlying router is totally unaware of
upstream prefixing activity, the "Location" that it sends clients to is
incorrect because it doesn't have the prefix.

This introduces a middleware that catches any downstream 3XX class
responses and replaces the Location header with the prefixed version of
it, plus a trailing slash. It does this only when the prefix has not
been applied already by some downstream middleware.
2017-05-08 14:40:50 -07:00
Tim Raymond 33e5eb0e30 Use Basepath over string concatenation
Basepath was previously not working here because the strings constructed
via concatenation had a trailing slash at the end:

Before:
  rootPath => "/someprefix/chronograf/v1/"

After:
  rootPath => "/someprefix/chronograf/v1"

The julienschmidt/httprouter that the bouk/httprouter is based on has
support for ignoring trailing slashes, which is behavior that we want.
However, routing decisions involving this rootPath string were being
made by a `strings.HasPrefix` function. This conditional seeks to
apply the token middleware only in cases where routes _under_
`/chronograf/v1` are accessed (e.g. `/chronograf/v1/sources`). In cases
where the paths were effectively equal, this conditional accidentally
worked because the string `/chronograf/v1` does not have the prefix
`/chronograf/v1/`. When this was corrected to use `path.Join`, this case
became true and caused the token middleware to be applied.

`path.Join` is the correct way to construct paths, since this prevents
issues where a fragment like `/foo/` is concatenated with a fragment
like `/bar/quux/` to yield the string `/foo//bar/quux/`.

Given that continuing to use concatenation is no longer an option, the
solution is to compare the lengths of the strings to ensure that the
path under comparison is longer than the prefix it's being tested
against. This guarantees that the subject path is a route underneath the
`/chronograf/v1` route.
2017-05-08 14:40:50 -07:00
Tim Raymond 5897e62928 Remove broken path.Join logic
It is entirely unclear why this doesn't work.
2017-05-08 14:40:50 -07:00
Tim Raymond & Jared Scheib 337c7b16a5 Fix OAuth when using Basepath
Updated the logout link in the UI to use a link provided by the
/chronograf/v1/ endpoint. We also replaced many instances of string
concatenation of URL paths with path.Join, which better handles cases
where prefixed and suffixed "/" characters may be present in provided
basepaths. We also refactored how Basepath was being prefixed when using
Auth. Documentation was also updated to warn users that basepaths should
be applied to the OAuth callback link when configuring OAuth with their
provider.
2017-05-08 14:40:50 -07:00
Chris Goller 86575b2cde Add line-protocol /write endpoint to all data sources 2017-05-03 00:06:40 -05:00
Chris Goller e44f716543 Add initial template CRUD operations 2017-04-20 11:09:56 -05:00