Commit Graph

48 Commits (0e6f14931bb923ec6cc7286f031a411a371ac110)

Author SHA1 Message Date
Michael Desa 096ef058eb Allow user to delete themselves
Previously users were prevented from removing themselves.

Connect https://github.com/influxdata/chronograf/issues/2711
2018-02-07 09:46:08 -05:00
Michael Desa 4afb444579 Allow UpdateUser to accept empty roles 2018-01-12 12:37:30 -05:00
Michael Desa d74d8f35f9 Add wildcard role and validate users roles in CRUD
The server may now specify a '*' to indicate that the server should
retrieve the organizations default role and assign it to the user.
2018-01-12 12:27:55 -05:00
Michael Desa 14af1aa115 Prevent SuperAdmin from modifying their own status
Previously it was possible for SuperAdmins to remove their own status.
This could create an application state where there were no super admins.
This is not an acceptable application state.
2017-12-20 15:17:08 -08:00
Michael Desa d8d20547ab Change Organization ID to string from uint64 2017-12-19 10:13:43 -08:00
Jared Scheib 933291918b Reference known issue #2601 in Admin creating SuperAdmin response
Signed-off-by: Michael de Sa <mjdesa@gmail.com>
2017-12-15 15:05:27 -08:00
Michael Desa da605ac138 Set SuperAdmin for NewUsers based on ConfigSetting 2017-12-14 11:11:51 -08:00
Michael Desa 15a1c45cf1 Allow admins to update a superadmins roles 2017-12-04 16:53:30 -05: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 1832ecb4f7 Change UserKey to UserContextKey
Fix name of arguments in tests
2017-11-10 11:18:06 -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
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 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 9af3089914 Allow SuperAdmins to promoted and demoted 2017-11-06 11:15:48 -05:00
Michael Desa 271aebb40f Prevent duplicate organization roles in user CRUD 2017-11-03 12:06:18 -04:00
Michael Desa 72422803c4 Add superAdmin to users CRUD 2017-11-01 09:12:19 -04:00
Michael Desa 5f63e2738a Refactor data stores into a common interface 2017-10-31 16:41:17 -04: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
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
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
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
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 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
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
Michael Desa 6b9c1ed127 Add jsonEqual to test helpers file 2017-10-11 14:33:55 -04: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 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
Chris Goller 44aa0526ed Update user/role responses to return empty arrays 2017-03-10 13:24:48 -06:00
Chris Goller 46b1a08aa5 Merge branch 'master' into feature/#54-tr-enterprise-client
Conflicts:
	Makefile
	chronograf.go
	server/routes.go
	server/users.go
2017-02-23 23:26:09 -06:00
Chris Goller 5aa6a4ef2b Add roles to chronograf 2017-02-23 16:02:53 -06:00
Chris Goller 1fcdee485f Add tests for /me endpoint 2017-02-21 21:36:23 -06:00