[OpenNMS/opennms] 03147e: NMS-20106: versioned user management API and Prime...

joseanesONMS via opennms-cvs <[email protected]> Thu, 30 Jul 2026 13:47:38 -0700
Newsgroups gmane.network.opennms.cvs
Message-ID <OpenNMS/opennms/push/refs/heads/jira/NMS-20106-manage-users-primevue/[email protected]>
  Branch: refs/heads/jira/NMS-20106-manage-users-primevue
  Home:   https://github.com/OpenNMS/opennms
  Commit: 03147ef25c1f0464e3bd41b288f3446e268c91f3
      https://github.com/OpenNMS/opennms/commit/03147ef25c1f0464e3bd41b288f3446e268c91f3
  Author: Jose Anes <[email protected]>
  Date:   2026-07-30 (Thu, 30 Jul 2026)

  Changed paths:
    A opennms-webapp-rest/src/main/java/org/opennms/web/rest/v2/UsersRestService.java
    A opennms-webapp-rest/src/main/java/org/opennms/web/rest/v2/api/UsersRestApi.java
    A opennms-webapp-rest/src/main/java/org/opennms/web/rest/v2/model/UserDto.java
    A opennms-webapp-rest/src/main/java/org/opennms/web/rest/v2/model/UserPasswordRequest.java
    A opennms-webapp-rest/src/main/java/org/opennms/web/rest/v2/model/UserRenameRequest.java
    A opennms-webapp-rest/src/main/java/org/opennms/web/rest/v2/model/UserWriteRequest.java
    M opennms-webapp-rest/src/main/webapp/WEB-INF/menu/menu-template.json
    M opennms-webapp/src/main/webapp/WEB-INF/applicationContext-spring-security.xml
    A ui/src/components/ManageUsers/UserEditorDialog.vue
    A ui/src/components/ManageUsers/UserPasswordDialog.vue
    A ui/src/components/ManageUsers/UserRenameDialog.vue
    A ui/src/components/ManageUsers/UsersTable.vue
    A ui/src/containers/ManageUsers.vue
    M ui/src/main/router/index.ts
    M ui/src/services/index.ts
    A ui/src/services/userAdminService.ts
    A ui/src/stores/userAdminStore.ts
    A ui/src/types/userAdmin.ts
    A ui/tests/stores/userAdminStore.test.ts

  Log Message:
  -----------
  NMS-20106: versioned user management API and PrimeVue Manage Users page

Adds /api/v2/users (interface + impl following the v2 conventions):
list/get/create/update, dedicated password and rename endpoints, delete,
and available-roles — all admin-only via new Spring Security rules plus
in-code checks. users.xml stays the system of record: updates apply only
the exposed fields, so contact types the API does not carry (XMPP among
them) and the password survive untouched, and passwords are stored
salted via the existing UserManager hashing. Unlike the legacy JSPs,
which only hid the buttons, the admin/rtc delete and rename protections
are enforced server-side; responses never include the password hash
(the v1 API returns it to admins).

