Skip to content

Let "All Assessments" users see every assessment in the queue and search - #151

Merged
summitt merged 3 commits into
mainfrom
assessment-queue-all-access
Oct 1, 2026
Merged

summitt merged 3 commits into
mainfrom
assessment-queue-all-access

Conversation

@summitt

@summitt summitt commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Summary

The per-user Access Level (Admin > Users) offers Only Assessments Owned by User, Team Assessments and All Assessments, but the assessment queue and the app/name search restricted every non-manager to their own assessments regardless. Opening an assessment directly already honoured the level.

  • AssessmentQueries.getAllAssessments() and getAssessmentsByAppDesc() now add the assessor = me clause only for the user-only level, or when the queue asks for onlyMine. Team Assessments is applied by the existing hasTeam() filter; All Assessments sees everything. Managers are unaffected.
  • The queue does not switch such users to the manager view by default. Non-managers on Team or All get an "Only my assessments" checkbox in the filter box, checked by default. Unticking it reloads the queue with onlyMine=false, carried with the other filters and sent to the status poll so rows and report icons agree. Managers and user-only accounts see no checkbox.

Verification

  • AssessmentQueriesAccessLevelTest (MongoDB-backed, 8 cases): queue and search results per access level, with and without onlyMine. Watched the new cases fail before each change.
  • AssessmentQueueScopeTest (4 cases): who gets the checkbox and what the default restriction is.
  • Full free suite: 1037 tests, only the pre-existing EntityUnitTest.testVulnerabilitySection failure.
  • Headless check on the built app with an admin turned into a non-manager assessor and another user's assessment: All and Team default to the checkbox checked and an empty queue, unticking shows the other assessment and the status poll carries onlyMine=false, re-ticking returns to the default; user-only has no checkbox and ignores a forced onlyMine=false; a manager has no checkbox and sees the full queue.

The per-user Access Level (Admin > Users) offers "Only Assessments Owned by
User", "Team Assessments" and "All Assessments", but the assessment queue and
the app/name search still restricted every non-manager to their own
assessments. Opening an assessment directly already honoured the level, so a
user on "All Assessments" could reach work the queue never listed.

getAllAssessments() and getAssessmentsByAppDesc() now add the "assessor = me"
clause only for the user-only level. "Team Assessments" is applied by the
existing hasTeam() filter, and "All Assessments" sees everything, manager or
not. Managers are unaffected.

Adds AssessmentQueriesAccessLevelTest, a MongoDB-backed test covering the
queue and search results for each level.
Non-managers on the Team Assessments or All Assessments access level now get
an "Only my assessments" checkbox in the queue filters, checked by default, so
the queue still opens on their own work and they widen it on purpose instead
of landing on the manager view. Unticking it reloads the queue with
onlyMine=false, carried along with the other filters and the status poll so
the rows and their report icons stay in step. Managers keep the full queue
with no checkbox; user-only accounts have nothing to widen and get none.

AssessmentQueries.getAllAssessments() gains an onlyMine overload; the queue
action and the status servlet decide the scope through
AssessmentQueue.restrictToMine(), covered by AssessmentQueueScopeTest and new
cases in AssessmentQueriesAccessLevelTest.
The banner keyed off the engagement permission, so it appeared for anyone with
that flag even when the queue was limited to their own assessments, and it
would have labelled a non-manager who unticked "Only my assessments" as the
manager view. It now shows only when a manager is viewing the full queue;
widened non-manager queues get the help-text note instead.
@summitt
summitt merged commit 23bc623 into main Oct 1, 2026
4 of 6 checks passed
summitt added a commit that referenced this pull request Nov 23, 2026
…155)

* Let assessors open and update assessments their Access Level covers

Since #151 the queue lists every assessment a user's Access Level allows,
but the assessment pages still only loaded assessments the user was
assigned to. A non-manager opening a teammate's assessment got an empty
page that crashed in Top.jsp (IndexOutOfBounds on the empty risk levels);
the global exception mapping then re-rendered through the half-written
page and Tomcat answered 500 "Stream closed", hiding the real error.

Access now follows the Access Level, so an assessor can take over work a
teammate can't finish:
- "All Assessments" (also the default when none is set) opens and
  updates every assessment;
- "Team Assessments" opens and updates the team's assessments;
- "Only Assessments Owned by User" keeps to the user's own.
Assigned assessors keep access to their own finalized assessments, and
finalized assessments stay read-only. Managers still open any
assessment; a manager who also has the assessor role can now update the
ones their Access Level covers, like any other assessor.

AssessmentQueries gains canOpenAssessment, canEditAssessment and
getAssessmentForUser. The assessment page, notes, history, stats, custom
fields, send-to-peer-review, report upload, vulnerability edits and
checklist edits use them. The checklist edits previously checked nothing
beyond the assessor role.

An assessment the user may not open now gets 403 Access Denied, recorded
in the audit log, instead of a 500.

* Update the section test to match getSection() keeping underscores

#148 made getSection() return the stored key, with underscores, since the
report templates match on it; getSectionPretty() is the display form. The
test still expected spaces and has failed on every branch since.

Signed-off-by: Josh <ascetik@gmail.com>

---------

Signed-off-by: Josh <ascetik@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant