1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-10-18 20:09:08 +02:00
Commit Graph

442 Commits

Author SHA1 Message Date
Ivar Conradi Østhus
e5035f96e1
fix: rbac should pick up projectId from path if available 2022-02-01 22:58:52 +01:00
Ivar Conradi Østhus
19cb991cc9
fix: metric counters should use bigint (#1313) 2022-01-31 08:50:11 +01:00
Ivar Conradi Østhus
1cad01b97e
fix: welcome-email should not include password-link when disabled (#1302) 2022-01-28 12:50:35 +01:00
Ivar Conradi Østhus
332b94d209
fix: convert simple-password-provider.test.js to ts 2022-01-26 22:44:26 +01:00
Ivar Conradi Østhus
a50d0e2a21
fix: improve API error-handling (#1301)
Unleash is an API and it would simplyfy a lot of the specific
errors could carry the expected HTTP status code for this error.
This would eliminate the need for a gigantic switch/case in the
handle-errors function.
2022-01-26 13:45:22 +01:00
Ivar Conradi Østhus
14a305f0e7
fix: upgrade node-fetch to version 2.6.7 2022-01-23 21:29:42 +01:00
Fredrik Strand Oseberg
8ecacfb89c
Fix/validate context (#1282)
* fix: add context guards

* fix: change error message

* fix: remove console log
2022-01-21 12:02:05 +01:00
Ivar Conradi Østhus
367b31185b
fix: allow charset in content-type (#1241) 2022-01-20 15:00:16 +01:00
sighphyre
dc920e85ba
Fix/add project events (#1267)
* fix: wip project events

* fix: Include deletion events for when a user is removed from a project role

Co-authored-by: Ivar Conradi Østhus <ivarconr@gmail.com>
2022-01-14 12:14:02 +01:00
sighphyre
e164e3d835
Merge pull request #1266 from Unleash/feat/block-deletion-of-root-roles
fix: Prevent deletion of built in roles
2022-01-14 12:55:55 +02:00
Fredrik Strand Oseberg
1989c53fb0
fix: enable tags and validate for legacy api (#1264)
* fix: enable tags and validate for legacy api

* fix: move delete tag

* fix: test name

* fix: move /api/admin/features
2022-01-14 11:16:17 +01:00
sighphyre
bfcad65cdc fix: Prevent deletion of built in roles 2022-01-14 10:30:34 +02:00
Ivar Conradi Østhus
c1826ca79a
fix: incorrect snapshot 2022-01-14 09:23:32 +01:00
sighphyre
0c78980502
feat: custom project roles (#1220)
* wip: environment for permissions

* fix: add migration for roles

* fix: connect environment with access service

* feat: add tests

* chore: Implement scaffolding for new rbac

* fix: add fake store

* feat: Add api endpoints for roles and permissions list

* feat: Add ability to provide permissions when creating a role and rename environmentName to name in the list permissions datastructure

* fix: Make project roles resolve correctly against new environments permissions structure

* fix: Patch migration to also populate permission names

* fix: Make permissions actually work with new environments

* fix: Add back to get permissions working for editor role

* fix: Removed ability to set role type through api during creation - it's now always custom

* feat: Return permissions on get role endpoint

* feat: Add in support for updating roles

* fix: Get a bunch of tests working and delete a few that make no sense anymore

* chore: A few small cleanups - remove logging and restore default on dev server config

* chore: Refactor role/access stores into more logical domains

* feat: Add in validation for roles

* feat: Patch db migration to handle old stucture

* fix: migration for project roles

* fix: patch a few broken tests

* fix: add permissions to editor

* fix: update test name

* fix: update user permission mapping

* fix: create new user

* fix: update root role test

* fix: update tests

* feat: Validation now works when updating a role

* fix: Add in very barebones down migration for rbac so that tests work

* fix: Improve responses from role resolution - getting a non existant role will throw a NotFound error

* fix: remove unused permissions

* fix: add test for connecting roles and deleting project

* fix: add test for adding a project member with a custom role

* fix: add test for changing user role

* fix: add guard for deleting role if the role is in use

* fix: alter migration

* chore: Minor code cleanups

* chore: Small code cleanups

* chore: More minor cleanups of code

* chore: Trim some dead code to make the linter happy

* feat: Schema validation for roles

* fix: setup permission for variant

* fix: remove unused import

* feat: Add cascading delete for role_permissions when deleting a role

* feat: add configuration option for disabling legacy api

* chore: update frontend to beta version

* 4.6.0-beta.0

* fix: export default project constant

* fix: update snapshot

* fix: module pattern ../../lib

* fix: move DEFAULT_PROJECT to types

* fix: remove debug logging

* fix: remove debug log state

* fix: Change permission descriptions

* fix: roles should have unique name

* fix: root roles should be connected to the default project

* fix: typo in role-schema.ts

* fix: Role permission empty string for non environment type

* feat: new permission for moving project

* fix: add event for changeProject

* fix: Removing a user from a project will now check to see if that project has an owner, rather than checking if any project has an owner

* fix: add tests for move project

* fix: Add in missing create/delete tag permissions

* fix: Removed duplicate impl caused by multiple good samaritans putting it back in!

* fix: Trim out add tag permissions, for now at least

* chore: Trim out new add and delete tag permissions - we're going with update feature instead

* chore: update frontend

* 4.6.0-beta.1

* feat: Prevent editing of built in roles

* fix: Patch an issue where permissions for variants/environments didn't match the front end

* fix: lint

Co-authored-by: Ivar Conradi Østhus <ivarconr@gmail.com>
Co-authored-by: Fredrik Oseberg <fredrik.no@gmail.com>
2022-01-13 11:14:17 +01:00
Ivar Conradi Østhus
4a5b332567
fix: make sure our CSP allow gravatar.com for images 2022-01-12 23:22:04 +01:00
Ivar Conradi Østhus
73685c771a
fix: allow static assets from cdn.getunleash.io 2022-01-06 21:08:16 +01:00
Ivar Conradi Østhus
559275129d
Fix/bcryptjs (#1239)
fixes: #1108
2022-01-06 20:43:57 +01:00
Ivar Conradi Østhus
26b7da8b5c
feat: add support for cdnPrefix for static assets (#1191) 2022-01-06 10:31:00 +01:00
Ivar Conradi Østhus
2b59a4219a
fix: Should not remove variants when updating feature toggle metadata (#1234) 2022-01-06 10:23:52 +01:00
Ivar Conradi Østhus
66d4aa61de
fix: correct format for API tokens 2022-01-05 10:40:22 +01:00
Juraj Malenica
e757c00840
feat: Add init api tokens option (#1181)
Adds support for initializing a fresh Unleash instance with predefined API tokens. 

Co-authored-by: sighphyre <liquidwicked64@gmail.com>
Co-authored-by: Juraj Malenica <juraj.malenica@mindsmiths.com>
Co-authored-by: Ivar Conradi Østhus <ivarconr@gmail.com>
2022-01-05 10:00:59 +01:00
Ivar Conradi Østhus
c051eb9149
fix: expose ApiUser out of Unleash 2022-01-04 20:01:18 +01:00
sighphyre
5a82d9be87
fix: Update updateUser code to reject empty emails (#1210)
* fix: Update updateUser code to reject empty emails

This fixes an issue where the updateUser call would allow null email
addresses, then update the email to null and then raise an exception,
leaving the db in a state where no user could be resolved.

* fix: remove username/email requirement in user.ts

Co-authored-by: Ivar Conradi Østhus <ivarconr@gmail.com>
2022-01-03 20:14:56 +01:00
Ivar Conradi Østhus
8d8d48026d
fix: adjust feature-variant-updated event 2021-12-17 04:30:39 +01:00
Christopher Kolstad
994db02f84
fix: Adds feature-variant-updated event. (#1189)
This triggers when we update or overwrite variants, and will include the
previous variants and the new variants.

Co-authored-by: Ivar Østhus <ivarconr@gmail.com>
2021-12-16 11:07:19 +01:00
Christopher Kolstad
791384ddb1
Fix/variants ordering (#1187)
* fix: sort variants on output

We found that for existing variants, the sorting by name wasn't applied, so the index in the patches were wrong. This PR adds the sort also when we're getting variants as part of the getFeature call, not just when we're getting the variants. This should make the UX consistent, and prevent our patches from hitting the wrong index in the variants array.

Co-authored-by: Youssef Khedher <khedher.youssef@hotmail.fr>
2021-12-15 14:20:32 +01:00
Ivar Conradi Østhus
08bff6359c fix: uintroduce call to update last_seen on client-instance 2021-12-10 09:31:54 +01:00
Ivar Conradi Østhus
bf1223e07d fix: rename services 2021-12-10 09:31:54 +01:00
Ivar Conradi Østhus
cf70da71c9 fix: lint 2021-12-10 09:31:54 +01:00
Ivar Conradi Østhus
bb4e6290d5 fix: move toggle-counters to metrics service 2021-12-10 09:31:54 +01:00
Ivar Conradi Østhus
9f13b801eb fix: rename metrics-service to client-instance service 2021-12-10 09:31:54 +01:00
Ivar Conradi Østhus
4a9939ccb1 feat: remove old metrics service 2021-12-10 09:31:54 +01:00
Youssef Khedher
7ec9672a5c
Merge pull request #1145 from Unleash/feat/update-health-report
feat: update health report
2021-12-06 15:39:45 +01:00
Fredrik Strand Oseberg
98d64fc1e4
fix: open validate endpoint (#1162)
* fix: open validate endpoint

* fix: set validate permission to none
2021-12-06 15:19:25 +01:00
Ivar Conradi Østhus
3c550f157a
fix: always require permission for POST, PATCH, PUT, DELETE (#1152) 2021-12-03 12:46:50 +01:00
Ivar Conradi Østhus
784ddf8fb3
fix: cleanup old user permissions (#1150) 2021-12-01 22:10:09 +01:00
Youssef
00f5740d18 fix: rename last_update to updated_at 2021-11-30 15:25:52 +01:00
Youssef
c3273ce1ab fix: remove lastUpdate from fieldToRow 2021-11-30 15:14:50 +01:00
Youssef
71c6b05bc4 fix: remove unused dep 2021-11-30 14:53:31 +01:00
Youssef
10c1b56e38 add lastupdate to health report 2021-11-30 14:05:44 +01:00
Ivar Conradi Østhus
eb8265922d
Fix/enable standard environments (#1134) 2021-11-26 15:31:36 +01:00
Christopher Kolstad
5829ec7b3d
task: Sort variants by name (#1132) 2021-11-26 13:06:36 +01:00
Christopher Kolstad
5cdb3f665a
task: Ban changes to variants through feature (#1130)
* task: Ban changes to variants through feature

After adding the new `/variants` endpoint for features we now have a way
to access control adding/modifying variants, so the /:featureName
endpoint should no longer allow editing/adding variants.

This removes variants as a known field from the featureMetadata schema
and tells joi to stripUnknown, thus making sure we never include
variants in the initial creation or future update calls.

For the old features v1 API we allow it to declare that it has already
validated the data coming with its own schema, so we should use the data
we get from it. Thus keeping the old v1 functionality intact

Co-authored-by: Simon Hornby <simon@getunleash.ai>
2021-11-25 14:53:58 +01:00
Ivar Conradi Østhus
b47b507e18
fix: metrics v2 should await for the clearer (#1114) 2021-11-25 14:18:35 +01:00
Christopher Kolstad
c9ff3972e2
fix: Stop healthrating from including archived (#1128)
- Since the archived toggles are not visible in the health dashboard,
  including them in the health rating calculation makes for some really
  confusing dashboards. This PR makes sure we only include non-archived
  toggles when calculating health.
2021-11-25 10:09:23 +01:00
Christopher Kolstad
72092e4a1c
fix: make new variant api validate name uniqueness (#1126) 2021-11-24 14:22:28 +01:00
Christopher Kolstad
6c6001619c
Feat/variant api (#1119)
Add a new .../:feature/variants API

This adds
- `GET /api/admin/projects/:projectId/features/:featureName/variants` which returns 
```json
{ version: '1', variants: IVariant[] }
```
- `PATCH /api/admin/projects/:projectId/features/:featureName/variants` which accepts a json patch set and updates the feature's variants field and then returns 
```json
{ version: '1', variants: IVariant[] }
```
- `PUT /api/admin/projects/:projectId/features/:featureName/variants`
 which accepts a IVariant[] and overwrites the current variants list for the feature defined in :featureName and returns
```json
{ version: '1', variants: IVariant[] }

- This also makes sure the total weight of all variants is == 1000
- Validates that there is at least 1 'variable' variant if there are variants
- Validates that 'fix' variants total weight can't exceed 1000
- Adds tests for all these invariants.


Co-authored-by: Simon Hornby <simon@getunleash.ai>
2021-11-24 13:08:04 +01:00
Fredrik Strand Oseberg
c369b77b24
Merge branch 'master' into feat/splash 2021-11-12 13:19:36 +01:00
Youssef
2d03b8c61e fix: return be object instead of array 2021-11-12 13:19:06 +01:00
Ivar Conradi Østhus
d8478dd928
feat: clean up events (#1089)
Co-authored-by: Christopher Kolstad <chriswk@getunleash.ai>
2021-11-12 13:15:51 +01:00
Youssef
0199d1f211 fix: remove req.body from the splash object when update 2021-11-12 12:44:33 +01:00
Youssef Khedher
314c60393f
Merge branch 'master' into feat/splash 2021-11-12 11:30:08 +01:00
Youssef
c4e56aae09 fix: remove record splash and update sql query in add-splash-entry 2021-11-12 10:49:09 +01:00
Martin Lehmann
064599c942
fix: refactor client-metrics list and ttl-list to TypeScript (#1080)
Co-authored-by: Ivar Conradi Østhus <ivarconr@gmail.com>
2021-11-11 20:29:40 +01:00
Ivar Conradi Østhus
f0895cf653
fix: prevent deadlock for batchinserting usage metrics (#1100)
* fix: prevent deadlock for batchinserting usage metrics

In client metrics v2 we utilize postgres to count the usage
across a few dimentions (featureName, app_name, environment).

It turns out that if the UPDATE values are not executed in a predictable
order we can end up in a deadlock scenario with postgresql.

In this fix we thus sort the metrics on the feature_name, app_name and
envrionment, to make sure they always are executed in a predictabel
order, and thus avoiding independent inserts colliding in to a deadlock
waiting for eachother.

* fix: tests cannot assume order
2021-11-11 16:05:29 +01:00
Youssef
c4da3e89c5 fix: styling 2021-11-09 20:55:23 +01:00
Youssef
96f2514fc5 send splash data in the user object 2021-11-09 20:39:13 +01:00
Youssef
cc516618a1 add splash-controller and cascade migration 2021-11-09 14:16:34 +01:00
Fredrik Oseberg
d73293c576 fix: add migration 2021-11-09 11:52:02 +01:00
Youssef
875fb7734c create splash migration store and service file 2021-11-08 16:31:38 +01:00
Ivar Conradi Østhus
645a8bce05
fix: convert iso-strings from db to date object 2021-11-04 22:16:48 +01:00
Ivar Conradi Østhus
053956b45e
fix/projectId cannot change for strategy configs (#1084) 2021-11-04 21:24:55 +01:00
Fredrik Strand Oseberg
ec60f4485c
fix: disable projects (#1085) 2021-11-04 21:09:52 +01:00
Lennart
759b592d90
fix: update mime library method signature to 2.X (#1078)
Co-authored-by: Ivar Conradi Østhus <ivarconr@gmail.com>
2021-11-02 23:43:16 +01:00
Martin Lehmann
b47e228181
fix: be explicit when specifying time & replace moment with date-fns (#1072) 2021-11-02 15:13:46 +01:00
Ivar Conradi Østhus
b04b6b3ef7
chore: mute expected test errors 2021-10-29 11:22:40 +02:00
Ivar Conradi Østhus
4fb1bcb524
feat: Disable password based login (#1046)
This commit will introduce a new setting used to disbaled
simple password based authention.

The setting itself is an enterprise setting.
2021-10-29 10:25:42 +02:00
Ivar Conradi Østhus
9e73ed8f47
chore: remvoe console.error for tests expecting error 2021-10-29 09:25:47 +02:00
Ivar Conradi Østhus
0e3813f5f6
fix: lint 2021-10-28 16:32:50 +02:00
Ivar Conradi Østhus
3ef7fd2420
fix: legacy feature stale on/off needs to return full toggle 2021-10-28 15:48:07 +02:00
Ivar Conradi Østhus
d0b2ce3170
fix: add enpoint for fetching a single user (#1074)
* fix: add enpoint for fetching a single user

* fix add api docs
2021-10-28 14:24:09 +02:00
Ivar Conradi Østhus
8040abb1c4
fix: reuse message formatter for addons (#1058) 2021-10-28 14:09:11 +02:00
Ivar Conradi Østhus
131eeeaa78
fix: demo-auth should use /auth path 2021-10-26 23:04:44 +02:00
Martin Lehmann
607b2a6657
fix: use date-fns for date/time maths instead of (wrong) Date#setHours (#1070)
Co-authored-by: Ivar Conradi Østhus <ivarconr@gmail.com>
2021-10-26 20:13:30 +02:00
Ivar Conradi Østhus
07202a9910
fix: removing a strategy from a toggle should only require UPDATE_FEATURE permission 2021-10-25 11:14:38 +02:00
Christopher Kolstad
6914bd7908
fix: Only trigger environment enabled/disabled events if different f… (#1053)
Co-authored-by: Ivar Conradi Østhus <ivarconr@gmail.com>
2021-10-21 22:33:50 +02:00
Ivar Conradi Østhus
1924961efa
fix: simplify how we update projects 2021-10-21 21:06:56 +02:00
Christopher Kolstad
f0dfe204ee
fix: Remove duplicate FEATURE_METADATA_UPDATED from events list for webhook addon (#1052) 2021-10-21 20:54:03 +02:00
Ivar Conradi Østhus
a0d5b04388
fix: only send FEATURE_UPDATED for legacy (#1054)
Co-authored-by: Christopher Kolstad <chriswk@getunleash.ai>
2021-10-21 20:53:39 +02:00
Christopher Kolstad
b7b5f0caa0
fix: add constraint for changing project. (#1049)
- In order for a feature toggle to be allowed to change project, the
  target project must have the same enabled environments.
- If the feature toggle has an environment which is not in use that does
  not exist in target project, this is ok.

Co-authored-by: Fredrik Strand Oseberg <fredrik.no@gmail.com>

Co-authored-by: Fredrik Strand Oseberg <fredrik.no@gmail.com>
2021-10-21 10:29:09 +02:00
Ivar Conradi Østhus
3484340cd0
fix: only add project environments if enabled (#1050) 2021-10-21 10:14:35 +02:00
Christopher Kolstad
62b121285c
Create a apiuser for demo auth. (#1045)
- If api token middleware is disabled, still allow calls to /api/client with a
  populated fake api user with client access.
2021-10-20 13:16:07 +02:00
Christopher Kolstad
28d0238732
add try-catch to demo auth middleware (#1044)
- Since we validate email used in auth the route function needs to
  handle the possibility that userService.loginUserWithoutPassword can
  throw.
2021-10-19 14:24:23 +02:00
Christopher Kolstad
1f37b0bf4b
fix: make hasPermission call handle api tokens (#1041) 2021-10-19 11:34:56 +02:00
Christopher Kolstad
26407cc02e
Fix/feature strategies needs project update (#1040)
* Make sure feature_strategies follow feature to new project
2021-10-19 09:49:43 +02:00
Ivar Conradi Østhus
3b925902d7
fix: event-log 2021-10-15 20:11:51 +02:00
Ivar Conradi Østhus
5f6758d8f0
fix: update context field does not await the response (#1027) 2021-10-14 08:30:36 +02:00
Ivar Conradi Østhus
ae03390331
fix: add support for experimental flags (#1025) 2021-10-13 20:52:44 +02:00
Ivar Conradi Østhus
41574e3938
fix: create admin users if enabled and zero users already 2021-10-12 21:39:57 +02:00
Christopher Kolstad
20a4aeff97
Make Appinstance registration include environment (#1014) 2021-10-12 10:39:28 +02:00
Christopher Kolstad
d176028a00 Trigger STALE events when patching stale field
- Also moved the patch function into service, instead of performing the
  operation in the controller
2021-10-11 11:27:20 +02:00
Ivar Conradi Østhus
fc455811f8
feat/metricsV2 (#1005)
Adds a new way of handling usage metrics where we push it directly to the database and performs aggregation on the fly. All metrics are aggregated in to buckets of hours. We will for now store metrics for the 48 hours with the following dimensions:

- featureName
- projectName
- envrionment
- yes (the actual count)
- no (the actual count)
2021-10-08 10:09:22 +02:00
Ivar Conradi Østhus
3612884501
feat: clone feature toggle API (#1006) 2021-10-08 09:37:27 +02:00
Christopher Kolstad
b4b222f4c9
feat: add new more specific feature/environment events to addons (#994)
* feat: add new more specific feature/environment events to addons

* Updated strategy change text

* Update all three addon messages for strategy

* Link to new features view for strategy change text

Co-authored-by: Ivar Conradi Østhus <ivarconr@gmail.com>
2021-10-07 10:22:20 +02:00
Fredrik Strand Oseberg
12245664ad
fix: add sort order to environments (#1004)
* fix: add sort order to environments

* fix: lint

* fix: remove display name
2021-10-06 09:39:59 +02:00
Christopher Kolstad
a401580228
task: Disables feature_environments without strategies (#1003) 2021-10-06 09:25:34 +02:00
Ivar Conradi Østhus
796f202da3
fix: lint 2021-10-01 22:28:09 +02:00
Ivar Conradi Østhus
fa56124b89
fix: do not filter FEATURE_METADATA_UPDATE events 2021-10-01 13:04:00 +02:00
Ivar Conradi Østhus
ee660c8eef
fix: client api should return feature toggles for disabled environments (#995)
* fix: client api should return feature toggles for disabled environments

* fix: add test

* lint
2021-10-01 12:27:05 +02:00
Ivar Conradi Østhus
54a99460ce
fix: add projects api for oss as well 2021-10-01 10:59:43 +02:00
Christopher Kolstad
efdbda68e4
fix: reduce data in FEATURE_ENVIRONMENT events 2021-09-29 12:58:02 +02:00
Ivar Conradi Østhus
0a83abe101
fix: add environments to project details (#992) 2021-09-29 12:22:04 +02:00
Christopher Kolstad
e3cebb21c8
task: add default environment (#989)
- Adds development and production environments.
- Connects default environment to all projects
- When creating a project connects the project to all enabled
  environments
2021-09-29 11:09:35 +02:00
Christopher Kolstad
c870b33ba6
task: remove displayName from environments (#988)
This will require a change in enterprise as well.
2021-09-29 10:23:43 +02:00
Ivar Conradi Østhus
f6169540a5
fix: Store metrics only if not empty (#991) 2021-09-29 09:47:49 +02:00
renovate[bot]
120eb2b2fa
fix(deps): update dependency js-yaml to v4 (#985)
* fix(deps): update dependency js-yaml to v4

* fix: upgrade to js-yaml v4

* fix: upgrade to js-yaml 4.1.0

Co-authored-by: Renovate Bot <bot@renovateapp.com>
Co-authored-by: Ivar Conradi Østhus <ivarconr@gmail.com>
2021-09-28 20:53:39 +02:00
Christopher Kolstad
77d781db12
task: Adds FEATURE_ENVIRONMENT_{ENABLED,DISABLED} events (#970)
* task: Adds FEATURE_ENVIRONMENT_{ENABLED,DISABLED} events
2021-09-27 14:07:26 +02:00
Ivar Conradi Østhus
4b7e1f4a81
feat: rename :global: env to "default" (#947)
Our testing and internal validation has proven that
the :global: environment concept confuses people more
than the problems it solves. We have thus decided to
group all configuration that was created before the
environment concept was introduced in to the "default
environment. This would still make everything work
as before in addition to introducing the env concept.

Co-authored-by: Christopher Kolstad <chriswk@getunleash.ai>
2021-09-24 13:55:00 +02:00
Christopher Kolstad
132e801836
Add UPDATE and DELETE TAG_TYPE permissions (#951) 2021-09-24 09:01:15 +02:00
Christopher Kolstad
e42e0f620a
fix: don't include archived feature strategies (#955) 2021-09-24 08:55:53 +02:00
Christopher Kolstad
62b0bcbdc4
fix: Added displayName to feature environments 2021-09-23 16:25:24 +02:00
Christopher Kolstad
e7b948e9db
Add type to environments
- Now returns type as part of the environment object when requesting
  a feature
2021-09-23 16:16:31 +02:00
Christopher Kolstad
5af2633d6d
added tests and exports for 3.17, 4.0 and 4.1 (#944)
Co-authored-by: Ivar Conradi Østhus <ivarconr@gmail.com>
2021-09-20 12:29:16 +02:00
Christopher Kolstad
f85f66d4f5
feat: add project and environment columns to events (#942)
* feat: add project and environment columns to events

* Added events for feature_strategy update

* fix duplicate test key for dbInit

* Fix argument list for toggleService calls in tests
2021-09-20 12:13:38 +02:00
Christopher Kolstad
37d6c4886a
Respect sort order when displaying strategies (#943) 2021-09-17 15:11:17 +02:00
Ivar Conradi Østhus
c4b697b57d
Feat/api key scoping (#941)
Co-authored-by: Christopher Kolstad <chriswk@getunleash.ai>
2021-09-15 20:28:10 +02:00
Ivar Conradi Østhus
24b057ab6d
fix: lint error 2021-09-14 20:43:05 +02:00
Ivar Conradi Østhus
ab4744e79b
fix: convert schemas to typescript 2021-09-14 20:36:40 +02:00
Ivar Conradi Østhus
dedec5c7d1
fix: convert more tests to typescript 2021-09-14 20:30:37 +02:00
Ivar Conradi Østhus
80291dffcf
fix: convert api-def.js to tyoescript 2021-09-14 20:07:05 +02:00
Ivar Conradi Østhus
e2177da114
fix: convert xtract-user.js to typescript 2021-09-14 19:58:48 +02:00
Ivar Conradi Østhus
83bfcde934
fix: convert event-hook.test.js to typescript 2021-09-14 19:34:35 +02:00
Ivar Conradi Østhus
436f295dc5
fix: convert files to typescript 2021-09-14 19:30:11 +02:00
Ivar Conradi Østhus
d3b9bcb7be
fix: convert feature-schema.test.js to typescript 2021-09-14 12:41:22 +02:00
Fredrik Strand Oseberg
26c9d53b89
feat: Move environments to enterprise (#935)
- Adding, updating and renaming environments are meant to be
  enterprise only features, as such, this PR moves these operations out
  of this server

- We still keep sortOrder updating, toggling on/off and getting one,
  getting all, so we can still work with environments in the OSS version
  as well.

Co-authored-by: Christopher Kolstad <chriswk@getunleash.ai>

Co-authored-by: Christopher Kolstad <chriswk@getunleash.ai>
2021-09-13 15:57:38 +02:00
Ivar Conradi Østhus
90962434d9
fix: Cleanup new features API with env support (#929) 2021-09-13 10:23:57 +02:00
Ivar Conradi Østhus
5028bb6c60 fix: failing test 2021-09-10 12:25:12 +02:00
Ivar Conradi Østhus
dff86fcfff fix: add resetDb to migrator 2021-09-10 12:25:12 +02:00
Christopher Kolstad
559cad3c27 Set default SMTP port to 587 instead of 567
fixes: #937
2021-09-09 11:42:36 +02:00
Ivar Conradi Østhus
11640e882b fix: fine tune db-config based on experience 2021-09-03 12:57:25 +02:00
Ivar Conradi Østhus
635d50e1a8 fix: addon-service should only trigger enabled addons
fixes: #932
2021-09-02 12:46:29 +02:00
Ivar Conradi Østhus
c518ddf84c fix: improve performance for fetching active api tokens 2021-09-02 12:46:29 +02:00
Ivar Conradi Østhus
e8486612b6
fix: set correct projects count in metrics 2021-08-31 23:29:23 +02:00
Ivar Conradi Østhus
9b521de34e
fix: correct data format for FEATURE_CREATED event 2021-08-27 19:30:51 +02:00
Ivar Conradi Østhus
d0d49051ac
Revert "fix: oas being overriden"
This reverts commit e03bac9e64.
2021-08-27 12:08:26 +02:00
Ivar Conradi Østhus
e03bac9e64
fix: oas being overriden 2021-08-27 12:02:02 +02:00
Ivar Conradi Østhus
cecdd96863
fix: only add strategies to addon texts when available 2021-08-27 10:15:56 +02:00
Ivar Conradi Østhus
aab4602029
fix: add user and project counters 2021-08-27 10:10:14 +02:00
Ivar Conradi Østhus
14857b01c8
fix: import schema needs to understand :global: env 2021-08-26 22:42:06 +02:00
Ivar Conradi Østhus
56cd0d6912
fix: import should not drop built-in strategies 2021-08-26 22:41:51 +02:00
Ivar Conradi Østhus
d28df3e3fa
Fix/feature events (#924) 2021-08-26 13:59:11 +02:00
Ivar Conradi Østhus
8cb147a81f
fix: getFeatureToggleAdmin should include project 2021-08-25 15:14:07 +02:00
Fredrik Strand Oseberg
856c7a358b
Fix/switch project endpoint (#923) 2021-08-25 13:38:00 +02:00
Ivar Conradi Østhus
bb47c19d4d
fix: only update name if not undefined 2021-08-25 12:43:42 +02:00
Ivar Conradi Østhus
8cbf378286
feat: sync fields when logging in via SSO (#916) 2021-08-23 12:11:29 +02:00
Fredrik Strand Oseberg
cdc2e7daee
fix: add properties to legacy endpoints (#919)
Co-authored-by: Ivar Conradi Østhus <ivarconr@gmail.com>
2021-08-19 13:34:24 +02:00
Ivar Conradi Østhus
d3fbaa6587
fix: add member and toggle count to project list (#918) 2021-08-19 13:25:36 +02:00
Ivar Conradi Østhus
bb9ae03b27
Revert "fix: uri encode smtp connection string (#901)"
This reverts commit 8f1a5f5a64.
2021-08-16 10:24:28 +02:00
Ivar Conradi Østhus
721baa7657
fix: Clean up exported types even more 2021-08-13 19:22:15 +02:00
Ivar Conradi Østhus
aaa5e056e5
fix: exported types x2 2021-08-13 13:51:29 +02:00
Ivar Conradi Østhus
1f9d31ea17
fix: export types from main entry 2021-08-13 13:42:08 +02:00
Christopher Kolstad
45f5d1fb1a
feat: Adds sendEmail flag to body of create user request (#894)
This allows frontend to support a toggle for admins wanting to create
users and passwords manually, without sending emails to users they
create.

Co-authored-by: Ivar Conradi Østhus <ivarconr@gmail.com>
2021-08-13 10:50:48 +02:00
Ivar Conradi Østhus
2bcdb5ec31
fix: Controller wraps handler with try/catch (#909)
By having the controller perform try/catch around the
handler function allows us to add extra safety to all
our controllers and safeguards that we will always catch
exceptions thrown by a controller method.
2021-08-13 10:36:19 +02:00
Ivar Conradi Østhus
5760d10e70
Revert "fix: upgrade js-yaml to 4.1.0"
This reverts commit 4852d67049.
2021-08-12 23:00:47 +02:00
Ivar Conradi Østhus
4852d67049
fix: upgrade js-yaml to 4.1.0 2021-08-12 22:47:44 +02:00
James Renaud
8f1a5f5a64
fix: uri encode smtp connection string (#901)
Signed-off-by: James Renaud <james.renaud@mitel.com>

Co-authored-by: Ivar Conradi Østhus <ivarconr@gmail.com>
2021-08-12 22:32:16 +02:00
Christopher Kolstad
ff7be7696c
fix: Stores as typescript and with interfaces. (#902)
Co-authored-by: Ivar Conradi Østhus <ivarconr@gmail.com>
2021-08-12 15:04:37 +02:00
Ivar Conradi Østhus
806b4a4a59
fix: failing tests 2021-08-10 13:50:59 +02:00
Christopher Kolstad
9646bcfebb
fix: only import feature_tags for imported features 2021-07-30 13:38:28 +02:00
Ivar Conradi Østhus
0ff89ebdf3
fix: logout-controller should support logoutUrl override (#881) 2021-07-18 21:42:36 +02:00
Fredrik Oseberg
72993002a2 fix: always add global environment to new projects 2021-07-14 13:20:36 +02:00
Fredrik Oseberg
45fdd6e2f6 fix: return empty array if no features are found for project 2021-07-14 13:17:20 +02:00
Ivar Conradi Østhus
815a75a5b4
Wip/environments (#880)
Adds environment support

This PR adds environments as a first-class concept in Unleash.

It necessitated a full rewrite on how we connect feature <-> strategy, as well as a rethink on which levels environments makes sense.

This enables PUTs on strategy configurations for a feature, since all strategies now have ids.

This also updates export/import format. The importer handles both formats, but export is no longer possible in version 1 of the export format, only in version 2, with strategy configurations for a feature as a separate object.

Co-authored-by: Christopher Kolstad <chriswk@getunleash.ai>
Co-authored-by: Fredrik Oseberg <fredrik.no@gmail.com>
Co-authored-by: Ivar Conradi Østhus <ivarconr@gmail.com>
2021-07-07 10:46:50 +02:00
checketts
2f013bacbf
chore: Convert client metrics controller to typescript (#831)
Co-authored-by: Ivar Conradi Østhus <ivarconr@gmail.com>
2021-06-24 19:22:12 +02:00
Ivar Conradi Østhus
2da26e7f14
fix: refactor code 2021-06-18 11:53:52 +02:00
Ivar Conradi Østhus
4f9deee2ed
fix: add option for graceful shutdown (#872)
* fix: add option for graceful shutdown

* fix: gracefulShutdown should close idle keep-alive connections

* fix: eslint import order

* docs: add config options to docs as well
2021-06-17 20:33:34 +02:00
Ivar Conradi Østhus
6c2ec59fa4
fix: Do gracefull shutdown of Unleash on 'SIGINT' & 'SIGTERM' (#870)
Unleash will listen for 'SIGINT' & 'SIGTERM'  and close background tasks and db connections before shutting down. 

Co-authored-by: Christopher Kolstad <chriswk@getunleash.ai>

Co-authored-by: Christopher Kolstad <chriswk@getunleash.ai>
2021-06-15 12:32:35 +02:00
Ivar Conradi Østhus
bef375e7bf
fix: userFeedback should not be allowed to throw 2021-06-08 20:21:14 +02:00
Ivar Conradi Østhus
8e3e973f22
fix: make sure routes/user handles api calls 2021-06-08 20:15:03 +02:00
Fredrik Strand Oseberg
9f33285b03
Feat/pnps feedback (#862)
* feat: setup user feedback service

* fix: map rows

* feat: add tests

* wrap service calls in try catch

* fix: add test for retrieving feedback on user

* feat: add fake user feedback store

* fix: check ffor feedback id in controller

* feat: add test for bad request
2021-06-07 11:11:42 +02:00
Ivar Conradi Østhus
3858b29d80
fix: register metrics middleware before pre-hook (#866) 2021-06-07 10:34:32 +02:00
Christopher Kolstad
3a65847aa7
Migrate to jest (#854)
* Migrate to jest
* Use --force-exit until dns close handle issue https://github.com/facebook/jest/issues/9982

Co-authored-by: Ivar Conradi Østhus <ivarconr@gmail.com>
2021-05-28 11:10:24 +02:00
Ivar Conradi Østhus
f9ef945404
fix: projects needs at least one owner 2021-05-25 19:28:29 +02:00
Ivar Conradi Østhus
14a7d1b3b2
fix: create config should allow all options params 2021-05-25 12:48:37 +02:00
Ivar Conradi Østhus
e095691c1e
fix: lint 2021-05-21 19:16:08 +02:00
Ivar Conradi Østhus
8300482e1c
fix: update yarn.lock 2021-05-21 16:51:13 +02:00
Ivar Conradi Østhus
bcc2d913cc
fix: more docs 2021-05-18 13:22:28 +02:00
Ivar Conradi Østhus
1691efbcae
fix: remove errornered envrionment=test 2021-05-11 15:10:14 +02:00
Ivar Conradi Østhus
f57e056368
fix: versionInfo as part of ui-config 2021-05-11 14:59:38 +02:00
Christopher Kolstad
171b5182a5 fix: misunderstanding node URL api 2021-05-11 14:43:41 +02:00
Christopher Kolstad
69ded61448 fix: demo auth type should support api token 2021-05-11 14:15:15 +02:00
Fredrik Strand Oseberg
52d3e9eb77
fix: report email as not sent to fe if it throws (#844) 2021-05-11 12:15:20 +02:00
Christopher Kolstad
13af1cf9ab Updated addon feature links for browserrouter 2021-05-07 14:05:42 +02:00
Christopher Kolstad
5330126a2e fix: update slack link after switch to browserrouter 2021-05-07 14:03:15 +02:00
Christopher Kolstad
0086580130 fix: reset-token-service should use unleashUrl 2021-05-07 10:38:41 +02:00
Christopher Kolstad
5565dd8c4b
chore: expose an endpoint to really delete a toggle (#808)
* chore: expose an endpoint to really delete a toggle

- To provide a way to run end-to-end tests without cluttering
  our demo instance with way too many feature-toggles, making this
  endpoint available will allow end-to-end tests to clean up properly
  after themselves
2021-05-06 14:11:56 +02:00
Christopher Kolstad
b0845adee8
fix: rbac now checks permission for both projects (#838)
- When updating a toggle
   - If the project is updated, the user performing the operation
     will need UPDATE_FEATURE permission for both old and new project

fixes: #837
2021-05-05 22:32:25 +02:00
Christopher Kolstad
40a358ac78 fix: an hour is 3600000 seconds not 60000 seconds 2021-05-05 14:56:09 +02:00
Christopher Kolstad
447e44ee77 fix: readd support for DATABASE_URL_FILE 2021-05-05 11:36:22 +02:00
Ivar Conradi Østhus
37d701a121
fix: reload of admin/api page yields 404
fixes: #836
2021-05-05 09:01:39 +02:00
Ivar Conradi Østhus
01ab4e1604
feat: global events requires admin role 2021-05-04 22:11:30 +02:00
Fredrik Strand Oseberg
28b186150d
fix: remove toast info from bootstrap controller (#834)
Co-authored-by: Ivar Conradi Østhus <ivarconr@gmail.com>
2021-05-04 21:43:14 +02:00
Fredrik Strand Oseberg
5091f287f2
fix: set name type to be min 1 character (#833) 2021-05-04 21:42:42 +02:00
Ivar Conradi Østhus
185aee70df
fix: /api/admin/user should not allow caching 2021-05-04 21:33:32 +02:00
Fredrik Strand Oseberg
2099bbea73
fix: match bootstrap uiConfig with expected data format (#830)
* fix: match bootstrap uiConfig with expected data format

* fix: default to empty object for ui and experimental properties on config

* fix: update text
2021-05-04 10:00:25 +02:00
R Ashwin
d61c7242d8
feat: Datadog integration (#820)
fixes: #815 

Co-authored-by: Ivar Conradi Østhus <ivarconr@gmail.com>
2021-05-03 22:08:14 +02:00
Ivar Conradi Østhus
0bed8f605e
fix: regular users are not API users 2021-05-03 19:33:37 +02:00
Fredrik Strand Oseberg
85a544bbd6
Feat/format base path (#828)
* chore: update changelog

* feat: add formatBaseUri helper

* feat: call formatBaseUri on server options

* feat: call formatBaseUri on user options

* fix: update test

* fix: disable consistent return
2021-05-03 12:28:59 +02:00
Ivar Conradi Østhus
841e2a6e07
fix: more types 2021-05-02 21:11:17 +02:00
Ivar Conradi Østhus
4b48c08e0e
fix: move permission to types 2021-05-02 20:58:02 +02:00