The new Manage Users page (ui/#/admin/users) is a straight visualization
of that API: users table without the XMPP column, add/edit dialog with
role assignment, password and rename dialogs, and delete disabled for
the protected system accounts. The Manage Users menu entry now points at
the new page.


  Commit: e66968079a834904007077ab53afc7e78e041021
      https://github.com/OpenNMS/opennms/commit/e66968079a834904007077ab53afc7e78e041021
  Author: Jose Anes <[email protected]>
  Date:   2026-07-30 (Thu, 30 Jul 2026)

  Changed paths:
    M opennms-webapp-rest/src/main/java/org/opennms/web/rest/v2/UsersRestService.java
    M opennms-webapp-rest/src/main/java/org/opennms/web/rest/v2/model/UserDto.java
    A opennms-webapp-rest/src/test/java/org/opennms/web/rest/v2/UsersRestServiceIT.java
    M opennms-webapp/src/main/webapp/WEB-INF/applicationContext-spring-security.xml
    M ui/src/services/userAdminService.ts
    M ui/src/stores/userAdminStore.ts
    M ui/tests/stores/userAdminStore.test.ts

  Log Message:
  -----------
  NMS-20106: validation, atomic updates, and tests for the users API

Fixes from self-review. The list fields of UserDto now default to null
so a request that omits them genuinely preserves roles and duty
schedules (empty-list defaults made the preservation guards dead code
and a partial update wiped both). Mutations validate the whole request
first and then apply it to a detached copy of the stored user, so a
rejected request can no longer leave partial changes in UserManager's
shared in-memory state; a failed create rolls the phantom map entry
back, and a service-level lock closes the check-then-act races. Duty
schedule validation accepts overnight ranges (legacy wrote MoTu2000-800
and hand-edited files contain them — rejecting those made such users
uneditable), user ids reject characters that cannot appear in a URL
path segment, a body/path user-id mismatch is rejected instead of
ignored, and HEAD joins the admin-only security rules. The UI keeps the
previous user list when a refresh fails instead of blanking the table.

The IT grows to 14 tests including regressions for omitted-field
preservation, rejected-update atomicity, and overnight schedules.


  Commit: 57abe653fa816e4e1b56ffa787012985ce2f6a72
      https://github.com/OpenNMS/opennms/commit/57abe653fa816e4e1b56ffa787012985ce2f6a72
  Author: Jose Anes <[email protected]>
  Date:   2026-07-30 (Thu, 30 Jul 2026)

  Changed paths:
    M opennms-webapp-rest/src/main/java/org/opennms/web/rest/v2/UsersRestService.java
    M opennms-webapp-rest/src/test/java/org/opennms/web/rest/v2/UsersRestServiceIT.java
    M ui/src/components/ManageUsers/UserEditorDialog.vue
    A ui/src/components/ManageUsers/UsersHelpPanel.vue
    M ui/src/containers/ManageUsers.vue

  Log Message:
  -----------
  NMS-20106: duty schedule runtime semantics, clearable fields, and help

Follow-up from the group-management review, applying the same findings
here. Duty schedules with begin after end are rejected for new entries
(DutySchedule.isInSchedule compares within one calendar day, so an
overnight range never matches); strings already stored on the record
keep round-tripping so hand-edited files never make a user uneditable.
Dot-segment user ids are rejected. Emptied form fields now clear the
value instead of silently preserving it. The service serializes on the
same shared monitor as the groups API because user mutations cascade
into GroupManager. Adds a collapsed "?" help panel explaining what user
accounts are for and how to use the page.


  Commit: 62be7fd36ff7256271312bc5c83bfa392a350d6b
      https://github.com/OpenNMS/opennms/commit/62be7fd36ff7256271312bc5c83bfa392a350d6b
  Author: Jose Anes <[email protected]>
  Date:   2026-07-30 (Thu, 30 Jul 2026)

  Changed paths:
    M ui/src/components/ManageUsers/UserEditorDialog.vue
    M ui/src/components/ManageUsers/UserPasswordDialog.vue
    M ui/src/components/ManageUsers/UserRenameDialog.vue
    M ui/src/components/ManageUsers/UsersTable.vue
    A ui/src/lib/adminValidation.ts
    M ui/src/services/userAdminService.ts
    M ui/src/stores/userAdminStore.ts
    A ui/tests/components/AdminDialogs/UserEditorDialog.test.ts
    A ui/tests/lib/adminValidation.test.ts
    M ui/tests/stores/userAdminStore.test.ts

  Log Message:
  -----------
  NMS-20106: validate user fields inline and surface API errors in the dialogs

The dialogs previously reported failures only through a toast that renders
behind the modal overlay, so a rejected save looked like nothing happened.
Mutating service calls now return the server's error message, which the
dialogs display inside the form while staying open; new client-side checks
(shared lib/adminValidation.ts) mirror the server rules for user-ids and
flag malformed email addresses before submitting. Users whose ids contain
/ \ or % (possible in hand-edited users.xml) get their row actions replaced
with a file-managed note, since the security filter rejects those characters
in URL paths. Error toasts now use the error styling.


  Commit: fe26ac888bf6ddaf635550bfec84b34f10ed96df
      https://github.com/OpenNMS/opennms/commit/fe26ac888bf6ddaf635550bfec84b34f10ed96df
  Author: Jose Anes <[email protected]>
  Date:   2026-07-30 (Thu, 30 Jul 2026)

  Changed paths:
    M opennms-webapp-rest/src/main/java/org/opennms/web/rest/v2/UsersRestService.java
    M opennms-webapp-rest/src/test/java/org/opennms/web/rest/v2/UsersRestServiceIT.java
    M ui/src/components/ManageUsers/UserEditorDialog.vue
    M ui/src/lib/adminValidation.ts
    M ui/tests/lib/adminValidation.test.ts

  Log Message:
  -----------
  NMS-20106: close review findings on the users API and editor

The markup regexes used full-string matches that a newline anywhere
bypassed; they now scan for the characters directly. The admin account can
no longer have ROLE_ADMIN removed (it would lock every administrator out).
applyDto treats omitted scalar fields as preserve, matching the documented
contract and the sibling APIs, so a roles-only PUT no longer wipes names,
comments and contacts. User comments now reject markup like group comments
do, with unchanged hand-edited values grandfathered. Deleting a user who
supervises an on-call role is rejected, since GroupManager leaves the
supervisor attribute dangling. The client email check accepts display-name
and comma-separated recipient forms and, like the comments check, only
fires on changed input so hand-edited values never block the editor.


Compare: https://github.com/OpenNMS/opennms/compare/03147ef25c1f%5E...fe26ac888bf6

To unsubscribe from these emails, change your notification settings at https://github.com/OpenNMS/opennms/settings/notifications


_______________________________________________
Please read the OpenNMS Mailing List FAQ:
http://www.opennms.org/wiki/index.php?page=MailingListFaq
opennms-cvs mailing list

To *unsubscribe* or change your subscription options, see the bottom of this page:
https://lists.sourceforge.net/lists/listinfo/opennms-cvs