Commit Graph

804 Commits (3ba680adbe50fde806daa6449cd586037563ef7b)

Author SHA1 Message Date
Jared Scheib 0e1bcfc9c6 Merge pull request #2355 from influxdata/multitenancy_all_users_superadmin_toggle
UI Toggle & API for SuperAdminFirstUserOnly server config
2017-12-14 10:54:18 -08:00
Jared Scheib 27fe23b161 Add comment about firstUser superAdmin logic 2017-12-14 10:46:55 -08:00
Michael Desa 4369c9d708 Add SuperAdmin to default org, even if private
Add user to default org if org is public
2017-12-13 17:38:57 -08:00
Michael Desa 2b60043016 Prevent users joining default org if private 2017-12-13 16:59:02 -08:00
Jared Scheib 058f5fbc20 Rename superAdminFirstUserOnly to superAdminNewUsers & flip default logic accordingly
Signed-off-by: Michael de Sa <mjdesa@gmail.com>
2017-12-13 14:49:49 -08:00
Jared Scheib a54712f600 Add config.self & config.auth routes, update client routes & make PATCH a PUT 2017-12-13 13:54:23 -08:00
Michael Desa 6059f155a1 Remove SuperAdminFirstUserOnly CLI flag
Wire up boltdb config store
2017-12-13 11:55:36 -08:00
Michael Desa c718847014 Wire up bolt db ConfigStore in Server 2017-12-13 10:46:08 -08:00
Michael Desa 9c989083a8 Add PUT /config/:section route 2017-12-13 09:28:39 -08:00
Michael Desa d0f63ca0e0 Add /config/:section endpoint 2017-12-13 09:04:44 -08:00
Benjamin Schweizer 0f9fb94e42 go fmt + got vet 2017-12-13 09:13:11 +01:00
Michael de Sa 17460e397b Implement Config GET service method
Signed-off-by: Jared Scheib <jared.scheib@gmail.com>
2017-12-12 17:06:57 -08:00
Jared Scheib 1e42cd6e0e Add /config link to AllRoutes handler
Signed-off-by: Michael de Sa <mjdesa@gmail.com>
2017-12-12 15:11:30 -08:00
Michael Desa 49c8868e67 Prevent user joining private default org
Previously, if an organization was private and a user was removed from
the default organization, then they would be re-added. This behavior was
so left over from when we thought of the default organization as the
place where all users would exist. This PR removes that behavior.

There is one piece of odd behavior where a user's "current organization"
will be the default organization, but they will have no role in the
default organization.
2017-12-12 13:15:53 -08:00
Benjamin Schweizer f7c85429ef add support for RS256 signatures using JWKS 2017-12-10 18:26:27 +01:00
Deniz Kusefoglu ed7f38c943 Merge branch 'master' into multiple-event-handlers 2017-12-08 12:20:40 -08:00
Nathan Haugo 05fc484864 Update bumpversion with 1.4.0.0-beta1 2017-12-07 14:38:28 -06:00
Jared Scheib 31f012ff8f Merge branch 'master' into multitenancy 2017-12-06 19:05:16 -08:00
Jared Scheib 14e8e70484 Merge branch 'multitenancy' into multitenancy_reset_current_org 2017-12-05 18:47:05 -08:00
Deniz Kusefoglu 903e461d40 Merge branch 'master' into multiple-event-handlers 2017-12-05 16:18:01 -08:00
Jared Scheib ff1cde524b Merge branch 'multitenancy' into multitenancy_fix_layouts 2017-12-05 16:03:05 -08:00
Michael Desa 8ff0e2947b Remove Create/Update/Delete logic for Layouts 2017-12-05 17:11:16 -05:00
Michael Desa c9471d4084 Remove /mappings in place of /layouts
Remove POST/PUT/DELETE methods to /layouts
2017-12-05 17:07:09 -05:00
Jared Scheib 9b87433ddf Merge branch 'multitenancy' into multitenancy_reset_current_org 2017-12-05 13:37:46 -08:00
Nathan Haugo e5afdc3c23 Merge pull request #2410 from influxdata/gauge-cell-type
Gauge Dashboard Cell
2017-12-05 13:26:02 -08:00
Jared Scheib 4f43d2a137 Merge branch 'master' into multitenancy 2017-12-05 13:00:48 -08:00
Chris Goller 86843f73d3 Merge branch 'master' into feature/add-meta-auth 2017-12-05 14:37:47 -06:00
Alex P 6025c1224a Merge branch 'master' into gauge-cell-type 2017-12-05 12:12:16 -08:00
Jared Scheib c9e579acb2 Merge remote-tracking branch 'origin/master' into multitenancy 2017-12-05 11:43:23 -08:00
Michael Desa 8cfc6bbbae Allow for empty MetaURL in UpdateSource
Currently, if an empty source is supplied, then the source's meta url
will not be updated. Now, if the MetaURL is supplied and is different
than the one that is currently on the source, the value will be updated.
Even in the case of empty string meta urls.
2017-12-05 13:04:31 -05:00
Chris Goller ef1cadb7a4 Add basic auth or JWT tokens for meta queries 2017-12-04 18:07:08 -06:00
Michael Desa 9a701a0a65 Allow admins to update a superadmins roles 2017-12-04 16:53:30 -05:00
Chris Goller 67cda93a63 Merge branch 'master' into fix/basepath-logout 2017-12-04 15:00:07 -06:00
Andrew Watkins c474193181 Will not supply roles if there is no metaURL 2017-12-02 12:11:52 -08:00
Chris Goller d6d7081b1e Update oauth logout to include basepath 2017-12-01 15:35:39 -06:00
Deniz Kusefoglu 2a21a31d68 Return 422 error instead of 500 for bad alert rule data
Signed-off-by: Chris Goller <goller@gmail.com>
2017-12-01 11:15:57 -08:00
Deniz Kusefoglu ecdaf84961 Provide more verbose error for alert rule json parsing
Signed-off-by: Chris Goller <goller@gmail.com>
2017-12-01 11:05:38 -08:00
Jared Scheib 76b61a146e Merge branch 'multitenancy' into multitenancy_reset_current_org 2017-11-30 19:07:40 -08:00
Jared Scheib 7588dcbf63 Complete 9ef1e57 by removing Role concept from sources in server 2017-11-30 19:03:56 -08:00
deniz kusefoglu 851149b397 Rename AlertHandlers to AlertNodes 2017-11-30 16:16:44 -08:00
Chris Goller f728c24764 Update kapacitor rule response to have empty arrays
Signed-off-by: Deniz Kusefoglu <denizk@gmail.com>
2017-11-30 16:32:47 -06:00
Michael Desa a81498f57a Change NewUsersNotSuperAdmin to SuperAdminFirstUserOnly 2017-11-30 15:01:52 -05:00
Chris Goller a841419bfb Update patching of enterprise users allow incremental updating of fields 2017-11-30 12:41:50 -06:00
Michael Desa a2df431c0d Make first user SuperAdmin 2017-11-30 12:56:13 -05:00
Michael Desa 57b876ad36 Unscope sources by role
Previously, as a misunderstanding of
https://github.com/influxdata/chronograf/issues/1915 we allowed
sources to be scoped by role within an organization. This was incorrect.
We no longer user the roles implementation of a chronograf.SourcesStore
and just use the organizations store.

