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

refactor scopes for social services #9160

Merged
merged 4 commits into from
Nov 1, 2023
Merged

refactor scopes for social services #9160

merged 4 commits into from
Nov 1, 2023

Conversation

aditya-mitra
Copy link
Collaborator

@aditya-mitra aditya-mitra commented Oct 27, 2023

Summary

🤖 Generated by Copilot at c2de8b5

This pull request improves the scope verification and management for various social services in the server-core package, such as channel, invite, location, and channel-user. It replaces the use of admin scopes with more specific and relevant scopes, such as channel:write or location:write, for better security and flexibility. It also removes some unused or duplicated code, refactors and optimizes some hooks, and adds a new scope type invite:write to the database seed.

References

refs #9161

Explanation

🤖 Generated by Copilot at c2de8b5

  • Add new scope type invite:write to allow users to manage invites (link)
  • channel-user service: use verifyScope('channel', 'write') for create hook (link)
  • channel service: use verifyScope('channel', 'read') for find hook, and verifyScope('channel', 'write') for patch hook (link, link)
  • invite service: use verifyScope('invite', 'read') for find hook, and verifyScope('invite', 'write') for update and patch hooks (link, link)
  • location-admin service: use verifyScope('location', 'write') for create, update, patch, and remove hooks (link)
  • Remove unused imports, constants, and methods from location.class.ts file (link, link, link)
  • Add missing import for Knex and comments for hook sections (link, link, link, link, link, link)
  • Extract makeLobbyHelper function from LocationService class and use it in makeLobbies and makeOldLocationLobby functions (link, link, link)
  • Move getUpdateResult function from after patch hooks to after update hooks (link)
  • Move duplicateNameError function from after patch hooks to error hooks (link, link)

🤖 Generated by Copilot at c2de8b5

We are the masters of the scope
We grant and revoke the power to cope
With channels, locations, and invites
We rule the realm of write

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

@aditya-mitra aditya-mitra marked this pull request as ready for review October 30, 2023 06:34
@barankyle barankyle added this pull request to the merge queue Nov 1, 2023
Merged via the queue into dev with commit fe3ebf7 Nov 1, 2023
12 of 13 checks passed
@barankyle barankyle deleted the refactor/social-scoping branch November 1, 2023 23:29
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