feat: simplify permission model — all logged-in users can edit (#152) - #153
Merged
Conversation
Remove admin/creator permission gating from _checkPermission (backend) and canManageCurrentScheduleSettings (frontend). All logged-in users can now save, delete, copy, and rename schedules. Backend: _checkPermission now only verifies login status (Session.getActiveUser) Frontend: canManageCurrentScheduleSettings only gates ALL_SCHEDULES_ID view UI: adminOnlyMessage updated to reflect the new gate (view mode, not permission) isCurrentUserAdmin preserved for potential future admin-only UI features. IS_ADMIN injection + doGet unchanged. Test updates: - backend.test.js: 5 'rejects unauthorized' → 'allows any logged-in user' - businessLogicEdgeCases.test.js: 12 tests rewritten for simplified model (null/undefined createdBy no longer throws, whitespace emails pass, etc.) All 1142 tests pass. Closes #152 Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> Agend-Agent: cb-team-impl Agend-Task: t-20260624092659656277-40473-24 Agend-Branch: feature/152-simplify-permissions Agend-Issued-At: 2026-06-24T09:27:33.816478+00:00
Owner
Author
✅ VERIFIEDReviewed HEAD: Files Reviewed (5)
Stage 1 — Correctness + Security
Stage 2 — Security Adversarial
Evidence
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Simplify the permission model per #152: all logged-in users can now save, delete, copy, and rename schedules. Removes admin/creator permission gating.
Changes (5 files)
Backend:
程式碼.js_checkPermission: removed admin email comparison and createdBy check. Now only verifies the user is logged in (Session.getActiveUser().getEmail()is not empty)._checkPermissionfor login verification.Frontend:
ScheduleManager.js.htmlcanManageCurrentScheduleSettings: simplified to only gateALL_SCHEDULES_IDview. Returnstruefor any specific schedule.isCurrentUserAdmin: preserved for potential future admin-only UI features.Frontend:
Interaction.js.htmladminOnlyMessage: updated from permission-denied message to view-mode guidance ("在「所有課表」檢視模式下無法使用此功能").Tests:
backend.test.js+businessLogicEdgeCases.test.js_checkPermissionedge case tests rewritten for simplified model:createdByno longer throws (param unused)Preserved (no change)
isCurrentUserAdmin()functionIS_ADMINinjection indoGet/Index.htmlUI.js.htmlVerification
npm test: 1142 tests passed (36 files) ✅Closes #152