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

110 Commits

Author SHA1 Message Date
Simon Hornby
2a4ca96da2
Permission for variant environments (#2490)
adds permissions for variants per environment
2022-11-22 11:54:04 +02:00
Gastón Fournier
efd47b72a8
feat: Add variants per env (#2471)
## About the changes
Variants are now stored in each environment rather than in the feature
toggle. This enables RBAC, suggest changes, etc to also apply to
variants.

Relates to [roadmap](https://github.com/orgs/Unleash/projects/10) item:
#2254

### Important files
- **src/lib/db/feature-strategy-store.ts** a complex query was moved to
a view named `features_view`
- **src/lib/services/state-service.ts** export version number increased
due to the new format

## Discussion points
We're keeping the old column as a safeguard to be able to go back

Co-authored-by: sighphyre <liquidwicked64@gmail.com>
Co-authored-by: Christopher Kolstad <chriswk@getunleash.ai>
2022-11-21 10:37:16 +01:00
sjaanus
9176ffae1e
Change requests - add multiple reviewers (#2448)
This PR adds implements the frontend and migrations part of multiple
reviewers.

2 UI parts:

1. Configuration to add the count of required approvals
2. Handle multiple approvers in review page.
2022-11-17 11:08:29 +02:00
Mateusz Kwasniewski
4f65ad555f
Changeset comments schema (#2425) 2022-11-15 09:15:56 +01:00
andreas-unleash
74c5189159
Feat/add change request settings (#2390)
<!-- Thanks for creating a PR! To make it easier for reviewers and
everyone else to understand what your changes relate to, please add some
relevant content to the headings below. Feel free to ignore or delete
sections that you don't think are relevant. Thank you! ❤️ -->
Add change_request_settings table 
Remove change_request_enabled column

## About the changes
<!-- Describe the changes introduced. What are they and why are they
being introduced? Feel free to also add screenshots or steps to view the
changes if they're visual. -->

<!-- Does it close an issue? Multiple? -->
Closes #

<!-- (For internal contributors): Does it relate to an issue on public
roadmap? -->
<!--
Relates to [roadmap](https://github.com/orgs/Unleash/projects/10) item:
#
-->

### Important files
<!-- PRs can contain a lot of changes, but not all changes are equally
important. Where should a reviewer start looking to get an overview of
the changes? Are any files particularly important? -->


## Discussion points
<!-- Anything about the PR you'd like to discuss before it gets merged?
Got any questions or doubts? -->
2022-11-11 10:09:25 +02:00
Fredrik Strand Oseberg
ac78c8f732
Feat/change request permissions (#2382)
* Adds two new permissions for the new enterprise level change request: APPROVE_CHANGE_REQUEST and APPLY_CHANGE_REQUEST
2022-11-10 11:08:58 +01:00
andreas-unleash
47a617c78b
Add changeRequestEnabled to project and project_environments (#2357)
<!-- Thanks for creating a PR! To make it easier for reviewers and
everyone else to understand what your changes relate to, please add some
relevant content to the headings below. Feel free to ignore or delete
sections that you don't think are relevant. Thank you! ❤️ -->

- Add `change_request_enabled` column to `projects` and
`project_environments`
- Modified the store to include the new column
- Added new column to Project open api schema 

## About the changes
<!-- Describe the changes introduced. What are they and why are they
being introduced? Feel free to also add screenshots or steps to view the
changes if they're visual. -->

<!-- Does it close an issue? Multiple? -->
Closes #

<!-- (For internal contributors): Does it relate to an issue on public
roadmap? -->
<!--
Relates to [roadmap](https://github.com/orgs/Unleash/projects/10) item:
#
-->

### Important files
<!-- PRs can contain a lot of changes, but not all changes are equally
important. Where should a reviewer start looking to get an overview of
the changes? Are any files particularly important? -->


## Discussion points
<!-- Anything about the PR you'd like to discuss before it gets merged?
Got any questions or doubts? -->
2022-11-09 14:44:53 +02:00
sjaanus
5e14e80ae3
Change request approvals table (#2347)
1. Added database table for change request approvals
2. Removed separate endpoint for applying. **Now all state changes will
go through same endpoint.**
2022-11-09 10:40:47 +02:00
sjaanus
102713eeca
Remove uniqueness from change requests merging (#2332)
Remove uniqueness
2022-11-04 10:57:45 +02:00
sjaanus
0de0da8f97
Remove manually added migrations and fix the scripts (#2324)
* Fix migrations

* Fix migrations
2022-11-03 14:05:47 +02:00
sjaanus
5dd8616c74
Rename suggest changes to change request (#2311)
* Rename change request

* Merge with review status

* Move events and permissions
2022-11-02 08:34:14 +02:00
sjaanus
dda1f19c70
Suggest changes updates (#2273)
* Make domain type and schema match

* Deleting change from changeset

* Add ability to merge
2022-10-27 15:47:46 +03:00
andreas-unleash
85631b9951
Add suggest-change-store.ts and db migration (#2201)
* Add suggest-change-store.ts and db migration

* Add suggest-change-store.ts and db migration

* change payload and event data type

* Update src/lib/db/suggest-change-store.ts

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

* split to 3 tables, create event on every change

* split to 3 tables, create event on every change

* Move service to enterprise
PR Comments

* PR Comments

* replacy createdBy string with User

* replace createdBy string with User

* added event to docs

* return entire changeset after adding a change

* bug fix

* bug fix

* move add change return to service layer

* PR comments

* added user id to user objects

* added user id to user objects

* added user id to user objects

* bug fix

* Rework

* Remove event and fix queries

* Update snapshot

* Remove console logs

* Fix

Co-authored-by: Fredrik Strand Oseberg <fredrik.no@gmail.com>
Co-authored-by: sjaanus <sellinjaanus@gmail.com>
2022-10-24 20:07:29 +03:00
Nuno Góis
a3bf564100
feat: add SSO mappings to groups (#2175)
* feat: add SSO mappings to groups

* add feature flag to conditionally render

* fix EditGroupUsers

* fix: update snap
2022-10-13 11:34:47 +01:00
sjaanus
c105ca02f1
Change PAT primary key from string to number (#2163)
* Update primary key

* Fix tests
2022-10-10 13:35:12 +03:00
andreas-unleash
bd9172b7a0
Update public signup migration files (#2120)
Update
2022-09-30 15:20:24 +03:00
Tymoteusz Czech
47152cf05b
Feat/invite user (#2061)
* refactor: user creation screen cleanup

* feat: deprecation notice for google sso

* fix: docs openid typo

* invite link bar

* invite link page

* fix prettier docs

* regenerated openapi

* hooks for invite page api

* update openapi

* feat: invite link update

* feat: add public signup token soft-delete

* public signup frontend feature flag

* fix: new user api issues

* feat: allow for creating new user from invite link

* Feat/invite user public controller (#2106)

* added PublicInviteController for public urls

* added PublicInviteController for public urls

* added PublicInviteController for public urls

* added PublicInviteController for public urls

* fix test

* fix test

* update openapi

* refactor: password reset props

* fix: public invite schema and validation

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

* user invite frontend

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

* invite link delete confirmation dialog

* refactor: password reset action

* fix: new user invite loading state

* fix: run ts check with ci

* revert openapi changes

* fix: invite token api interface

* fix: openapi schema index

* fix: update test snapshots

* update frontend snapshot

* fix: prettier ci

* fix: updates after review

Co-authored-by: andreas-unleash <104830839+andreas-unleash@users.noreply.github.com>
Co-authored-by: Fredrik Strand Oseberg <fredrik.no@gmail.com>
2022-09-30 13:01:32 +02:00
sjaanus
2a54ace005
Add description to PAT (#2090)
* Add description to PAT

* Add tests
2022-09-26 15:42:39 +03:00
andreas-unleash
aa589b5ff5
Fix/oas response (#2068)
* bug fix

* bug fix

* remove doc file

* store fixes

* bug fix

* rollback deleted file

* fix test

* add url to token

* return all tokens not just active

* add url fix

* PR comment

* PR comment

* PR comment

* add the flag to the experimental options

* fix env var name
2022-09-26 13:06:30 +03:00
sjaanus
1cf42d6527
Personal access tokens backend (#2064)
* First version ready

* Final

* Refactor

* Update pat store

* Website revert

* Website revert

* Update

* Revert website

* Revert docs to main

* Revert docs to main

* Fix eslint

* Test

* Fix table name
2022-09-16 10:54:27 +03:00
andreas-unleash
6778d347cd
PublicSignupTokens (#2053)
* PublicSignupTokens

* bug fix

* bug fixes and test

* bug fixes and test

* bug fixes and test

* Add feature flag

* tests

* tests

* Update 20220908093515-add-public-signup-tokens.js

Bug Fix

* task: use swc instead of ts-jest (#2042)

* Add a counter for total number of environments (#1964)

* add groupId to gradual rollout template (#2045)

* add groupId to gradual rollout template

* FMT

* Improve tabs UI on smaller devices (#2014)

* Improve tabs UI on smaller devices

* Improve tabs UI on smaller devices

* bug fix

* add proper scrollable tabs

* removed centered from Tabs (conflicts with scrollable)

* PR comments

* 4.15.0-beta.10

* Fix broken doc links (#2046)

## What

This PR fixes some broken links that have been hanging around in the
docs for what seems like a very long time.

## Why

As discovered by the link check in #1912, there are a fair few broken
links in the docs. Everyone hates broken links because it makes it
harder to understand what they were supposed to be pointing at.

## How

There are 3 types of links that have been fixed:
- Links that should have been internal but were absolute. E.g.
  `https://docs.getunleash.io/path/article` that should have been
  `./article.md`
- External links that have changed, such as Slack's API description
- GitHub links to files that either no longer exist or that have been
  moved. These links generally pointed to `master`/`main`, meaning
  they are subject to change. They have been replaced with permalinks
  pointing to specific commits.

-----

* docs: fix slack api doc link

* docs: update links in migration guide

* docs: fix broken link to ancient feature schema validation

* docs: update links to v3 auth hooks

* docs: update broken link in the go sdk article

* Fix: use permalink for GitHub link

* docs: fix wrong google auth link

* 4.15.0

* 4.15.1

* docs: update link for symfony sdk (#2048)



The doc link appears to have pointed at an address that is no longer reachable. Instead, let's point to the equivalent GitHub link

Relates to and closes #2047

* docs: test broken links in website (#1912)

The action triggers manually as a first step to test this functionality. In the near future, we might schedule it

* Schedule link checker action (#2050)

Runs at 12:30 UTC on Mon, Tue, Wed, Thu and Fri

* fix: add env and project labels to feature updated metrics. (#2043)

* Revert workflow (#2051)

* update snapshot

* PR comments

* Added Events and tests

* Throw error if token not found

Co-authored-by: Christopher Kolstad <chriswk@getunleash.ai>
Co-authored-by: Thomas Heartman <thomas@getunleash.ai>
Co-authored-by: Gastón Fournier <gaston@getunleash.ai>
Co-authored-by: Ivar Conradi Østhus <ivarconr@gmail.com>
Co-authored-by: sjaanus <sellinjaanus@gmail.com>
2022-09-14 15:29:12 +03:00
Fredrik Strand Oseberg
874d8459ce
Feat/add alias to api tokens (#1931)
* refactor: remove unused API definition routes

* feat: embed proxy endpoints

* feat: check token metadata for alias if none is found

* fix: rename param

* feat: add test for retrieving token by alias

* fix: update schema

* fix: refactor to alias

* fix: refactor to null

* fix: update snapshot

* fix: update openapi snapshot

* fix: add check to getUserForToken

* refactor: add more token alias tests

* refactor: use timingSafeEqual for token comparisons

Co-authored-by: olav <mail@olav.io>
2022-08-19 10:48:33 +02:00
Tymoteusz Czech
45c6464587
Migration for API key metadata (#1930)
* feat: add metadata to api_keys

* fix: default to empty object for metadata

Co-authored-by: Fredrik Oseberg <fredrik.no@gmail.com>
2022-08-16 16:38:20 +02:00
Simon Hornby
38e428dacf
Fix/remove group owner concept (#1905)
* fix: remove group user role
2022-08-11 08:23:08 +02:00
sjaanus
59b8a06968
Deleting project does not delete entry group_role table (#1896)
* Add constraint for project

* Add constraint for project

* Add constraint for project

* Add constraint for project

* Add constraint for project

* Revert eslint

* Fix eslint

* Fix tests
2022-08-10 07:45:59 +00:00
sighphyre
5806b6748f
Feat/grouping (#1845)
* Implement user grouping feature for permissions

Co-authored-by: Thomas Heartman <thomas@getunleash.ai>
Co-authored-by: Jaanus Sellin <sellinjaanus@gmail.com>
Co-authored-by: Nuno Góis <github@nunogois.com>
Co-authored-by: Thomas Heartman <thomas@getunleash.ai>
2022-07-21 16:23:56 +02:00
Christopher Kolstad
e3c9eaae3a
feat: support filtering on project and environment fields for events (#1801)
* feat: support filtering on project and environment fields for events

Co-authored-by: Nuno Góis <github@nunogois.com>
2022-07-12 12:13:25 +00:00
sellinjaanus
04fb065df4
Added missing archivedAt to featureSchema (#1779)
* Added missing archivedAt to featureSchema

* Added archivedAt to feature toggle.
Added archived_at to db

* Add test

* Add test

* Bug fix

* Bug fix

* update archivedAt to date-time

* Code refactoring done

* Conver to static and remove unused methods

* Add tests

* Fixes

* Fix

* Removed docker file from linting

* Fix segment test

* Fix failing test

* Make fixes

Co-authored-by: andreas-unleash <andreas@getunleash.ai>
Co-authored-by: andreas-unleash <104830839+andreas-unleash@users.noreply.github.com>
2022-07-01 11:51:26 +00:00
olav
2c5f70d420
refactor: drop permissions table on down migration (#1699) 2022-06-13 09:08:46 +02:00
Dennis Szczepanski
7ead887147
fix: Issue #1444 - API import with drop=true deletes existing client keys (#1668)
* fix: Does not delete api_tokens on drop-Import

* feat: Cleans unused apiTokens on environment import

* refactor: Moves ALL_PROJECTS and ALL_ENVIRONMENTS to constants

* refactor: Renames migration 20220528143630 for a more precise name

* refactor: Removes unecessary console.log

* fix: Adds correct down-script for migration 20220528143630
2022-06-09 15:56:13 +01:00
Ivar Conradi Østhus
7250a0574c
fix: correct patch for feature project id 2022-05-11 14:52:38 +02:00
sighphyre
37fa254ceb
fix: Repair feature strategies with broken project ids (#1593) 2022-05-11 13:41:35 +02:00
olav
d0724afdf5
feat: add READ_API_TOKEN permission (#1528)
* refactor: extract accessibleTokens fn

* feat: add READ_API_TOKEN permission
2022-04-26 10:24:34 +02:00
olav
e38f7cf7c2
feat: add context value descriptions (#1496)
* feat: add context value descriptions

* refactor: upcase SQL keywords

* refactor: allow blank descriptions
2022-04-19 08:40:07 +02:00
sighphyre
c9b44b6546
Merge pull request #1476 from Unleash/feat/multi-project-tokens
feat: Implement multi token support for client tokens
2022-04-08 11:51:31 +02:00
Christopher Kolstad
608d870851
fix: remove duplicate foreign key (#1491) 2022-04-08 10:34:22 +02:00
Nuno Góis
794327f8e0
fix: reject duplicate segment names (#1475)
* fix: reject duplicate segment names

* refactor: remove unnecessary comment

* refactor: improve validateName logic with existsByName

* fix: removed unused NotFoundError import
2022-04-06 14:01:50 +01:00
sighphyre
e889d8e29c feat: Implement multi token support for client tokens
This adds support for multi project tokens to be created. Backward compatibility is handled at 3 different layers here:

- The API is made backwards compatible though a permissive data type that accepts either a project?: string or projects?: string[] property, validation is done through JOI here, which ensures that projects and project are not set together. In the case of neither, this defaults to the previous default of ALL_PROJECTS
- The service layer method to handle adding tokens has been made tolerant to either of the above case and has been deprecated, a new method supporting only the new structure of using projects has been added
- Existing compatibility for consumers of Unleash as a library should not be affected either, the ApiUser constructor is now tolerant to the the first input and will internally map to the new cleaned structure
2022-04-06 08:11:41 +02:00
olav
66d9d7a6d2
feat: add segments (#1426)
* refactor: fix missing tsconfig path in .eslintrc

* refactor: require contextName and operator

* refactor: fix crash on missing feature strategies

* feat: add segments schema

* feat: add segments client API

* feat: add segments permissions

* refactor: fail migration if things exist

* refactor: remove strategy IDs from responses

* refactor: allow empty description

* refactor: add segment import/export

* refactor: add perf scripts

* refactor: add get segment fn

* refactor: move constraint validation endpoint

* refactor: use a separate id for segment updates

* refactor: use PERF_AUTH_KEY for artillery

* refactor: adjust segment seed size

* refactor: add missing event data await

* refactor: improve method order

* refactor: remove request body limit override
2022-03-29 14:59:14 +02:00
Fredrik Strand Oseberg
6f075e4d1c
Feat/new constraint operators (#1397)
* feat: add migration for currentTime context field

* feat: add tests for number validator

* feat: add validation fields for constraint

* feat: add validation for semver, date and legalvalues

* fix: import paths

* fix: only allow specified operators

* fix: add operator test

* fix: reset db

* fix: remove unused import

* fix: set semver as dependency
2022-03-04 17:29:42 +01:00
Ivar Conradi Østhus
2d4727d25d fix: remove project column from roles if exists 2022-02-24 14:08:41 +01:00
Ivar Conradi Østhus
48e09dbc2a fix: add migration patch
This patch will fix issues introduced in Unleash v3.13.0. It only
affects users trying to upgrade from v3 to v4 and has been using
v3.13.0 which contained an incorrect migration file.
2022-02-24 14:08:41 +01:00
Fredrik Strand Oseberg
6520aa1b0c
Feat/impression data (#1310)
* feat: add impression data column

* fix: add default value to impressionData

* fix: allow client api to return impressionData

* fix: add tests for impressionData

* fix: reset server-dev

* fix: add test for adding a toggle with impression data on a different project

* fix: update tests
2022-02-03 11:06:51 +01:00
Fredrik Strand Oseberg
d2b4eef8ba
fix: set migration for feedbacK (#1315) 2022-01-31 09:57:33 +01:00
Ivar Conradi Østhus
19cb991cc9
fix: metric counters should use bigint (#1313) 2022-01-31 08:50:11 +01:00
Ivar Conradi Østhus
b8399abee0
fix: add migration for old feature events (#1300)
When we change the feature events we introduced a new column
on the events table to ease resolving of feature related events,
instead of knowing the types and require the data object to include
a name property. This commit adds a migration to make sure we
convert all feature events.

fixes: #1299
2022-01-26 13:39:59 +01:00
Youssef Khedher
b9d8c549e8
Merge pull request #1244 from Unleash/feat/update-toggle-type-description
feat: update feature types description
2022-01-21 09:05:21 +01:00
Youssef
f8c40d1137 refactor: create migration to update feature types description 2022-01-19 19:54:49 +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
Youssef
0d6c440c69 feat: update feature types description 2022-01-07 11:25:10 +01:00