We've left the code around a roles SourcesStore in place, since it may
be useful to us in the future. It may be worth removing if it is
determined that this behavior is not desirable.
2017-11-29 17:32:41 -05:00
Chris Goller 3a07920d4c Merge branch 'master' into gauge-cell-type
Conflicts:
	bolt/internal/internal.pb.go
	bolt/internal/internal.proto
	server/cells.go
2017-11-27 16:08:42 -06:00
Michael Desa a455bac3ce Accept name,provider,scheme in UpdateUser if unchanged 2017-11-22 15:20:48 -05:00
Michael Desa 942671b604 Ensure that organzation on role is valid org id 2017-11-22 15:03:15 -05:00
Michael Desa 5fa2e212fa Disallow empty organization id create/update user 2017-11-22 14:49:44 -05:00
Michael Desa 688bdbd2a8 Change HTTP Status 401 to 403 in AuthorizedUser
This signals to the front end that a user must go through another ouath
flow.
2017-11-21 18:55:26 -05:00
Michael Desa 881bd11cf8 Return HTTP Status 403 if org not found in /me
Fix returning non-standard status from AuthorizedUser
2017-11-21 18:53:42 -05:00
Chris Goller 0e72c0d16b Add GENERIC_API_KEY to override of oauth2 responses to support azure 2017-11-21 16:55:03 -06:00
Andrew Watkins 82fecbd91c Fix broken test due to stupid new line 2017-11-21 11:34:26 -08:00
Andrew Watkins 5280589505 Handle nil cell in validateDashboardRequest 2017-11-21 11:27:48 -08:00
Andrew Watkins 6f6cde7179 Merge branch 'master' into feature/time-cop 2017-11-21 10:29:31 -08:00
Chris Goller 862c1fcade Update invalid swagger information for cell hex color length 2017-11-21 12:22:02 -06:00
Chris Goller 8181e1eaf7 Add colors to all cells 2017-11-21 12:16:23 -06:00
Jared Scheib 78705185f4 Add mock.Store to queries test
Signed-off-by: Jared Scheib <jared.scheib@gmail.com>
2017-11-16 13:01:20 -08:00
Jared Scheib 59fb016a4e Merge branch 'master' into multitenancy 2017-11-14 00:05:18 -08:00
Michael Desa 505e4fad57 Add organizations to newDashboardResponse tests 2017-11-13 23:37:50 -08:00
Jared Scheib 9b56045f8f Add Organization ID to dashboards response
Signed-off-by: Michael de Sa <mjdesa@gmail.com>
2017-11-13 23:28:41 -08:00
Michael de Sa 579f946f00 Fix tests broken in 96a362cb
Signed-off-by: Jared Scheib <jared.scheib@gmail.com>
2017-11-13 23:10:26 -08:00
Michael Desa 7117835c52 Fix wording suggested in PR 2017-11-13 20:49:07 -08:00
Michael Desa 4e51963399 Add option to specify users are create as super admin 2017-11-13 20:44:50 -08:00
Michael Desa 1a235d881b Use default organization default role in me
Forbid users from application if they have no roles and were not
explicitly added in private organization
2017-11-13 19:28:15 -08:00
Luke Morris 338916a340 Address PR feedback. 2017-11-13 18:08:50 -08:00
Luke Morris 0424f9f92e Make Public values explicit 2017-11-13 12:15:53 -08:00
Luke Morris 37d351f63b Sew up failing tests 2017-11-13 11:47:34 -08:00
Luke Morris 1aebbf2bd4 Clear test noise 2017-11-10 18:45:25 -08:00
Luke Morris 9eccded4b2 Reuse chronograf.Organization type 2017-11-10 18:31:30 -08:00
Luke Morris 6d2c7e18d1 Rename whitelistOnly => public 2017-11-10 18:23:41 -08:00
Luke Morris 5fbf1e140a Persist whitelistOnly changes to default organization 2017-11-10 16:43:11 -08:00
Andrew Watkins 3a270747e2 Add test for queryConfig validation 2017-11-10 16:02:35 -08:00
Andrew Watkins 4880e876ee Add processing of incoming queryConfig 2017-11-10 16:02:08 -08:00
Michael Desa 638e36c197 Change MeOrganization to UpdateMe 2017-11-10 16:17:46 -05:00
Michael Desa 6493902265 Check WhitelistOnly setting on default org in Me
Set DefaultOrganizationWhitelistOnly to false

