Use useInstanceOperationPermission for the Active switch once #2104 lands

Đang mở
#2,110 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
57/100
Loại issue
Tái cấu trúc
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
typescript
Lĩnh vực
authentication, frontend

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
TypeScript
Star
5
Fork
4
Merge trung bình
2 ngày 13 giờ
Pull request đã merge (30 ngày)
60

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của HarperFast/studio

Tất cả issue của HarperFast/studio

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.