Use useInstanceOperationPermission for the Active switch once #2104 lands

Aperta
#2,110 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
57/100
Tipo di issue
Refactoring
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
typescript

Direzione di ricerca

Read src/hooks/usePermissions.ts, src/hooks/useInstanceOperationPermission.ts, and the Edit User modal that uses the Active switch. After #2104 and #2108 land, compare both hooks for alter_user, including while the instance version loads. Switch the modal to the version-aware hook and remove the specialized hook; done when the permission answers match across those states and the Active switch uses the generic hook.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Problem

#2108 adds useInstanceAlterUserPermission to src/hooks/usePermissions.ts. It gates the Edit User modal's Active switch on checkSuperUserOperationAllowed(permission, 'alter_user').

Open #2104 adds a generic, version-aware useInstanceOperationPermission(operation) in src/hooks/useInstanceOperationPermission.ts. Once both are merged, Studio has two ways to ask whether the signed-in user can run an operation.

Suggested fix

After both land, switch the modal to useInstanceOperationPermission('alter_user') and remove useInstanceAlterUserPermission. Both read useInstanceAuth().user.role.permission. Check that the version-aware answer matches for alter_user, including while the instance version is still loading, which #2104's hook treats as not allowed.

Review-Deferral: 6946a86b33ff7de3 severity=nit category=maintainability

🤖 Generated by Claude Code (Claude Opus 5.5); posted via @dawsontoth.

Lingua principale
TypeScript
Stelle
5
Fork
4
Merge medio
2g 13h
PR unite (30g)
60

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di HarperFast/studio

Tutte le issue di HarperFast/studio

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.