Set DefaultOrganizationRole on new user in Me
2017-11-10 16:15:29 -05:00
Michael Desa b110a28278 Add WhitelistOnly to organizations
Fix adding default role to organization
2017-11-10 15:57:48 -05:00
Michael Desa e2ac7f8bf0 Use raw organizations store is user is super admin 2017-11-10 15:33:28 -05:00
Michael Desa cc6f703f5d Fix updating default role on organization 2017-11-10 14:55:21 -05:00
Andrew Watkins e98e1896ae WIP Add shifts to queryConifg on backend 2017-11-10 11:06:48 -08:00
Michael Desa f228e2860d Expose some organization routes to admins
Cleanup tests appropriately

Prevent Admins from patching organizations
2017-11-10 12:48:10 -05:00
Michael Desa 81017173d7 Fix ValidSourceRequestComment 2017-11-10 12:20:58 -05:00
Michael Desa 04b9294c4d Fix ValidSourceRequest to modify pointer when needed
Add tests for Store.SourcesAll
2017-11-10 12:15:04 -05:00
Michael Desa 722d96f495 Change UserKey to UserContextKey 2017-11-10 11:28:19 -05:00
Michael Desa 3ce6e46b75 Add user that made the request to organization
Previously, when an org was created it had no users. Now when an
organization is created, the user that made the request is added to the
organization with the admin role.

If there are any errors when adding the user the organization, we make a
best effort attempt to delete the organization. However it is still
possilbe that an organization would be created, but have no users if our
best effort fails.
2017-11-10 11:20:56 -05:00
Michael Desa 590b1857d5 Change UserKey to UserContextKey
Fix name of arguments in tests
2017-11-10 11:18:06 -05:00
Michael Desa 9a0fa10d8a Sort users organizations on me response by org ID 2017-11-10 11:09:16 -05:00
Michael Desa 94d9d5345e Prevent user from deleteing themselves 2017-11-10 11:09:16 -05:00
Michael Desa f25c22444c Put entire user on context 2017-11-10 11:09:16 -05:00
Michael Desa 35be59a71a Differentiate between SuperAdminContext and ServerContext
Previously, the server just hijacked the super admin context in order to
get raw access to the underlying data stores, this introduces a way to
specify the it is explicitly the server making the request and no longer
hijack the super admin context.

This also adds test coverage to ensure that the correct values are being
set on context in the AuthorizedUser method.
2017-11-10 11:09:16 -05:00
Chris Goller d41a89debf Refactor and simplify auto group by (:interval:) template variable 2017-11-09 10:02:24 -08:00
Chris Goller 3f87dd6e77 Refactor and simplify auto group by (:interval:) template variable 2017-11-08 11:27:35 -06:00
Jared Scheib 25bea7c39a Merge pull request #2249 from influxdata/multitenancy_scoped_sources
Sources are scoped by users role in organization
2017-11-07 12:05:12 -08:00
Michael de Sa f7ad499011 Add verification that user does not have more than one role in org
Signed-off-by: Jared Scheib <jared.scheib@gmail.com>
2017-11-07 15:02:31 -05:00
Michael de Sa e69045d468 Remove super admin from store/sources tests
Signed-off-by: Jared Scheib <jared.scheib@gmail.com>
2017-11-07 14:57:37 -05:00
Jared Scheib bc13ca5ff4 Add clarifying comments about how roles, organization, and context are used to filter resources
Signed-off-by: Michael de Sa <mjdesa@gmail.com>
2017-11-07 14:56:55 -05:00
Michael Desa 4f7f9c2757 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 d40a374274 Add comments suggested from PR review
Add tests to server/stores_test.go
2017-11-07 13:59:40 -05:00
Jared Scheib c50422eb39 Modify mock store & json on superadmin-creates-SA user to reflect true SA status
Signed-off-by: Michael de Sa <mjdesa@gmail.com>
2017-11-06 11:17:27 -08:00
Michael Desa bd4d5c6cc3 Fix role related tests after rebase 2017-11-06 11:31:44 -05:00
Michael Desa 9b194168a6 Move user roles and role names to roles package 2017-11-06 11:27:13 -05:00
Michael Desa 4781cb3673 Allow update of sources.Role in server.UpdateSource 2017-11-06 11:25:51 -05:00
Michael Desa f3f183f685 Add role ctx where appropriate in AuthorizedUser 2017-11-06 11:25:46 -05:00
Michael Desa 9ee3b431db Add roles implementation of sources store
Minimal test coverage of Update/Delete/Add methods was done since they
do not involve any filtering. The filtering for them should have
happened at the API level.
2017-11-06 11:24:13 -05:00
Michael Desa f0d19277a3 Pull out setting super admin into a single func 2017-11-06 11:15:49 -05:00
Michael Desa 3565eda4a1 Allow SuperAdmins to promoted and demoted 2017-11-06 11:15:48 -05:00
Michael Desa 49232f009e Add default org check even when no auth is used 2017-11-06 10:17:17 -05:00
Michael Desa f75de68607 Remove DefaultOrganization Name in tests mock store 2017-11-06 10:17:17 -05:00
Michael Desa 7200aaf9f9 Add default org logic to OrganizationsStore
Update resource handlers to appropriate consume default organization IDs
2017-11-06 10:14:12 -05:00
Michael Desa 09f79f3a3e Grant user role in default org if added via API
When users are created via the API they are only given roles in orgs
that are explicitly set. Additionally the roles must be roles that
belong to the current organization (unless they are a super admin).

