Commit Graph

5314 Commits (e0f4ac74d10c25c49292a5796e74f77bac299c76)

Author SHA1 Message Date
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 48fc9ac404 Merge pull request #2114 from influxdata/multitenancy_set_role
MULTITENANCY: Set the role of a user
2017-10-16 19:50:15 -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 00004a33da Use cmp.Diff for user equality comparison
Signed-off-by: Jared Scheib <jared.scheib@gmail.com>
2017-10-16 16:46:20 -05:00
Jared Scheib 3cdc6df215 Vendor github.com/google/go-cmp/cmp/cmpopts
Signed-off-by: Michael de Sa <mjdesa@gmail.com>
2017-10-16 16:35:40 -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
Jared Scheib 1b6f8e8ad9 Add comments for role types
Signed-off-by: Michael de Sa <mjdesa@gmail.com>
2017-10-16 15:33:29 -05:00
Michael de Sa 8fe197b02f Clean up redundant error checks
Signed-off-by: Jared Scheib <jared.scheib@gmail.com>
2017-10-16 14:33:47 -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
Michael de Sa af0b8419b7 Remove explicit chronograf user permisions
Signed-off-by: Jared Scheib <jared.scheib@gmail.com>
2017-10-16 14:19:42 -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 de Sa 255541ee0a Add name to bolt UsersStore test
Signed-off-by: Jared Scheib <jared.scheib@gmail.com>
2017-10-12 20:01:35 -04:00
Michael de Sa 71ca669283 Make chronograf user roles explicit vars
Signed-off-by: Jared Scheib <jared.scheib@gmail.com>
2017-10-12 19:58:45 -04:00
Michael de Sa 250eb9b730 Factor out code in common bolt UsersStore tests
Signed-off-by: Jared Scheib <jared.scheib@gmail.com>
2017-10-12 19:52:34 -04:00
Michael de Sa e25ac2045c Use numberic style ID in UsersStore Get test
Signed-off-by: Jared Scheib <jared.scheib@gmail.com>
2017-10-12 19:37:51 -04:00
Jared Scheib 7b8e424f03 Regenerate protoc to remove formatting changes
Signed-off-by: Michael de Sa <mjdesa@gmail.com>
2017-10-12 19:33:46 -04:00
Jared Scheib ac9984c799 Remove unused concept of RolesStore
Signed-off-by: Michael de Sa <mjdesa@gmail.com>
2017-10-12 19:33:31 -04:00
Michael de Sa 924c890862 Refactor bolt UsersStore to use ID instead of name
Signed-off-by: Jared Scheib <jared.scheib@gmail.com>
2017-10-12 19:33:16 -04:00
Michael de Sa f1a496b449 Add tests for updating user in boltdb
Adds tests for updating roles, provider, and scheme

Signed-off-by: Michael de Sa <mjdesa@gmail.com>
2017-10-12 19:32:54 -04:00
Michael de Sa 4761f4454c Set ID on retrieved user from boltdb
Signed-off-by: Jared Scheib <jared.scheib@gmail.com>
2017-10-12 19:32:35 -04:00
Michael de Sa 7f4af358ae Add roles to boltdb UsersStore
Signed-off-by: Jared Scheib <jared.scheib@gmail.com>
2017-10-12 19:31:44 -04:00
Jared Scheib 5947427e3f Update bolt UsersStore for updated chronograf User
Signed-off-by: Michael de Sa <mjdesa@gmail.com>
Signed-off-by: Jared Scheib <jared.scheib@gmail.com>
2017-10-12 19:31:26 -04:00
Michael Desa 334a3c5d34 Refactor bolt.RolesStore to use bolt.UsersStore
Add definitions for user roles and permissions in chronograf package

Signed-off-by: Jared Scheib <jared.scheib@gmail.com>
Signed-off-by: Michael de Sa <mjdesa@gmail.com>
2017-10-12 19:31:15 -04:00
Michael de Sa c4eedd8c47 Remove old bolt implementation of RoleStore
Signed-off-by: Jared Scheib <jared.scheib@gmail.com>
2017-10-12 19:31:06 -04:00
Jared Scheib 385a534ae2 Refactor Roles & Protobuf to be part of User msg
Signed-off-by: Michael de Sa <mjdesa@gmail.com>
2017-10-12 19:30:50 -04:00
Michael Desa b7e7aa9c5d WIP: Add BoltDB implementation of RolesStore
Signed-off-by: Jared Scheib <jared.scheib@gmail.com>
2017-10-12 19:30:34 -04:00
Jared Scheib e1bd08838f Add Role and Permission messages to protobuf
Signed-off-by: Michael de Sa <mjdesa@gmail.com>
2017-10-12 19:30:09 -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
Jared Scheib 5da90aedbc Merge pull request #2099 from influxdata/multitenancy_users_crud
MULTITENANCY: Add CRUDA operations for Chronograf Users
2017-10-11 11:54:13 -07: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
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
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