Commit Graph

60 Commits

Author SHA1 Message Date
Kyle Carberry b0fe9bcdd1
chore: Upgrade to Go 1.19 (#3617)
This is required as part of #3505.
2022-08-21 22:32:53 +00:00
Steven Masley 01dd35f1ba
chore: Rename 'admin' to 'owner' (#3498)
Co-authored-by: Colin Adler <colin1adler@gmail.com>
2022-08-15 14:40:19 -05:00
Kyle Carberry 3b951f77fb
fix: Unskip SuspendAnotherUser test (#3430)
It wasn't clear why this was skipped, it seems accidental.
2022-08-12 19:12:44 +00:00
Steven Masley 3ae42f4de9
chore: Update rego to be partial execution friendly (#3449)
- Improves performance of batch authorization calls
- Enables possibility to convert rego auth calls into SQL WHERE clauses
2022-08-11 22:07:48 +00:00
Steven Masley db665e7261
chore: Drop resource_id support in rbac system (#3426) 2022-08-09 18:16:53 +00:00
Mathias Fredriksson ccf6f4e7ed
chore: Use contexts with timeout in `coderd` tests (#3381) 2022-08-09 20:17:00 +03:00
Jon Ayers 7e9819f2a8
ref: move httpapi.Reponse into codersdk (#2954) 2022-07-12 19:15:02 -05:00
Jon Ayers 2353687610
feat: unexpose coderdtest.NewWithAPI (#2613)
* feat: unexpose coderdtest.NewWithAPI
2022-06-27 13:50:52 -05:00
Abhineet Jain 90815e5119
feat: improve Users filter API (#2645) 2022-06-24 23:55:28 +00:00
Steven Masley d21ab2115d
feat: Backend api for filtering users using filter query string (#2553)
* User search query string
2022-06-24 10:02:23 -05:00
Kyle Carberry b7eeb436ad
feat: Add `ip_address` to API keys (#2580)
Fixes #2561.
2022-06-22 17:32:21 +00:00
Garrett Delfosse 92bda0d2c1
fix: allow admins to reset their own pass without old_password (#2222) 2022-06-10 11:43:54 +10:00
Steven Masley c9a4642a12
chore: Update BE http errors to be ui friendly (#1994)
* chore: More UI friendly errors

Mainly capitlization + messages prefix error
2022-06-03 21:48:09 +00:00
Steven Masley b9983e417f
feat: Handle pagination cases where after_id does not exist (#1947)
* feat: Handle pagination cases where after_id does not exist

Throw an error to the user in these cases
- Templateversions
- Workspacebuilds

User pagination does not need it as suspended users still
have rows in the database
2022-06-02 09:01:45 -05:00
Steven Masley 913c0f5e7f
feat: Longer lived api keys for cli (#1935)
* feat: Longer lived api keys for cli
* feat: Refresh tokens based on their lifetime set in the db
* test: Add unit test for refreshing
2022-06-01 14:58:55 -05:00
Steven Masley cc87a0cf6b
feat: Implied 'member' roles for site and organization (#1917)
* feat: Member roles are implied and never exlpicitly added
* Rename "GetAllUserRoles" to "GetAuthorizationRoles"
* feat: Add migration to remove implied roles
* rename user auth role middleware
2022-06-01 09:07:50 -05:00
Steven Masley 7acb742218
feat: Prevent role changing on yourself. (#1931)
* feat: Prevent role changing on yourself.

Only allow changing roles on other users. Not much value in self changing
at the moment
2022-05-31 15:50:38 -05:00
Steven Masley 26a2a169df
fix: Suspended users cannot authenticate (#1849)
* fix: Suspended users cannot authenticate

- Merge roles and apikey extract httpmw
- Add member account to make dev
- feat: UI Shows suspended error logging into suspended account
- change 'active' route to 'activate'
2022-05-31 08:06:42 -05:00
Garrett Delfosse 5598ac05dc
fix: prevent email from being altered (#1863) 2022-05-27 22:25:04 +00:00
Abhineet Jain d623eeb8d1
feat: delete API token in /logout API (#1770)
* delete API token in logout api

* add deleteapikeybyid to databasefake

* set blank cookie on logout always

* refactor logout flow, add unit tests

* update logout messsage

* use read-only file mode for windows

* fix file mode on windows for cleanup

* change file permissions on windows

* assert error is not nil

* refactor cli

* try different file mode on windows

* try different file mode on windows

* try keeping the files open on Windows

* fix the error message on Windows
2022-05-27 16:47:03 -04:00
Garrett Delfosse 24d1a6744a
fix: Add route for user to change own password (#1812) 2022-05-27 17:29:55 +00:00
Steven Masley ec1fe46138
feat: Move create organizations route (#1831)
* feat: last rbac routes
- move create organization to /organizations.
2022-05-27 11:19:13 -05:00
Steven Masley eea8dc6c16
feat: Add rbac to templateversion+orgmember endpoints (#1713) 2022-05-25 11:00:59 -05:00
Spike Curtis 1871b09697
feat: in-process provisionerd connection (#1568)
* in-process provisionerd connection

Signed-off-by: Spike Curtis <spike@coder.com>

* disable lint for server.go/newProvisionerDaemon

Signed-off-by: Spike Curtis <spike@coder.com>
2022-05-19 17:47:45 -05:00
Steven Masley c034e8389e
feat: Add RBAC to /workspace endpoints (#1566)
* feat: Add RBAC to /workspace endpoints
2022-05-18 18:15:19 -05:00
Garrett Delfosse 0706c60445
chore: Add watch workspace endpoint (#1493) 2022-05-18 16:16:26 -05:00
Steven Masley a3556b12da
feat: Single query for all workspaces with optional filter (#1537)
* feat: Add single query for all workspaces using a filter
2022-05-18 10:09:07 -05:00
Steven Masley 4ad5ac2d4a
feat: Rbac more coderd endpoints, unit test to confirm (#1437)
* feat: Enforce authorize call on all endpoints
- Make 'request()' exported for running custom requests
* Rbac users endpoints
* 401 -> 403
2022-05-17 13:43:19 -05:00
Steven Masley b55d83ca82
feat: Add suspend/active user to cli (#1422)
* feat: Add suspend/active user to cli
* UserID is now a string and allows for username too
2022-05-16 15:29:27 -05:00
Colin Adler 680de709a5
chore: organize http handlers (#1486)
They're currently randomly in a bunch of different files. This cleans up
the handler functions to be in the file of the type they return.
2022-05-16 14:36:27 -05:00
Mathias Fredriksson 2d3dc436a8
feat: Implement unified pagination and add template versions support (#1308)
* feat: Implement pagination for template versions

* feat: Use unified pagination between users and template versions

* Sync codepaths between users and template versions

* Create requestOption type in codersdk and add test

* Fix created_at edge case for pagination cursor in queries

* feat: Add support for json omitempty and embedded structs in apitypings (#1318)

* Add scripts/apitypings/main.go to Makefile
2022-05-10 07:44:09 +00:00
Kyle Carberry b675aec4dd
feat: Add endpoint to get all workspaces a user can access (#1354)
This iterates through user organizations to get permitted
workspaces. This will allow admins to manage user workspaces!
2022-05-10 02:38:20 +00:00
Bruno Quaresma 57bb108465
feat: Add update user password endpoint (#1310) 2022-05-06 09:20:08 -05:00
Steven Masley 69e26c4036
feat: Allow using username in user queries (#1221)
* feat: Allow using username in user queries
* Test needs a username/email to not match empty string
2022-04-29 11:44:22 -05:00
Steven Masley 35211e2190
feat: Add user roles, but do not yet enforce them (#1200)
* chore: Rework roles to be expandable by name alone
2022-04-29 09:04:19 -05:00
Bruno Quaresma ba4c3ce3b9
feat: add filter by status on GET /users (#1206) 2022-04-29 08:29:53 -05:00
Bruno Quaresma 816441eff7
feat: add organization_ids in the user(s) response (#1184) 2022-04-28 09:10:17 -05:00
Bruno Quaresma 441ffd6a0b
feat: add PUT /api/v2/users/:user-id/suspend endpoint (#1154) 2022-04-26 09:00:07 -05:00
Kyle Carberry 88669fd578
feat: Move workspaces under organizations (#1109)
This removes split ownership for workspaces. They are now
a resource of organizations and have a designated owner,
which is a user.

This enables simple administration for commands like:
- `coder stop ben/dev`
- `coder build logs colin/arch`

or if we decide to allow administrators to access workspaces,
they could even SSH using this syntax: `coder ssh colin/dev`.
2022-04-25 16:11:03 -05:00
Steven Masley 8b54ea8562
test: Fix user pagination sort order (#1143)
Sort by uuid in expected output to cover when times are equal
for 2 users. The database (fake & pg) use id as as second ordering
to cover this edge case. Should realistically never happen in
production.
2022-04-25 10:27:08 -05:00
Kyle Carberry be974cf280
feat: Add users create and list commands (#1111)
This allows for *extremely basic* user management.
2022-04-24 20:08:26 -05:00
Kyle Carberry 7496c3da81
feat: Add GitHub OAuth (#1050)
* Initial oauth

* Add Github authentication

* Add AuthMethods endpoint

* Add frontend

* Rename basic authentication to password

* Add flags for configuring GitHub auth

* Remove name from API keys

* Fix authmethods in test

* Add stories and display auth methods error
2022-04-23 22:58:57 +00:00
Steven Masley 548de7d6f3
feat: User pagination using offsets (#1062)
Offset pagination and cursor pagination supported
2022-04-22 15:27:55 -05:00
Bruno Quaresma 1df750bf1a
feat: add GET /api/v2/users (#1028) 2022-04-18 17:19:47 +00:00
Bruno Quaresma 63d1465019
feat: Add update profile endpoint (#916) 2022-04-12 14:05:21 +00:00
Kyle Carberry 02ad3f14f5
chore: Rename Projects to Templates (#880)
Customer feedback indicated projects was a confusing name.
After querying the team internally, it seemed unanimous
that it is indeed a confusing name.

Here's for a lil less confusion @ashmeer7 🥂
2022-04-06 12:42:40 -05:00
Colin Adler 2b1a0ee126
chore: update v1 schema (#643) 2022-04-01 14:42:36 -05:00
Steven Masley 591523a078
chore: Move httpapi, httpmw, & database into `coderd` (#568)
* chore: Move httpmw to /coderd directory
httpmw is specific to coderd and should be scoped under coderd

* chore: Move httpapi to /coderd directory
httpapi is specific to coderd and should be scoped under coderd

* chore: Move database  to /coderd directory
database is specific to coderd and should be scoped under coderd

* chore: Update codecov & gitattributes for generated files
* chore: Update Makefile
2022-03-25 16:07:45 -05:00
Kyle Carberry c451f4e685
feat: Add templates to create working release (#422)
* Add templates

* Move API structs to codersdk

* Back to green tests!

* It all works, but now with tea! 🧋

* It works!

* Add cancellation to provisionerd

* Tests pass!

* Add deletion of workspaces and projects

* Fix agent lock

* Add clog

* Fix linting errors

* Remove unused CLI tests

* Rename daemon to start

* Fix leaking command

* Fix promptui test

* Update agent connection frequency

* Skip login tests on Windows

* Increase tunnel connect timeout

* Fix templater

* Lower test requirements

* Fix embed

* Disable promptui tests for Windows

* Fix write newline

* Fix PTY write newline

* Fix CloseReader

* Fix compilation on Windows

* Fix linting error

* Remove bubbletea

* Cleanup readwriter

* Use embedded templates instead of serving over API

* Move templates to examples

* Improve workspace create flow

* Fix Windows build

* Fix tests

* Fix linting errors

* Fix untar with extracting max size

* Fix newline char
2022-03-22 13:17:50 -06:00
Kyle Carberry bf0ae8f573
feat: Refactor API routes to use UUIDs instead of friendly names (#401)
* Add client for agent

* Cleanup code

* Fix linting error

* Rename routes to be simpler

* Rename workspace history to workspace build

* Refactor HTTP middlewares to use UUIDs

* Cleanup routes

* Compiles!

* Fix files and organizations

* Fix querying

* Fix agent lock

* Cleanup database abstraction

* Add parameters

* Fix linting errors

* Fix log race

* Lock on close wait

* Fix log cleanup

* Fix e2e tests

* Fix upstream version of opencensus-go

* Update coderdtest.go

* Fix coverpkg

* Fix codecov ignore
2022-03-07 11:40:54 -06:00