This leads to a situation where a user may not be a part of the default
organization. If this is the case, we detect it when the user hits /me
and add the user to the default org.
2017-11-06 09:46:00 -05:00
Michael Desa 63f7d8205c Add default role to chronograf.Organization 2017-11-06 09:46:00 -05:00
Chris Goller 02762a95e5 Update queries endpoint comment 2017-11-04 20:19:08 -05:00
Michael Desa 167c0c06a8 Prevent duplicate organization roles in user CRUD 2017-11-03 12:06:18 -04:00
Michael Desa aabefe3ac1 Fix me tests with proper IDs 2017-11-03 09:47:54 -04:00
Michael Desa 4baa65629a Fix links in me request 2017-11-03 09:39:21 -04:00
Michael Desa 450a965019 Properly pass organization context to handlers 2017-11-03 09:13:03 -04:00
Michael Desa b67b2e8d6e Fix over-stringification of organization on roles 2017-11-02 21:52:30 -04:00
Jared Scheib 500843a867 Add SuperAdmin to userResponse 2017-11-02 16:24:16 -07:00
Chris Goller cdd2c826b9 Fix rendering of templated queries to the /queries endpoint 2017-11-02 17:57:02 -05:00
Michael Desa 311c68f457 Add CurrentOrganization & Organizations to me resp
Remove CurrentOrganization from chronograf.User
2017-11-02 11:59:53 -04:00
Michael Desa 986f86d99c Fix relevant go-vet/go-lint for server package 2017-11-01 16:43:31 -04:00
Michael Desa aa2087ec43 Add exhaustive test for AuthorizedUser 2017-11-01 16:38:17 -04:00
Michael Desa 65028027fd Add comments to DataStore interface and implemntn 2017-11-01 14:24:40 -04:00
Michael Desa eb845b1630 Fix routes tests 2017-11-01 14:09:58 -04:00
Jared Scheib 2e0911dbd9 Add organizations and users routes to allRoutes
Signed-off-by: Michael de Sa <mjdesa@gmail.com>
2017-11-01 12:59:07 -04:00
Michael Desa 40feb4ae94 Change nil check to len == 0 check for userRequest 2017-11-01 12:38:26 -04:00
Michael Desa 46987558e0 Remove unused code 2017-11-01 12:35:09 -04:00
Michael Desa 569978b4f7 Add parseOrganizationID method 2017-11-01 12:34:00 -04:00
Michael Desa e7a94c18d6 Add comments throughout codebase 2017-11-01 12:30:42 -04:00
Michael Desa a8a115ec50 Change function signature of hasSuperAdminContext 2017-11-01 10:39:09 -04:00
Michael Desa 4c0469cb07 Change OrganizationID to Organization in Me req 2017-11-01 10:37:32 -04:00
Michael Desa 0e18f8778b User explicit type when setting context 2017-11-01 09:49:02 -04:00
Michael Desa 3ad2305c33 Add superAdmin to users CRUD 2017-11-01 09:12:19 -04:00
Michael Desa 708c37dc67 WIP cleanup 2017-10-31 20:58:40 -04:00
Michael Desa e7e17537a1 WIP make app usable by frontend 2017-10-31 19:50:03 -04:00
Michael Desa f863bf2042 Add support for super admin 2017-10-31 18:27:24 -04:00
Michael Desa 2bd2c81bb7 Add noop implementation of each source type 2017-10-31 18:07:42 -04:00
Michael Desa cf64b2e506 Remove RawUsers from DataStore 2017-10-31 17:49:35 -04:00
Michael Desa 00b79a45eb Add org param to New Organizaiton methods 2017-10-31 17:40:58 -04:00
Michael Desa 36e14cb111 Refactor data stores into a common interface 2017-10-31 16:41:17 -04:00
Michael Desa bea2caaa7f Move organization resouces to their own package 2017-10-30 14:31:19 -04:00
Michael Desa 1082b264fe Use organization stores 2017-10-30 12:05:59 -04:00
Jared Scheib cbc22b10d7 Test authorized User in the context of Organization
Make principal explicit arg in auth tests.

