Skip to content
This repository has been archived by the owner on Aug 21, 2024. It is now read-only.

Changes to add client-setting as a scope type for client based settings #9214

Merged
merged 4 commits into from
Nov 9, 2023

Conversation

hanzlamateen
Copy link
Member

@hanzlamateen hanzlamateen commented Nov 6, 2023

Summary

This PR adds client-setting as a scope. The settings button in admin panel can be enabled based on that and so does client settings and client theme on it.

🤖 Generated by Copilot at 1c53084

This pull request adds or updates the scope property for various admin routes and settings to allow for more fine-grained access control based on the user's scopes. It also refactors some code to use shared constants and adds a new migration file for the scope types.

References

closes #insert number here

Explanation

🤖 Generated by Copilot at 1c53084

  • Allow multiple scopes for admin routes and settings (link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link)
  • Change the scope property of the AdminRouteStateType type to accept an array of strings (link)
  • Modify the hasScope variable in adminRoutes.tsx to check for array values and find any matching scope from the user's scopes (link)
  • Add or update the scope property of the setting items in Setting/index.tsx to use array values where needed (link, link, link, link, link, link, link, link, link, link, link, link, link, link)
  • Modify the filter function for the settingItems array in Setting/index.tsx to check for array values and find any matching scope from the user's scopes (link)
  • Change the scope property of the settings route in DefaultAdminRoutes.tsx to use an array value (link, link)
  • Use a constant for the client-setting scope value (link, link, link, link, link, link, link, link)
    • Import the clientSettingPath constant from the client-setting.schema module in Setting/index.tsx, DefaultAdminRoutes.tsx, scope-type.seed.ts, and client-setting.hooks.ts (link, link, link, link)
    • Use the clientSettingPath constant as a scope value for some setting items and routes in Setting/index.tsx and DefaultAdminRoutes.tsx (link, link, link)
    • Create a migration file to add the clientSettingPath:read and clientSettingPath:write scope types to the database in 20231106091534_client-setting-scope-type.ts (link)
    • Use the clientSettingPath constant as a type value for the settings_client:read and settings_client:write scope types in scope-type.seed.ts (link)
    • Use the clientSettingPath constant as a scope value for the verifyScope hook in client-setting.hooks.ts (link)

🤖 Generated by Copilot at 1c53084

Sing, O Muse, of the valiant pull request
That added scope to the settings route
And made it match the clientSettingSchema
With constant values and array support.

QA Steps

List any additional steps required to QA the changes of this PR, as well as any supplemental images or videos.

Checklist

  • If this PR is still a WIP, convert to a draft
  • When this PR is ready, mark it as "Ready for review"
  • ensure all checks pass
  • Changes have been manually QA'd
  • Changes reviewed by at least 2 approved reviewers

@hanzlamateen hanzlamateen marked this pull request as ready for review November 6, 2023 09:33
@barankyle barankyle self-requested a review November 9, 2023 18:30
@barankyle barankyle added this pull request to the merge queue Nov 9, 2023
Merged via the queue into dev with commit 29dc2db Nov 9, 2023
13 checks passed
@barankyle barankyle deleted the client-setting-scope branch November 9, 2023 18:30
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants