Commit Graph

84 Commits

Author SHA1 Message Date
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 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 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
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
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 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
Ivar Conradi Østhus 3c550f157a fix: always require permission for POST, PATCH, PUT, DELETE (#1152) 2021-12-03 12:46:50 +01:00
Youssef 00f5740d18 fix: rename last_update to updated_at 2021-11-30 15:25:52 +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
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
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 c4da3e89c5 fix: styling 2021-11-09 20:55:23 +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 053956b45e fix/projectId cannot change for strategy configs (#1084) 2021-11-04 21:24:55 +01: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
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 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
Ivar Conradi Østhus 3484340cd0 fix: only add project environments if enabled (#1050) 2021-10-21 10:14:35 +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 ae03390331 fix: add support for experimental flags (#1025) 2021-10-13 20:52:44 +02:00
Christopher Kolstad 20a4aeff97 Make Appinstance registration include environment (#1014) 2021-10-12 10:39:28 +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 a401580228 task: Disables feature_environments without strategies (#1003) 2021-10-06 09:25:34 +02:00
Ivar Conradi Østhus 54a99460ce fix: add projects api for oss as well 2021-10-01 10:59:43 +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
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 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 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
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 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