Signed-off-by: Michael de Sa <mjdesa@gmail.com>
2017-10-27 13:54:28 -07:00
Michael de Sa cf58974927 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
Jared Scheib 32a65aa307 Slightly DRYer code for getting fields off Principal
Signed-off-by: Michael de Sa <mjdesa@gmail.com>
2017-10-27 12:48:51 -07:00
Michael de Sa cff3ae798d Test MeOrganization for valid org with invalid user, and invalid org
Signed-off-by: Jared Scheib <jared.scheib@gmail.com>
2017-10-27 10:14:14 -07:00
Jared Scheib 4c968b0ff5 Validate Organization and that User belongs to Org in MeOrganization
Signed-off-by: Michael de Sa <mjdesa@gmail.com>
2017-10-27 10:02:02 -07:00
Michael de Sa 5c4407cbaf Test MeOrganization for setting and changing current org
Signed-off-by: Jared Scheib <jared.scheib@gmail.com>
2017-10-26 16:03:01 -07:00
Michael de Sa 6dd9f52c47 Change organization in meOrganizationRequest to currentOrganization
Signed-off-by: Jared Scheib <jared.scheib@gmail.com>
2017-10-26 16:02:29 -07:00
Jared Scheib 30d1739e35 Move Mock Authenticator into mocks package
Signed-off-by: Michael de Sa <mjdesa@gmail.com>
2017-10-26 15:46:06 -07:00
Chris Goller 3152471f7c Fix logger and redirector to be flushers allowing HTTP chunking 2017-10-26 17:38:20 -05:00
Chris Goller f94eed49f5 Fix kapacitor proxy to accept url query parameters 2017-10-26 17:38:03 -05:00
Chris Goller 10e45721b4 Add flush interval to kapacitor proxy to fix buffering 2017-10-26 17:37:28 -05:00
Jared Scheib d6d3463208 Merge remote-tracking branch 'origin/multitenancy' into multitenancy_orgs
Signed-off-by: Michael de Sa <mjdesa@gmail.com>
2017-10-26 18:21:30 -04:00
Michael Desa 5e08464ecf 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
Nathan Haugo c720f8a9cb Merge pull request #2140 from influxdata/feature/kapa-insecure
Add insecure ssl support to connect to kapacitor
2017-10-26 10:40:28 -04:00
Jared Scheib cf530eddc6 Update Organization comments on resources
Remove `omitempty` on Organization field

Signed-off-by: Michael de Sa <mjdesa@gmail.com>
2017-10-25 14:56:08 -04:00
Jared Scheib 4786964b54 Add Organization guard to server/kapacitors
Signed-off-by: Michael de Sa <mjdesa@gmail.com>
2017-10-25 14:48:19 -04:00
Michael Desa e909ce9a1e Add Organizations to Dashboards 2017-10-25 14:00:06 -04:00
Michael Desa 57468b5fbe Add Organization to layouts 2017-10-25 12:52:56 -04:00
Michael Desa ef079a1899 Add Organization to Sources 2017-10-25 11:51:15 -04:00
Jared Scheib bb67361cf1 Merge branch 'multitenancy' into multitenancy_lowercase_fields 2017-10-24 18:01:32 -07:00
Jared Scheib aa8742662f Merge branch 'master' into multitenancy 2017-10-24 17:58:15 -07:00
Jared Scheib 74fdcc1c39 Add scheme to me/AuthorizedUser tests 2017-10-24 16:21:24 -07:00
Jared Scheib f283702fe0 Lowercase Provider & Scheme & Role values for consistency
The client was being sent lowercase values for Role & Provider,
but not Scheme. This change makes all the above lowercase.
2017-10-24 16:17:59 -07:00
Jared Scheib 3b2818688a Make all Store names plural for consistency 2017-10-24 15:54:24 -07:00
Michael de Sa 86ba743f40 Fix string interpolation data type for uint64 in Users tests
Signed-off-by: Jared Scheib <jared.scheib@gmail.com>
2017-10-24 14:28:39 -07:00
Michael de Sa 2137191d5f Modify ValidUpdate to ensure only User Roles can be updated
Signed-off-by: Jared Scheib <jared.scheib@gmail.com>
2017-10-24 14:28:35 -07:00
Nathan Haugo da560018c6 Update changelog and version number for 1.3.10.0 2017-10-24 09:34:31 -04:00
Michael Desa 2226f34cf2 Add tests for server/organizations.go 2017-10-23 14:16:52 -04:00
Michael Desa 3f3e7a5662 Fix typo in organization comment 2017-10-23 14:16:31 -04:00
Michael Desa ee255f319d Add missing returns in http hanlder methods 2017-10-20 15:42:51 -04:00
Michael Desa b5e73dfd46 Add CRUD routes for organizations 2017-10-20 15:42:34 -04:00
Chris Goller 1b6724122c Add insecure ssl support to connect to kapacitor 2017-10-19 22:48:31 -05:00
Michael de Sa 414ca7f0b6 Add clarifying comment for InfluxDB UID being Name
Signed-off-by: Jared Scheib <jared.scheib@gmail.com>
2017-10-19 14:42:34 -05:00
Michael de Sa f463642bae Update route authorization by Role
Signed-off-by: Jared Scheib <jared.scheib@gmail.com>
2017-10-19 14:33:08 -05:00
Jared Scheib 19369b38cc Set Scheme to be OAuth2 explicitly for all users
Add Provider to Users authenticated via /me

