Commit Graph

715 Commits (9d4162c60bde92a3849988ef3cbd293cf30c1c33)

Author SHA1 Message Date
deniz kusefoglu 00dca72f19 Rename AlertHandlers to AlertNodes 2017-11-30 16:16:44 -08:00
Chris Goller c7f35f14ec 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 6feba85807 Change NewUsersNotSuperAdmin to SuperAdminFirstUserOnly 2017-11-30 15:01:52 -05:00
Chris Goller 52e1175c7d Update patching of enterprise users allow incremental updating of fields 2017-11-30 12:41:50 -06:00
Michael Desa 86b9c0d985 Make first user SuperAdmin 2017-11-30 12:56:13 -05:00
Michael Desa 9ef1e57934 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 6564712e9d 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 6ca8bf5089 Accept name,provider,scheme in UpdateUser if unchanged 2017-11-22 15:20:48 -05:00
Michael Desa 8f7363b3f4 Ensure that organzation on role is valid org id 2017-11-22 15:03:15 -05:00
Michael Desa ec20267c2f Disallow empty organization id create/update user 2017-11-22 14:49:44 -05:00
Michael Desa f2591c9eb1 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 cf82990623 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 c87bfe1678 Add GENERIC_API_KEY to override of oauth2 responses to support azure 2017-11-21 16:55:03 -06:00
Andrew Watkins 59fb33387b Fix broken test due to stupid new line 2017-11-21 11:34:26 -08:00
Andrew Watkins 33e83254e5 Handle nil cell in validateDashboardRequest 2017-11-21 11:27:48 -08:00
Andrew Watkins 5398c791b1
Merge branch 'master' into feature/time-cop 2017-11-21 10:29:31 -08:00
Chris Goller e0246bc840 Update invalid swagger information for cell hex color length 2017-11-21 12:22:02 -06:00
Chris Goller 1d11677c5f Add colors to all cells 2017-11-21 12:16:23 -06:00
Jared Scheib 9b89e42777 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 f38b80a30d Merge branch 'master' into multitenancy 2017-11-14 00:05:18 -08:00
Michael Desa 489127cecb Add organizations to newDashboardResponse tests 2017-11-13 23:37:50 -08:00
Jared Scheib 05c76d3c52 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 65bc529831 Fix tests broken in 96a362cb
Signed-off-by: Jared Scheib <jared.scheib@gmail.com>
2017-11-13 23:10:26 -08:00
Michael Desa fdc6dc4aa3 Fix wording suggested in PR 2017-11-13 20:49:07 -08:00
Michael Desa 011b0bfb73 Add option to specify users are create as super admin 2017-11-13 20:44:50 -08:00
Michael Desa 5b64cb4dc3 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 b3d0d6eeee Address PR feedback. 2017-11-13 18:08:50 -08:00
Luke Morris b543e64ef1 Make Public values explicit 2017-11-13 12:15:53 -08:00
Luke Morris b731481fdc Sew up failing tests 2017-11-13 11:47:34 -08:00
Luke Morris 65ae474a5c Clear test noise 2017-11-10 18:45:25 -08:00
Luke Morris 43338cbdcb Reuse chronograf.Organization type 2017-11-10 18:31:30 -08:00
Luke Morris 31277c432c Rename whitelistOnly => public 2017-11-10 18:23:41 -08:00
Luke Morris 5ff6bfb32e Persist whitelistOnly changes to default organization 2017-11-10 16:43:11 -08:00
Andrew Watkins c6fd7058ba Add test for queryConfig validation 2017-11-10 16:02:35 -08:00
Andrew Watkins c3a4696174 Add processing of incoming queryConfig 2017-11-10 16:02:08 -08:00
Michael Desa d53fcea236 Change MeOrganization to UpdateMe 2017-11-10 16:17:46 -05:00
Michael Desa 173d1f2d71 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 dc1ee40bc6 Add WhitelistOnly to organizations
Fix adding default role to organization
2017-11-10 15:57:48 -05:00
Michael Desa 89ca72952c Use raw organizations store is user is super admin 2017-11-10 15:33:28 -05:00
Michael Desa fe6f3bd673 Fix updating default role on organization 2017-11-10 14:55:21 -05:00
Andrew Watkins 6093ddc52f WIP Add shifts to queryConifg on backend 2017-11-10 11:06:48 -08: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 8e9673380f Fix ValidSourceRequestComment 2017-11-10 12:20:58 -05:00
Michael Desa d9a29cab89 Fix ValidSourceRequest to modify pointer when needed
Add tests for Store.SourcesAll
2017-11-10 12:15:04 -05:00
Michael Desa 7123eea6dc Change UserKey to UserContextKey 2017-11-10 11:28:19 -05:00
Michael Desa fbff6cea76 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 1832ecb4f7 Change UserKey to UserContextKey
Fix name of arguments in tests
2017-11-10 11:18:06 -05:00
Michael Desa 39910a08af Sort users organizations on me response by org ID 2017-11-10 11:09:16 -05:00
Michael Desa e83bfe87e5 Prevent user from deleteing themselves 2017-11-10 11:09:16 -05:00
Michael Desa 71851d142f Put entire user on context 2017-11-10 11:09:16 -05:00
Michael Desa 4e46b4b2c7 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 349dd12f20 Refactor and simplify auto group by (:interval:) template variable 2017-11-09 10:02:24 -08:00
Chris Goller eb82ec4131 Refactor and simplify auto group by (:interval:) template variable 2017-11-08 11:27:35 -06:00
Jared Scheib 355649b885
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 5062773e4e 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 85329d0bc6 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 4df7e38779 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 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 cbbf9d96d7 Add comments suggested from PR review
Add tests to server/stores_test.go
2017-11-07 13:59:40 -05:00
Jared Scheib b7533c0030 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 9a548983d0 Fix role related tests after rebase 2017-11-06 11:31:44 -05:00
Michael Desa 859d94ab15 Move user roles and role names to roles package 2017-11-06 11:27:13 -05:00
Michael Desa 14459c7f7b Allow update of sources.Role in server.UpdateSource 2017-11-06 11:25:51 -05:00
Michael Desa 5e1ad82660 Add role ctx where appropriate in AuthorizedUser 2017-11-06 11:25:46 -05:00
Michael Desa f71e6a4b55 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 833e98ce73 Pull out setting super admin into a single func 2017-11-06 11:15:49 -05:00
Michael Desa 9af3089914 Allow SuperAdmins to promoted and demoted 2017-11-06 11:15:48 -05:00
Michael Desa c7e49001d4 Add default org check even when no auth is used 2017-11-06 10:17:17 -05:00
Michael Desa 66c779c193 Remove DefaultOrganization Name in tests mock store 2017-11-06 10:17:17 -05:00
Michael Desa 3370774e8f 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 3ddd253d68 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 45f1410fd6 Add default role to chronograf.Organization 2017-11-06 09:46:00 -05:00
Chris Goller 693f26b0c3 Update queries endpoint comment 2017-11-04 20:19:08 -05:00
Michael Desa 271aebb40f Prevent duplicate organization roles in user CRUD 2017-11-03 12:06:18 -04:00
Michael Desa 81e0bf06dc Fix me tests with proper IDs 2017-11-03 09:47:54 -04:00
Michael Desa e114f20328 Fix links in me request 2017-11-03 09:39:21 -04:00
Michael Desa 6539e5ebeb Properly pass organization context to handlers 2017-11-03 09:13:03 -04:00
Michael Desa 6f72d72fca Fix over-stringification of organization on roles 2017-11-02 21:52:30 -04:00
Jared Scheib fe6e0682ca Add SuperAdmin to userResponse 2017-11-02 16:24:16 -07:00
Chris Goller 663d418161 Fix rendering of templated queries to the /queries endpoint 2017-11-02 17:57:02 -05:00
Michael Desa da1fa2141b Add CurrentOrganization & Organizations to me resp
Remove CurrentOrganization from chronograf.User
2017-11-02 11:59:53 -04:00
Michael Desa c161dd3cc1 Fix relevant go-vet/go-lint for server package 2017-11-01 16:43:31 -04:00
Michael Desa 2aadaf3ff6 Add exhaustive test for AuthorizedUser 2017-11-01 16:38:17 -04:00
Michael Desa 929f67c882 Add comments to DataStore interface and implemntn 2017-11-01 14:24:40 -04:00
Michael Desa fd66c8a227 Fix routes tests 2017-11-01 14:09:58 -04:00
Jared Scheib cd719805ed 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 3f55da7503 Change nil check to len == 0 check for userRequest 2017-11-01 12:38:26 -04:00
Michael Desa 4ecf215d19 Remove unused code 2017-11-01 12:35:09 -04:00
Michael Desa dc63e8af8f Add parseOrganizationID method 2017-11-01 12:34:00 -04:00
Michael Desa 6fbfde5060 Add comments throughout codebase 2017-11-01 12:30:42 -04:00
Michael Desa 7af7d65802 Change function signature of hasSuperAdminContext 2017-11-01 10:39:09 -04:00
Michael Desa 24c99a761b Change OrganizationID to Organization in Me req 2017-11-01 10:37:32 -04:00
Michael Desa 3eaca382d3 User explicit type when setting context 2017-11-01 09:49:02 -04:00
Michael Desa 72422803c4 Add superAdmin to users CRUD 2017-11-01 09:12:19 -04:00
Michael Desa a9d5bf9c05 WIP cleanup 2017-10-31 20:58:40 -04:00
Michael Desa d1488a973b WIP make app usable by frontend 2017-10-31 19:50:03 -04:00
Michael Desa 391bd189c1 Add support for super admin 2017-10-31 18:27:24 -04:00
Michael Desa e111038816 Add noop implementation of each source type 2017-10-31 18:07:42 -04:00
Michael Desa d7b981987c Remove RawUsers from DataStore 2017-10-31 17:49:35 -04:00
Michael Desa 978da16ecd Add org param to New Organizaiton methods 2017-10-31 17:40:58 -04:00
Michael Desa 5f63e2738a Refactor data stores into a common interface 2017-10-31 16:41:17 -04:00
Michael Desa 6e0bfa67df Move organization resouces to their own package 2017-10-30 14:31:19 -04:00
Michael Desa 0a5da8a750 Use organization stores 2017-10-30 12:05:59 -04:00
Jared Scheib 1a06fefa04 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 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
Jared Scheib e0a535e78a 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 511c3e1957 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 a956bacc41 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 093adb97c9 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 5c53fbbcc4 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 7ffbf5dd98 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 832589f9b9 Fix logger and redirector to be flushers allowing HTTP chunking 2017-10-26 17:38:20 -05:00
Chris Goller 9e1fe7bf29 Fix kapacitor proxy to accept url query parameters 2017-10-26 17:38:03 -05:00
Chris Goller 2e869f5536 Add flush interval to kapacitor proxy to fix buffering 2017-10-26 17:37:28 -05:00
Jared Scheib 5bed2cfc4f 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 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
Nathan Haugo a1ea2c058e 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 68e08b979f 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 fb19c4d291 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 a6d565fd7c Add Organizations to Dashboards 2017-10-25 14:00:06 -04:00
Michael Desa eca0be45e2 Add Organization to layouts 2017-10-25 12:52:56 -04:00
Michael Desa 7b21a6b970 Add Organization to Sources 2017-10-25 11:51:15 -04:00
Jared Scheib c15a41025d Merge branch 'multitenancy' into multitenancy_lowercase_fields 2017-10-24 18:01:32 -07:00
Jared Scheib 7fce5fe0fc Merge branch 'master' into multitenancy 2017-10-24 17:58:15 -07:00
Jared Scheib 2f6643ae3c Add scheme to me/AuthorizedUser tests 2017-10-24 16:21:24 -07:00
Jared Scheib 9a6ab1bf9d 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 30b8d3cdca Make all Store names plural for consistency 2017-10-24 15:54:24 -07:00
Michael de Sa d45335f281 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 dad08a7389 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 1ce78dd21b Update changelog and version number for 1.3.10.0 2017-10-24 09:34:31 -04:00
Michael Desa d220fc3e5e Add tests for server/organizations.go 2017-10-23 14:16:52 -04:00
Michael Desa 61bda98403 Fix typo in organization comment 2017-10-23 14:16:31 -04:00
Michael Desa f1ad32a367 Add missing returns in http hanlder methods 2017-10-20 15:42:51 -04:00
Michael Desa 0842e8c479 Add CRUD routes for organizations 2017-10-20 15:42:34 -04:00
Chris Goller 4b12179b02 Add insecure ssl support to connect to kapacitor 2017-10-19 22:48:31 -05:00
Michael de Sa 4454d8c7b8 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 c261ffadde Update route authorization by Role
Signed-off-by: Jared Scheib <jared.scheib@gmail.com>
2017-10-19 14:33:08 -05:00
Jared Scheib c994e8c5ac 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 c1b56f241d Fix formating of server/auth.go 2017-10-19 12:54:06 -04: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 4687ecf794 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 0d235f646d 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 e0f4ac74d1 Add comment to AuthorizedUser 2017-10-18 12:45:58 -04:00
Michael Desa fb6d91df9f Wrap routes with Authorization middleware 2017-10-18 12:40:17 -04:00
Michael Desa 28fac10baa Add AuthorizedUser middleware 2017-10-18 12:35:40 -04:00
Michael Desa f0f5bc071b Extract logic for getting user by name & provider 2017-10-18 12:34:23 -04:00
Michael de Sa b86164e710 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 d27be61b8b 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 b85ba866ab 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 5d4ac3c167 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 7a45bba4f7 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 8e298437c5 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 2f1e128c61 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 d2f5706acb 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 351f762ed2 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 2281adb33d 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 84be5f7128 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 fd8e3b3398 Update swagger documentation about queryConfig 2017-10-16 11:51:51 -05:00
Chris Goller 14e49c0ef9 Rename queryConfig field to Value and support top/bottom 2017-10-16 10:56:12 -05:00
Jared Scheib 25faaa02df Add Roles to Users CRUD
Signed-off-by: Michael de Sa <mjdesa@gmail.com>
2017-10-12 17:42:30 -07: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 Desa 6b9c1ed127 Add jsonEqual to test helpers file 2017-10-11 14:33:55 -04:00
Michael de Sa 04a9af37f3 Refactor setting writer Location header
Signed-off-by: Jared Scheib <jared.scheib@gmail.com>
2017-10-11 10:14:57 -07:00
Chris Goller 7f3986f982 Refactor query config field arguments to be fields 2017-10-10 18:04:45 -05:00
Jared Scheib 40fac47b28 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 5f4ce64a11 Refactor queryConfig to have field aliases and function arguments 2017-10-10 17:01:50 -05:00
Jared Scheib e2ce0cda0d 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 5a9772822e 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 64381c28ba 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 04f4c4b917 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 a122d5537c 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 1b250ebfa9 Make name on userResponse required
Signed-off-by: Michael de Sa <mjdesa@gmail.com>
2017-10-10 14:15:31 -07:00
Jared Scheib 35d6f0b8c3 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 a1782cae64 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 9f5f01bb3f 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 d62f144e14 Use new-school sort.Slice
Signed-off-by: Jared Scheib <jared.scheib@gmail.com>
2017-10-10 11:30:57 -07:00
Jared Scheib 004b0e20ef 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 990c4eee4d 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 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
Nathan Haugo f23351c9ba Update version 2017-10-06 11:38:40 -07:00
Chris Goller 486a5bfb33 Update dashboard cells to have optional data source URI. 2017-10-02 12:50:42 -07:00
Andrew Watkins b66be556ed Update kapacitor links to include tasks and ping paths 2017-09-12 09:23:22 -07:00
Chris Goller a28d3d6466 Update kapacitor AlertRule to containe most Kapacitor Task information 2017-09-09 10:19:52 -05:00
Chris Goller 2128c13163 Update kapacitor rule response with dbrps, various dates, error, and executing. 2017-09-09 10:19:52 -05:00
Chris Goller b29a99a2c7 Update swagger docs with new kapacitor rule fields 2017-09-09 10:19:52 -05:00
Chris Goller 0c2e7f385b WIP 2017-09-09 10:19:52 -05:00
Nathan Haugo e89e8d137b Bump version to 1.3.8.0 2017-09-07 16:29:56 -07:00
Tim Raymond d559acc0e0
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 e421bf83d4
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 3b51cb8339
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 8eb1e1b1a3 Merge 1.3.7.x 2017-08-23 16:01:30 -07:00
Nathan Haugo 16735c027f Bump to 1.3.7.0 2017-08-23 15:56:00 -07:00
Tim Raymond 2c4d02912d Merge branch 'master' into feature/tr-kapa-rule-pagination 2017-08-23 16:44:59 -04:00
Tim Raymond da55f96f9d
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 50a05c7f6e 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 886046ed9a
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 d0be50ab37
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 39f40671a9 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 45e7bd8662
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