From 693050aa8c2755aa6533c3a20237df5bd7fa5216 Mon Sep 17 00:00:00 2001 From: Abhishek Sah Date: Thu, 29 Jan 2026 16:04:04 +0530 Subject: [PATCH 1/2] feat(frontier): add scope fields to preference messages Add scope_type and scope_id fields to support org-scoped user preferences: - Preference message: add scope_type (field 6) and scope_id (field 7) - PreferenceRequestBody message: add scope_type (field 4) and scope_id (field 5) - ListCurrentUserPreferencesRequest message: add scope_type (field 1) and scope_id (field 2) These fields enable users to have different preference values per organization context while maintaining backward compatibility with global preferences (empty scope = global). Related: https://github.com/raystack/frontier/issues/1347 Co-Authored-By: Claude Opus 4.5 --- raystack/frontier/v1beta1/frontier.proto | 11 ++++++++++- raystack/frontier/v1beta1/models.proto | 12 ++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/raystack/frontier/v1beta1/frontier.proto b/raystack/frontier/v1beta1/frontier.proto index 675fee1c..1d68bde4 100644 --- a/raystack/frontier/v1beta1/frontier.proto +++ b/raystack/frontier/v1beta1/frontier.proto @@ -4129,7 +4129,16 @@ message CreateCurrentUserPreferencesResponse { repeated Preference preferences = 1; } -message ListCurrentUserPreferencesRequest {} +message ListCurrentUserPreferencesRequest { + // scope_type filters preferences by context type (e.g., "app/organization") + // If empty, returns all user preferences (global + all scoped) + // If set with scope_id, returns global preferences + preferences for the specific scope, + // with trait defaults for any unset preferences + string scope_type = 1; + // scope_id filters preferences by scope identifier (e.g., organization ID) + // Only applicable when scope_type is set + string scope_id = 2; +} message ListCurrentUserPreferencesResponse { repeated Preference preferences = 1; diff --git a/raystack/frontier/v1beta1/models.proto b/raystack/frontier/v1beta1/models.proto index daa7114f..63581d24 100644 --- a/raystack/frontier/v1beta1/models.proto +++ b/raystack/frontier/v1beta1/models.proto @@ -555,6 +555,12 @@ message Preference { string value = 3; string resource_id = 4; string resource_type = 5; + // scope_type defines the context type for scoped preferences (e.g., "app/organization") + // If empty, the preference is global (not scoped to any context) + string scope_type = 6; + // scope_id is the identifier of the scope context (e.g., organization ID) + // Only applicable when scope_type is set + string scope_id = 7; google.protobuf.Timestamp created_at = 10 [(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { description: "The time when the preference was created.", @@ -947,6 +953,12 @@ message PreferenceRequestBody { pattern: "^[A-Za-z0-9-_]+$" }]; string value = 3; + // scope_type defines the context type for scoped preferences (e.g., "app/organization") + // If empty, the preference is global (not scoped to any context) + string scope_type = 4; + // scope_id is the identifier of the scope context (e.g., organization ID) + // Only applicable when scope_type is set + string scope_id = 5; } message CheckoutSubscriptionBody { From 8e929fce087383f6e36736701ed07036ca6e6fa7 Mon Sep 17 00:00:00 2001 From: Abhishek Sah Date: Wed, 4 Feb 2026 15:56:30 +0530 Subject: [PATCH 2/2] feat(frontier): add scope fields to ListUserPreferencesRequest Add scope_type and scope_id fields to ListUserPreferencesRequest to allow filtering user preferences by scope context. Co-Authored-By: Claude Opus 4.5 --- raystack/frontier/v1beta1/frontier.proto | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/raystack/frontier/v1beta1/frontier.proto b/raystack/frontier/v1beta1/frontier.proto index 1d68bde4..e2f26dca 100644 --- a/raystack/frontier/v1beta1/frontier.proto +++ b/raystack/frontier/v1beta1/frontier.proto @@ -4115,6 +4115,14 @@ message CreateUserPreferencesResponse { message ListUserPreferencesRequest { string id = 1 [(validate.rules).string.min_len = 3]; + // scope_type filters preferences by context type (e.g., "app/organization") + // If empty, returns all user preferences (global + all scoped) + // If set with scope_id, returns preferences for the specific scope, + // with trait defaults for any unset preferences + string scope_type = 2; + // scope_id filters preferences by scope identifier (e.g., organization ID) + // Only applicable when scope_type is set + string scope_id = 3; } message ListUserPreferencesResponse {