Signed-off-by: Michael de Sa <mjdesa@gmail.com>
2017-10-19 14:32:33 -05:00
Michael Desa dafab1653a Fix formating of server/auth.go 2017-10-19 12:54:06 -04:00
Michael Desa 8d472646cd 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 a0d300d280 Use new chonograf.UserStore Get method when needed
Refactor tests that were dependent of old implementation of UsersStore
2017-10-18 14:45:33 -04:00
Michael Desa 246e65e598 Generalize chronograf.UsersStore Get method
The `Get` method on the UsersStore was generalize by changing the second
parameter to a struct. This allows the Store to retrieve users by more
than simply their name.

-Get(ctx context.Context, name string) (*User, error)
+Get(ctx context.Context, q UserQuery) (*User, error)
2017-10-18 14:17:42 -04:00
Michael Desa 0517a87954 Add comment to AuthorizedUser 2017-10-18 12:45:58 -04:00
Michael Desa 3430eeb84b Wrap routes with Authorization middleware 2017-10-18 12:40:17 -04:00
Michael Desa f50a2b686f Add AuthorizedUser middleware 2017-10-18 12:35:40 -04:00
Michael Desa e61ed60ae8 Extract logic for getting user by name & provider 2017-10-18 12:34:23 -04:00
Michael de Sa 84f6702edf Modify /me to match User via UsersStore.All & principal's Issuer
Signed-off-by: Jared Scheib <jared.scheib@gmail.com>
2017-10-16 19:58:02 -05:00
Jared Scheib 414eab5f7d Rename getEmail func & email var to getUsername & username
Signed-off-by: Michael de Sa <mjdesa@gmail.com>
2017-10-16 19:58:02 -05:00
Jared Scheib cc7e695f37 Merge pull request #2113 from influxdata/multitenancy_rename_role_sourcerole
MULTITENANCY: Rename Role CRUD methods & structs w Source prefix
2017-10-16 19:51:38 -05:00
Jared Scheib c924771fb9 Lowercase string consts for role names
Signed-off-by: Michael de Sa <mjdesa@gmail.com>
2017-10-16 19:42:57 -05:00
Michael de Sa c390678e43 Place user role consts and vars in server package
This also decouples the bolt tests from the server package.

Signed-off-by: Jared Scheib <jared.scheib@gmail.com>
2017-10-16 18:43:56 -05:00
Jared Scheib de6068228b Replace string slices of role names with slices of chronograf.Role
This effectively reinstants rolly polly as king.

