-
-
Notifications
You must be signed in to change notification settings - Fork 996
SAK-50562 Section Info Students can skip date-based access restrictions with URLs #14260
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
WalkthroughAdded null-safe open-date checks and enforcement for student view routing and authorization, replaced a servletPath indexOf check with contains, and updated logging and imports in RoleFilter and EntryServlet. Changes
Suggested reviewers
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
⏰ Context from checks skipped due to timeout of 900000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
Tip 📝 Customizable high-level summaries are now available in beta!You can now customize how CodeRabbit generates the high-level summary in your pull requests — including its content, structure, tone, and formatting.
Example instruction:
Note: This feature is currently in beta for Pro-tier users, and pricing will be announced later. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
sections/sections-app/src/java/org/sakaiproject/tool/section/filter/RoleFilter.java(4 hunks)
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: ottenhoff
Repo: sakaiproject/sakai PR: 0
File: :0-0
Timestamp: 2025-10-07T15:11:27.298Z
Learning: In samigo’s Total Scores view (samigo/samigo-app/src/webapp/jsf/evaluation/totalScores.jsp), mailto links were hidden after commit dee05746 (PR #12312, SAK-49674) added a render check requiring email.fromEmailAddress to be non-empty; PR #14154 (SAK-52058) restores visibility by checking only description.email.
⏰ Context from checks skipped due to timeout of 900000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: maven-build
- GitHub Check: maven-build
- GitHub Check: sakai-deploy
🔇 Additional comments (2)
sections/sections-app/src/java/org/sakaiproject/tool/section/filter/RoleFilter.java (2)
24-24: LGTM! Necessary imports for open-date validation.The additional imports (
Calendar,SectionManager, Spring context classes) are required for the new date-based authorization logic.Also applies to: 35-35, 39-42
81-81: Good refactor for readability.Replacing
indexOf("/") >= 0withcontains("/")is more idiomatic and makes the intent clearer while preserving the same behavior.
sections/sections-app/src/java/org/sakaiproject/tool/section/filter/RoleFilter.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (2)
sections/sections-app/src/java/org/sakaiproject/tool/section/EntryServlet.java (1)
64-78: Date-based student routing looks correct; consider centralizing logic and normalizing log textThe open-date handling here is null-safe and matches the intended semantics (no date ⇒ allow, before open ⇒
/closed.jsf, after open ⇒/studentView.jsf), aligning withRoleFilter’s authorization logic.To reduce future drift, consider extracting this open-date check into a shared helper/service so
EntryServletandRoleFilterdon’t need to duplicate the rules. Also, the debug string"Grupos Cerrados..."is the only non-English text in this block; you may want to switch to English or an i18n message key for consistency with the rest of the tool.sections/sections-app/src/java/org/sakaiproject/tool/section/filter/RoleFilter.java (1)
121-138: Date-based authorization forstudentViewcorrectly enforces access; consider minor cleanup and loggingThe new block under the
viewOwnSectionsbranch:
- Properly treats
open == nullas “no restriction” and authorizes.- Denies access when
now.before(open)and allows otherwise.- Aligns with
EntryServlet’s routing behavior and removes the previous NPE risk aroundnow.before(open)with a nullopen.Two small, non-blocking suggestions:
- You could simplify the inner logic slightly, e.g.
isAuthorized = !now.before(open);, to reduce branching.- Consider adding a specific log message when access is denied due to the open date (vs general authorization failure), which would help distinguish configuration issues from true permission problems in logs.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
sections/sections-app/src/java/org/sakaiproject/tool/section/EntryServlet.java(1 hunks)sections/sections-app/src/java/org/sakaiproject/tool/section/filter/RoleFilter.java(4 hunks)
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: ottenhoff
Repo: sakaiproject/sakai PR: 0
File: :0-0
Timestamp: 2025-10-07T15:11:27.298Z
Learning: In samigo’s Total Scores view (samigo/samigo-app/src/webapp/jsf/evaluation/totalScores.jsp), mailto links were hidden after commit dee05746 (PR #12312, SAK-49674) added a render check requiring email.fromEmailAddress to be non-empty; PR #14154 (SAK-52058) restores visibility by checking only description.email.
🧬 Code graph analysis (1)
sections/sections-app/src/java/org/sakaiproject/tool/section/filter/RoleFilter.java (1)
sections/sections-app/src/java/org/sakaiproject/tool/section/EntryServlet.java (1)
Slf4j(35-95)
⏰ Context from checks skipped due to timeout of 900000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: sakai-deploy
- GitHub Check: maven-build
- GitHub Check: maven-build
🔇 Additional comments (2)
sections/sections-app/src/java/org/sakaiproject/tool/section/filter/RoleFilter.java (2)
23-42: ApplicationContext field and Lombok logger integration look fineStoring
ApplicationContext acat init time and using Lombok’s@Slf4jfor logging is appropriate for a servlet filter and doesn’t introduce threading issues, sinceacis effectively read-only afterinit. No concerns with the added imports.Also applies to: 60-60
81-81:servletPath.contains("/")keeps behavior while improving readabilitySwitching from
servletPath.indexOf("/") >= 0toservletPath.contains("/")after stripping the leading slash preserves the existing behavior (only top-level paths are protected) and is easier to read. No functional issues here.
https://sakaiproject.atlassian.net/browse/SAK-50562
Summary by CodeRabbit
Bug Fixes
Chores
✏️ Tip: You can customize this high-level summary in your review settings.