Commit Graph

2385 Commits

Author SHA1 Message Date
f23a05075e feat: support optional SMTP auth (#14533) 2024-09-03 11:51:34 +02:00
0eca1fcb8b fix: fix TestPendingUpdatesMetric flaky assertion (#14534) 2024-09-03 13:47:34 +04:00
0f8251be41 feat(coderd/database/dbpurge): retain most recent agent build logs (#14460)
Updates the `DeleteOldWorkspaceAgentLogs` to:
- Retain logs for the most recent build regardless of age,
- Delete logs for agents that never connected and were created before
   the cutoff for deleting logs while still retaining the logs most recent build.
2024-08-30 17:39:09 +01:00
10c958bba1 chore: implement organization sync and create idpsync package (#14432)
* chore: implement filters for the organizations query
* chore: implement organization sync and create idpsync package

Organization sync can now be configured to assign users to an org based on oidc claims.
2024-08-30 11:19:36 -05:00
9596f236c1 fix: use negative deadline to ensure timeout in TestWebhook/timeout (#14498) 2024-08-30 16:46:13 +02:00
0f414a00d3 fix: restore closing SMTP message on method exit (#14496) 2024-08-30 13:03:25 +02:00
a74273f1fd chore(coderd/database/dbpurge): replace usage of time.* with quartz (#14480)
Related to #10576

This PR introduces quartz to coderd/database/dbpurge and updates the following unit tests to make use of Quartz's functionality:

- TestPurge
- TestDeleteOldWorkspaceAgentLogs

Additionally, updates DeleteOldWorkspaceAgentLogs to replace the hard-coded interval with a parameter passed into the query. This aids in testing and brings us a step towards allowing operators to configure the cutoff interval for workspace agent logs.
2024-08-30 11:55:47 +01:00
c90be9b0c1 fix: correctly close SMTP message and await response (#14495) 2024-08-30 11:37:50 +02:00
628750232f fix: delete workspace agent stats after 180 days (#14489)
Fixes #13430.

The test for purging old workspace agent stats from the DB was consistently failing when ran with Postgres towards the end of the month, but not with the in-memory DB. 

This was because month intervals are calculated differently for `time.Time` and the `interval` type in Postgres:

```
ethan=# SELECT
    '2024-08-30'::DATE AS original_date,
    ('2024-08-30'::DATE - INTERVAL '6 months') AS sub_date;
 original_date |      sub_date
---------------+---------------------
 2024-08-30    | 2024-02-29 00:00:00
(1 row)
```

Using `func (t Time) AddDate(years int, months int, days int) Time`, where `months` is `-6`:
```
Original: 2024-08-30 00:00:00 +0000 UTC
6 Months Earlier: 2024-03-01 00:00:00 +0000 UTC
```

Since 6 months was chosen arbitrarily, we should be able to change it to 180 days, to remove any ambiguity between the in-memory DB, and the Postgres DB. The alternative solution would involve implementing Postgres' month interval algorithm in Go.

The UI only shows stats as old as 168 days (24 weeks), so a frontend change isn't required for the extra days of stats we lose in some cases.
2024-08-30 18:30:04 +10:00
ef7fcf3930 fix: include dormant users in template acl query (#14461)
The issue is that if you add a user and then immediately go to give them
permissions, you can add them but they will not show up in the UI.  They
also do not show up in the audit log entry.
2024-08-29 13:48:28 -08:00
49afab12d5 feat: show organization name for groups on user profile (#14448) 2024-08-29 10:55:00 -06:00
6dbfe6f7ae chore: remove duplicates using the symmetric difference function (#14469)
The `SymmetricDifferenceFunc` used to include duplicates, which was incorrect.
2024-08-28 21:06:27 -05:00
b96ac677f1 chore: add organization search query to workspaces (#14474)
* chore: add organization search query to workspaces
2024-08-28 15:18:45 -05:00
54fe082551 chore: implement filters for the organizations query (#14468)
Required for organization sync. Allows fetching a filtered set of orgs.
2024-08-28 13:24:28 -05:00
f24cb5cc96 fix: prevent test flakiness (#14467)
Signed-off-by: Danny Kopping <danny@coder.com>
2024-08-28 16:33:27 +02:00
b36d979a60 chore: add provisioner api version to /buildinfo (#14446) 2024-08-27 13:40:51 -06:00
47f2c7d683 feat: notify about manual failed builds (#14419) 2024-08-27 14:35:28 +00:00
499769187b fix: increase group name limit to 36 from 32 (#14443) 2024-08-26 11:38:31 -08:00
ded612d3ec fix: use authenticated urls for pubsub (#14261) 2024-08-26 15:04:04 +00:00
6914862903 fix(cli): add check for DisableOwnerWorkspaceExec in scaletest (#14417)
- Adds `--use-host-login` to `coder exp scaletest workspace-traffic`
- Modifies getScaletestWorkspaces to conditionally filter workspaces if `CODER_DISABLE_OWNER_WORKSPACE_ACCESS` is set
- Adds a warning if `CODER_DISABLE_OWNER_WORKSPACE_ACCESS` is set and scaletest workspaces are filtered out due to ownership mismatch.
- Modifies `coderdtest.New` to detect cross-test bleed of `CODER_DISABLE_OWNER_WORKSPACE_ACCESS` and fast-fail.
2024-08-26 12:02:54 +01:00
c8eacc6df7 chore!: allow CreateUser to accept multiple organizations (#14383)
* chore: allow CreateUser to accept multiple organizations

In a multi-org deployment, it makes more sense to allow for multiple
org memberships to be assigned at create. The legacy param will still
be honored.

* Handle sdk deprecation better by maintaining cli functions
2024-08-23 21:23:51 +00:00
af125c3795 chore: refactor entitlements to be a safe object to use (#14406)
* chore: refactor entitlements to be passable as an argument

Previously, all usage of entitlements requires mutex usage on the
api struct directly. This prevents passing the entitlements to
a sub package. It also creates the possibility for misuse.
2024-08-23 16:21:58 -05:00
cb6a47227f chore: implement generalized symmetric difference for set comparison (#14407)
* chore: implement generalized symmetric difference for set comparison

Going to be used in Organization Sync + maybe group sync. Felt
better to reuse, rather than copy
2024-08-23 14:52:35 -05:00
a4d785dec5 chore: use idiomatic test setup in notification tests (#14416) 2024-08-23 16:29:27 +02:00
d4adfa3902 fix(coderd/database/dbmem): include a technical summary row on over-pagination (#14415) 2024-08-23 13:16:55 +01:00
99e103e790 feat(coderd/coderdtest): allow mutating deployment values (#14414) 2024-08-23 12:15:22 +01:00
4cc26be5ec fix: set network telemetry client version on server (#14376) 2024-08-23 06:17:28 +00:00
d52bc91e48 chore: add dbauthz to unhanger tests (#14394) 2024-08-22 22:23:52 +04:00
c818b4ddd4 feat: add notification for suspended/activated account (#14367)
* migrations

* notify

* fix

* TestNotifyUserSuspended

* TestNotifyUserReactivate

* post merge

* fix escape

* TestNotificationTemplatesCanRender

* links and events

* notifyEnq

* findUserAdmins

* notifyUserStatusChanged

* go build

* your and admin

* tests

* refactor

* 247

* Danny's review
2024-08-22 13:52:25 +02:00
e8c59a1d9d chore: avoid flake in resume token test (#14378) 2024-08-22 13:27:43 +10:00
a359879af5 chore: scope workspace quotas to organizations (#14352)
* chore: scope workspace quotas to organizations

Quotas are now a function of (user_id, organization_id). They are
still sourced from groups. Deprecate the old api endpoint.
2024-08-21 09:25:20 -05:00
fa733318e0 Add missing content (#14380) 2024-08-21 12:46:11 +00:00
6960d194ae feat: add provisioning timings to understand slow build times (#14274) 2024-08-21 14:18:58 +02:00
9c8c6a952d feat: add notification deduplication trigger (#14172) 2024-08-21 11:18:03 +02:00
b6d35edebd chore: remove meticulous from CI (#14369) 2024-08-20 14:13:13 -04:00
cca4519420 feat: enable setting max port share level during template creation (#14366) 2024-08-20 22:48:39 +10:00
cf8be4eac5 feat: add resume support to coordinator connections (#14234) 2024-08-20 17:16:49 +10:00
10327fb3a9 fix(coderd): humanize duration on notifications (#14333) 2024-08-19 15:49:47 -03:00
422e044859 chore: forbidden error on create workspace without permissions (#14347)
Multi-org enables the possibility of a user having template permissions,
but not workspace create permissions. The unauthorized error should be
returned instead of a 404. This does not leak any information the user
cannot already obtain.
2024-08-19 13:28:27 -05:00
95a7c0c4f0 chore: use tabs for prettier and biome (#14283) 2024-08-15 14:53:53 -06:00
7b09d98238 chore: add /groups endpoint to filter by organization and/or member (#14260)
* chore: merge get groups sql queries into 1

* Add endpoint for fetching groups with filters
* remove 2 ways to customizing a fake authorizer
2024-08-15 13:40:15 -05:00
83ccdaa755 chore: fixup quotas to only include groups you are a member of (#14271)
* chore: fixup quotas to only include groups you are a member of

Before all everyone groups were included in the allowance.

* chore: add unit test to execercise the bug
* add unit test to add rows into the everyone group
2024-08-15 13:27:50 -05:00
8563b372e8 feat: filter templates by organization (#14254) 2024-08-14 15:01:45 -06:00
4fc047954e fix: avoid deleting peers on graceful close (#14165)
* fix: avoid deleting peers on graceful close

- Fixes an issue where a coordinator deletes all
  its peers on shutdown. This can cause disconnects
  whenever a coderd is redeployed.
2024-08-14 15:16:08 -04:00
6f1951e1c8 feat: add template delete notification (#14250) 2024-08-14 14:22:43 -03:00
c90e6d7b47 chore: fix up migration number fixer (#14266) 2024-08-14 11:05:03 +02:00
84fdfd2a18 chore: remove UpsertCustomRole in favor of Insert + Update (#14217)
* chore: remove UpsertCustomRole in favor of Insert + Update

---------

Co-authored-by: Jaayden Halko <jaayden.halko@gmail.com>
2024-08-13 12:53:47 -05:00
6f9b1a39f4 fix: allow group members to read group information (#14200)
* - allow group members to read basic Group info
- allow group members to see they are part of the group, but not see that information about other members
- add a GetGroupMembersCountByGroupID SQL query, which allows group members to see members count without revealing other information about the members
- add the group_members_expanded db view
- rewrite group member queries to use the group_members_expanded view
- add the RBAC ResourceGroupMember and add it to relevant roles
- rewrite GetGroupMembersByGroupID permission checks
- make the GroupMember type contain all user fields
- fix type issues coming from replacing User with GroupMember in group member queries
- add the MemberTotalCount field to codersdk.Group
- display `group.total_member_count` instead of `group.members.length` on the account page
2024-08-13 09:20:24 -05:00
76722a7db5 fix: make default support links respect --docs-url (#14176)
make default support links respect --docs-url
2024-08-12 17:01:22 -04:00
8af8c77e2a test: add unit test to verify group permission behavior (#14223)
* test: add unit test to verify group permission behavior
* Update coderd/database/dbauthz/groupsauth_test.go

---------

Co-authored-by: Cian Johnston <cian@coder.com>
2024-08-12 08:34:00 -05:00