-
Notifications
You must be signed in to change notification settings - Fork 126
feat(entitlement): Introduce Feature and Privilege models #3873
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35c71d0
to
93458ab
Compare
7b14c7c
to
77ca90c
Compare
0816050
to
c5147e6
Compare
c5147e6
to
7889631
Compare
jdenquin
reviewed
Jun 30, 2025
7889631
to
c0de389
Compare
c0de389
to
f90da85
Compare
groyoh
approved these changes
Jul 1, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work! I left quite a few comments but it's nothing major.
Co-authored-by: Yohan Robert <7434196+groyoh@users.noreply.github.com>
a6cf265
to
ff928c6
Compare
groyoh
reviewed
Jul 1, 2025
ff928c6
to
deee340
Compare
a7553fe
to
1cf4245
Compare
julienbourdeau
added a commit
that referenced
this pull request
Jul 4, 2025
This PR follows #3873 It adds a way to attach features and privilges to a plan. In serialized plans, you get ```rb "entitlements" => [ { "code" => "seats", "name" => "Seats", "description" => "Nb users", "privileges" => { "max" => { "code" => "max", "name" => nil, "value_type" => "integer", "value" => 100, # <<------- "config" => {} } } } ] ``` **Now, the core is only missing the subscription override.**  ``` Prefix Verb URI Pattern Controller#Action api_v1_plan_entitlement_privilege DELETE /api/v1/plans/:plan_code/entitlements/:entitlement_code/privileges/:code(.:format) api/v1/plans/entitlements/privileges#destroy {code: /.*/, plan_code: /.*/, entitlement_code: /.*/} api_v1_plan_entitlements GET /api/v1/plans/:plan_code/entitlements(.:format) api/v1/plans/entitlements#index {plan_code: /.*/} POST /api/v1/plans/:plan_code/entitlements(.:format) api/v1/plans/entitlements#create {plan_code: /.*/} api_v1_plan_entitlement GET /api/v1/plans/:plan_code/entitlements/:code(.:format) api/v1/plans/entitlements#show {code: /.*/, plan_code: /.*/} PATCH /api/v1/plans/:plan_code/entitlements/:code(.:format) api/v1/plans/entitlements#update {code: /.*/, plan_code: /.*/} PUT /api/v1/plans/:plan_code/entitlements/:code(.:format) api/v1/plans/entitlements#update {code: /.*/, plan_code: /.*/} DELETE /api/v1/plans/:plan_code/entitlements/:code(.:format) api/v1/plans/entitlements#destroy {code: /.*/, plan_code: /.*/} ``` ### Next PR * Dispatch `plan.updated` webhooks * Create and dispatch `feature.*` webhooks
diegocharles
pushed a commit
that referenced
this pull request
Jul 11, 2025
Introduce `Feature` and `Privilege` models, only the left part shown on this chart. Note that everything (most things) are namespaced under `Entitlement::`.  Also adds new endpoints to API to manage features. ``` Prefix Verb URI Pattern Controller#Action api_v1_feature_privilege DELETE /api/v1/features/:feature_code/privileges/:code(.:format) api/v1/features/privileges#destroy {code: /.*/, feature_code: /.*/} api_v1_features GET /api/v1/features(.:format) api/v1/features#index POST /api/v1/features(.:format) api/v1/features#create api_v1_feature GET /api/v1/features/:code(.:format) api/v1/features#show {code: /.*/} PATCH /api/v1/features/:code(.:format) api/v1/features#update {code: /.*/} PUT /api/v1/features/:code(.:format) api/v1/features#update {code: /.*/} DELETE /api/v1/features/:code(.:format) api/v1/features#destroy {code: /.*/} ``` ### Next PR - Add Feature to plan (entitlements) - Add webhooks `feature.*` - Add AuditLogs --------- Co-authored-by: Yohan Robert <7434196+groyoh@users.noreply.github.com>
diegocharles
pushed a commit
that referenced
this pull request
Jul 11, 2025
This PR follows #3873 It adds a way to attach features and privilges to a plan. In serialized plans, you get ```rb "entitlements" => [ { "code" => "seats", "name" => "Seats", "description" => "Nb users", "privileges" => { "max" => { "code" => "max", "name" => nil, "value_type" => "integer", "value" => 100, # <<------- "config" => {} } } } ] ``` **Now, the core is only missing the subscription override.**  ``` Prefix Verb URI Pattern Controller#Action api_v1_plan_entitlement_privilege DELETE /api/v1/plans/:plan_code/entitlements/:entitlement_code/privileges/:code(.:format) api/v1/plans/entitlements/privileges#destroy {code: /.*/, plan_code: /.*/, entitlement_code: /.*/} api_v1_plan_entitlements GET /api/v1/plans/:plan_code/entitlements(.:format) api/v1/plans/entitlements#index {plan_code: /.*/} POST /api/v1/plans/:plan_code/entitlements(.:format) api/v1/plans/entitlements#create {plan_code: /.*/} api_v1_plan_entitlement GET /api/v1/plans/:plan_code/entitlements/:code(.:format) api/v1/plans/entitlements#show {code: /.*/, plan_code: /.*/} PATCH /api/v1/plans/:plan_code/entitlements/:code(.:format) api/v1/plans/entitlements#update {code: /.*/, plan_code: /.*/} PUT /api/v1/plans/:plan_code/entitlements/:code(.:format) api/v1/plans/entitlements#update {code: /.*/, plan_code: /.*/} DELETE /api/v1/plans/:plan_code/entitlements/:code(.:format) api/v1/plans/entitlements#destroy {code: /.*/, plan_code: /.*/} ``` ### Next PR * Dispatch `plan.updated` webhooks * Create and dispatch `feature.*` webhooks
julienbourdeau
added a commit
that referenced
this pull request
Jul 22, 2025
) Allow `config.select_options` to be updated for `select` privilege. I don't know why the config column is nullable in the DB, this is a mistake. Notice that I can simply change the column with "safety_assured" because **the feature is not released and there was no tagged version [since I added this model](#3873
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Introduce
Feature
andPrivilege
models, only the left part shown on this chart.Note that everything (most things) are namespaced under
Entitlement::
.Also adds new endpoints to API to manage features.
Next PRs
feature.*