Signed-off-by: Michael de Sa <mjdesa@gmail.com>
2017-10-16 18:26:08 -05:00
Michael de Sa 93e3e68272 Suggest valid options in Invalid Role error message
Signed-off-by: Jared Scheib <jared.scheib@gmail.com>
2017-10-16 15:56:43 -05:00
Michael de Sa b2c4d9cb94 Add test coverage for userRequest validation
Signed-off-by: Jared Scheib <jared.scheib@gmail.com>
2017-10-16 14:28:15 -05:00
Jared Scheib 74b4ad2c86 Remove unnecessary logic in ValidRoles guard
Signed-off-by: Michael de Sa <mjdesa@gmail.com>
2017-10-16 13:58:16 -05:00
Jared Scheib 263ff93f9b Modify chronograf user roles to only use role name
Signed-off-by: Michael de Sa <mjdesa@gmail.com>
2017-10-16 14:44:34 -04:00
Jared Scheib a928d1518c Modify User req & res to receive & give Role names only
Role members are fully explicated for CRUD operations.
Also adds validation for Roles on requests.
Also returns an empty array in JSON when a User has no roles.
2017-10-16 14:18:34 -04:00
Chris Goller 725fd521dc Update swagger documentation about queryConfig 2017-10-16 11:51:51 -05:00
Chris Goller 7b786657aa Rename queryConfig field to Value and support top/bottom 2017-10-16 10:56:12 -05:00
Jared Scheib de3dcf24c0 Add Roles to Users CRUD
Signed-off-by: Michael de Sa <mjdesa@gmail.com>
2017-10-12 17:42:30 -07:00
Jared Scheib b5693694ee 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 Desa 33976d2832 Add jsonEqual to test helpers file 2017-10-11 14:33:55 -04:00
Michael de Sa a8c50620f3 Refactor setting writer Location header
Signed-off-by: Jared Scheib <jared.scheib@gmail.com>
2017-10-11 10:14:57 -07:00
Chris Goller 3c1b09704e Refactor query config field arguments to be fields 2017-10-10 18:04:45 -05:00
Jared Scheib 31f72a71e9 Rename vestigial receiver 'h' on Service to 's'
Signed-off-by: Michael de Sa <mjdesa@gmail.com>
2017-10-10 15:27:58 -07:00
Chris Goller 3ba1a4c94d Refactor queryConfig to have field aliases and function arguments 2017-10-10 17:01:50 -05:00
Jared Scheib eca9614cda Refactor applying writer location header into helper func
Signed-off-by: Michael de Sa <mjdesa@gmail.com>
2017-10-10 14:40:45 -07:00
Michael de Sa 30f36bfd19 Move source_users & source_users_test code into sources.go & sources_test.go
Signed-off-by: Jared Scheib <jared.scheib@gmail.com>
2017-10-10 14:32:41 -07:00
Michael de Sa e00f4512d2 Remove omitempty for Provider & Scheme in userRequest and userResponse
Signed-off-by: Jared Scheib <jared.scheib@gmail.com>
2017-10-10 14:25:45 -07:00
Michael de Sa a46e3ab7c2 Use more idiomatic error message method
Signed-off-by: Jared Scheib <jared.scheib@gmail.com>
2017-10-10 14:21:43 -07:00
Michael de Sa 85dde0cebe Add comments on ValidUpdate for future considerations
Signed-off-by: Jared Scheib <jared.scheib@gmail.com>
2017-10-10 14:19:28 -07:00
Jared Scheib af5d21028c Make name on userResponse required
Signed-off-by: Michael de Sa <mjdesa@gmail.com>
2017-10-10 14:15:31 -07:00
Jared Scheib 2d88f15fdf Use string IDs in JSON res and req for Users
Signed-off-by: Michael de Sa <mjdesa@gmail.com>
2017-10-10 12:27:55 -07:00
Michael de Sa 63d7a4d201 Update only fields with diff; add test for that
Signed-off-by: Jared Scheib <jared.scheib@gmail.com>
2017-10-10 11:40:33 -07:00
Michael de Sa 526dca3cb4 Make User Update test reflect updated changes
Signed-off-by: Jared Scheib <jared.scheib@gmail.com>
2017-10-10 11:36:13 -07:00
Michael de Sa f2617c6744 Use new-school sort.Slice
Signed-off-by: Jared Scheib <jared.scheib@gmail.com>
2017-10-10 11:30:57 -07:00
Jared Scheib c5ef8ed487 Add comments to exported functions
Signed-off-by: Michael de Sa <mjdesa@gmail.com>
2017-10-09 15:28:39 -07:00
Michael de Sa 6135a6a4ea Return users in usersResponse in sorted order
Signed-off-by: Jared Scheib <jared.scheib@gmail.com>
2017-10-09 15:19:46 -07:00
Michael de Sa b8970c8ed1 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 eb6c212023 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
Nathan Haugo a2f270bdb2 Update version 2017-10-06 11:38:40 -07:00
Chris Goller 0e6a06d663 Update dashboard cells to have optional data source URI. 2017-10-02 12:50:42 -07:00
Andrew Watkins a35f045648 Update kapacitor links to include tasks and ping paths 2017-09-12 09:23:22 -07:00
Chris Goller 35248b8044 Update kapacitor AlertRule to containe most Kapacitor Task information 2017-09-09 10:19:52 -05:00
Chris Goller d1007513cd Update kapacitor rule response with dbrps, various dates, error, and executing. 2017-09-09 10:19:52 -05:00
Chris Goller 08ecc10ddb Update swagger docs with new kapacitor rule fields 2017-09-09 10:19:52 -05:00
Chris Goller bebe0f364a WIP 2017-09-09 10:19:52 -05:00
Nathan Haugo 3387c941af Bump version to 1.3.8.0 2017-09-07 16:29:56 -07:00
Tim Raymond f8580d907e Refactor set membership validation
The pattern of using a select with a list of options and a default that
returns an error isn't bad for a one-off validation:

select myProp {
  case "validOption1", "validOption2":
    // no-op
  default:
    panic("invalid!")
}

However, we're doing this multiple times in this method, so it makes
sense to pull this out into a new method to make it clearer what's
happening.

This adds a `oneOf` function that takes some property and a variadic
list of valid options and reports whether or not that property is among
that list.
2017-08-24 15:45:51 -04:00
Tim Raymond c24db57385 Add validation around Base and Scale
The Base and Scale options on axes can only be one of two parameters. We
weren't validating that this was the case. This patch ensures that Base
can only ever be "10" or "2", and Scale must be either "linear" or
"log".

Associated test coverage was also added.
2017-08-24 15:37:19 -04:00
Tim Raymond 63087a1bb8 Update Swagger for new axes options
New options were introduced to control things like scale, base, etc. on
axes and these were previously not documented. This adds documentation
of the newly supported parameters by the API.
2017-08-24 14:50:12 -04:00
Nathan Haugo 7a85e3a152 Merge 1.3.7.x 2017-08-23 16:01:30 -07:00
Nathan Haugo 5a13db41ba Bump to 1.3.7.0 2017-08-23 15:56:00 -07:00
Tim Raymond fed021ed9c Merge branch 'master' into feature/tr-kapa-rule-pagination 2017-08-23 16:44:59 -04:00
Tim Raymond f46335fb27 Remove kapacitor mock logic
This logic was originally left in place to help future test writers, but
its presence was vexing because it was not exercised in existing test
cases. It has been commented out should future tests need to leverage
it.
2017-08-23 16:39:12 -04:00
Timothy J. Raymond 61bffeb7cb Merge pull request #1859 from influxdata/feature/tr-layout-cell-axes
Add Axes to Layout Cells
2017-08-16 16:45:26 -04:00
Tim Raymond 9b71477509 Switch KapacitorRulesGet to use Pagination
Kapacitor responses are paginated, and sometimes users have more than
the default 100 tasks that are returned from Kapacitor. This replaces
the previous Kapa client with one that automatically follows paginated
responses from Kapacitor's ListTasks endpoint and returns the full
response.

