Commit Graph

5350 Commits (2a7f85358067371057d95bd3be05e86a5ffff97c)

Author SHA1 Message Date
Michael Desa 2a7f853580 REMOVE ME
This commit should be removed and was added so that it when I run make
gen for adding other values it won't polute the other commits
2017-10-25 11:49:56 -04:00
Jared Scheib 3b2818688a Make all Store names plural for consistency 2017-10-24 15:54:24 -07:00
Jared Scheib 54dff5cc4d Clean up plurals in func comments
Signed-off-by: Michael de Sa <mjdesa@gmail.com>
2017-10-24 15:09:37 -07:00
Michael de Sa 04dae2629a Test validOrganizationRoles comprehensively
Signed-off-by: Jared Scheib <jared.scheib@gmail.com>
2017-10-24 15:08:01 -07:00
Michael de Sa edf66aab81 Add comments to validOrganization
Signed-off-by: Jared Scheib <jared.scheib@gmail.com>
2017-10-24 15:07:35 -07:00
Jared Scheib 4691234719 Ensure additional Users aren't created OrganizationUser.Add
Performs a Get against the global UsersStore, and if the User
already exists, it appends to that User instead of trying to add
the "new" User blindly.

Signed-off-by: Michael de Sa <mjdesa@gmail.com>
2017-10-24 14:53:50 -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
Jared Scheib 66eb1f824e Rename userHasValidRoles to validOrganizationRoles for clarity
Signed-off-by: Michael de Sa <mjdesa@gmail.com>
2017-10-24 14:04:48 -07:00
Jared Scheib fac9d03b09 Clarify Update methodology comment
Signed-off-by: Michael de Sa <mjdesa@gmail.com>
2017-10-24 14:04:05 -07:00
Michael de Sa 5fc62210b7 Test for error on Add Org User without context Org
Refactor guards in OrganizationUser bolt methods into comon func

Signed-off-by: Jared Scheib <jared.scheib@gmail.com>
2017-10-24 13:53:30 -07:00
Jared Scheib dbc08392e2 Improve test reporting for which user was deleted
Signed-off-by: Michael de Sa <mjdesa@gmail.com>
2017-10-24 13:45:09 -07:00
Michael de Sa e1bdf22eba Clean up derletion test name
Signed-off-by: Jared Scheib <jared.scheib@gmail.com>
2017-10-24 13:43:25 -07:00
Michael de Sa 4d72ba6e4d Make vars consistent
Signed-off-by: Jared Scheib <jared.scheib@gmail.com>
2017-10-24 13:41:47 -07:00
Jared Scheib 18054c6645 Improve get no users test
Change rawWant to wantRaw
Remove fmt.Println

Signed-off-by: Michael de Sa <mjdesa@gmail.com>
2017-10-24 13:33:17 -07:00
Michael Desa 0aa28d7066 Add OrganizationUsersStore
bolt/organization_users_store contains a boltdb implementation of a
chronograf.UsersStore that filters the results based on the organization
that is set on the context.

Signed-off-by: Jared Scheib <jared.scheib@gmail.com>
2017-10-24 13:29:46 -04:00
Michael de Sa f873736c7c Remove printing from Organization tests
Signed-off-by: Jared Scheib <jared.scheib@gmail.com>
2017-10-23 12:08:49 -07:00
Jared Scheib 292bf00320 Rename Org field on stores to Organization
Signed-off-by: Michael de Sa <mjdesa@gmail.com>
2017-10-23 12:08:11 -07: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
Michael de Sa faac66a9bd Nest resources under Organizations
For each organization, we create a set of buckets for each associated
resource (sources, servers, layouts, and dashbaords).

The bucket name is the path join of the resource bucket name and the
oranizations name. If the organizations name is empty, then the bucket
name is the resource bucket name (this is backwards compatible with how
resources are currently stored).

Signed-off-by: Jared Scheib <jared.scheib@gmail.com>
2017-10-20 13:50:19 -04:00
Michael Desa de6ae41c60 Implement basic bolt OrganizationsStore 2017-10-20 11:13:13 -04:00
Jared Scheib 41386ca546 Add bolt implementation of OrganizationsStore
Signed-off-by: Michael de Sa <mjdesa@gmail.com>
2017-10-20 09:17:00 -05:00
Michael de Sa 30096623f9 Define Organization and OrganizationsStore
Signed-off-by: Jared Scheib <jared.scheib@gmail.com>
2017-10-20 10:10:38 -04:00
Jared Scheib 67ed6c05da Merge pull request #2132 from influxdata/multitenancy_authorize_role
Role based authorization
2017-10-19 14:55:01 -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
Jared Scheib 5998923ab8 Add test coverage for Get with empty User
Signed-off-by: Michael de Sa <mjdesa@gmail.com>
2017-10-19 14:39:06 -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 72640d3bd2 Add tests for retrieving user by name and provider
Fix incorrect error message

Cleanup old Get user test
2017-10-19 12:52:46 -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 725344bc04 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 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 1247323176 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 97d9afa78a 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 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