Tests for the KapacitorRulesGet endpoint had to be updated because they
did not account for "limit" and "offset", and so led to an infinite
loop with the paginated client. A correct kapacitor backend will not
have this behavior
2017-08-15 17:30:29 -04:00
Tim Raymond fcf325bbbe Add PaginatingKapacitorClient
The kapacitor client used in the kapacitor endpoints is limited to
fetching whatever limit you provide it. If you provide no limit, it
defaults to a limit of 100. We use this default behavior currently.

Some users have more than 100 tasks, so we need a client that's capable
of continually fetching tasks from Kapacitor until there are none left,
and returning the full response to the frontend.

This introduces a PaginatingKapacitorClient which does exactly that.
Also, test coverage was added around the KapacitorRulesGet endpoint,
since it was previously untested.
2017-08-15 16:55:47 -04:00
Timothy J. Raymond 246cf75ce7 Merge pull request #1866 from influxdata/bugfix/tr-missing-cell-type
Fix missing cell type
2017-08-14 14:04:36 -04:00
Tim Raymond 74f464800d Fix missing cell type
Because we are now creating new instances of dashboards when we create a
response, it's critical to copy every element of Dashboards from the
previous to the new instance.

We were not previously copying the Type field of cells, so this was
defaulting to the empty string zero value. This patch adds "Type" to the
tests and ensures that it's properly copied
2017-08-14 13:41:31 -04:00
Jared Scheib 974e9eaf7d Add 'type' to new-sources server flag example 2017-08-11 11:54:16 -07:00
Tim Raymond c77630ff49 Ensure "x", "y", and "y2" axes present
Similar to DashboardCells, this ensures that the "x", "y", and "y2" axes
are always present in a layout's cells.
2017-08-10 13:53:07 -07:00
Tim Raymond c2a5083777 Add test coverage to /layouts endpoint
In anticipation of adding Axes to cells, I wanted some test coverage to
be in place before I made the change.

This covers the happy path case as well as focusing on individual
applications. To come are focusing on a measurement and a test for when
the store is unavailable.
2017-08-10 13:52:26 -07:00
Tim Raymond 532a6a8c48 Merge branch 'master' into feature/1602-graph-bounds-setting
Also removed LegacyBounds marshaling since it was no longer necessary

Conflicts resolved:
	bolt/internal/internal.go
	bolt/internal/internal.pb.go
	bolt/internal/internal.proto
	bolt/internal/internal_test.go
	chronograf.go
	server/cells_test.go
	server/dashboards_test.go
	server/swagger.json
2017-08-02 11:29:29 -04:00
Tim Raymond e545f91d8f Add Label to DashboardCell Axis
It's useful for the frontend to be able to specify a label on a
particular axis. This adds a property to Axis to facilitate that.
2017-08-02 11:12:47 -04:00
Tim Raymond e703107644 Copy missing properties from Dashboards
When creating new dashboards to set defaults, not all properties of the
dashboard were being copied. This ensures that they are so that zero
values are not used for things like the ID and Name.
2017-07-31 17:24:43 -04:00
Tim Raymond 7aad733682 Fix data races in dashboard response construction
Dashboard responses had data races because multiple goroutines were
reading and modifying dashboards before sending them out on the wire.
This patch introduces immutability in the construction of the response,
so that each goroutine is working with its own set of dashboardResponse
structs.
2017-07-31 16:36:20 -04:00
Tim Raymond 08bf8aeff5 Ensure cell bounds come back as empty array
The contract with the frontend states that bounds should come back as an
empty array instead of null when there are no bounds present. We must
explicitly specify []string{} for this to happen.
2017-07-31 16:36:16 -04:00
Tim Raymond 4391004e7f Enforce presence of "x", "y", and "y2" axes
Certain aspects of the frontend requires the presence of these three
axes, so part of the contract established is that the backend will
always provide them. Since we centralize creation of
dashboardCellResponses, this is where these axes are added to all cell
responses.

Additionally, because there was previously no coverage over the
dashboard cells endpoints, a test has been added to cover the
DashboardCells method of Service.
2017-07-31 16:36:07 -04:00
Tim Raymond 2ff3e27e1f Convert Axis Bounds to []string
Due to various limitations with the previous implementation of Bounds as
a [2]int64{}, we've decided to change this to a []string{}. This will
allow clients to store arbitrary data specifying a bound and interpret
it as they wish.
2017-07-31 16:35:53 -04:00
Chris Goller 2d8b1ef340 Release 1.3.5.0 2017-07-25 15:08:02 -05:00