Skip to content

Fix history is not updated when removing all privileges#9269

Merged
josegar74 merged 2 commits into
geonetwork:mainfrom
tylerjmchugh:fix-setting-no-privileges-does-not-update-history
May 9, 2026
Merged

Fix history is not updated when removing all privileges#9269
josegar74 merged 2 commits into
geonetwork:mainfrom
tylerjmchugh:fix-setting-no-privileges-does-not-update-history

Conversation

@tylerjmchugh
Copy link
Copy Markdown
Contributor

Currently when removing all the privileges of a record, the event is not emitted so nothing is saved in the history.

All privilege changes should be logged in the history so we can track why a record may be no longer visible.

This PR aims to fix this issue by updating the "none selected" path so the event is emitted. Then we will see the privilege in the history.

Checklist

  • I have read the contribution guidelines
  • Pull request provided for main branch, backports managed with label
  • Good housekeeping of code, cleaning up comments, tests, and documentation
  • Clean commit history broken into understandable chucks, avoiding big commits with hundreds of files, cautious of reformatting and whitespace changes
  • Clean commit messages, longer verbose messages are encouraged
  • API Changes are identified in commit messages
  • Testing provided for features or enhancements using automatic tests
  • User documentation provided for new features or enhancements in manual
  • Build documentation provided for development instructions in README.md files
  • Library management using pom.xml dependency management. Update build documentation with intended library use and library tutorials or documentation

Copy link
Copy Markdown
Contributor

@jodygarnett jodygarnett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is one failing QA check, rerunning to double check.

Thanks for including a test case it makes it much faster to review PRs.

@josegar74
Copy link
Copy Markdown
Member

josegar74 commented May 7, 2026

Please check this test failure:

Error: 8,010 [ERROR] Failures: 
Error: 8,010 [ERROR]   MetadataSharingApiTest.settingPrivilegesToNoneCreatesPrivilegesHistoryStatusEntry:389 expected:<1> but was:<0>
07:59:08,010 [INFO] 
Error: 8,010 [ERROR] Tests run: 278, Failures: 1, Errors: 0, Skipped: 5

@josegar74
Copy link
Copy Markdown
Member

josegar74 commented May 7, 2026

@tylerjmchugh

I have updated locally in the services module:

https://github.com/geonetwork/core-geonetwork/blob/main/services/pom.xml

    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>gn-listeners</artifactId>
      <version>${project.version}</version>
      <scope>test</scope>
    </dependency>

https://github.com/geonetwork/core-geonetwork/blob/main/services/src/test/resources/services-web-test-context.xml

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:mvc="http://www.springframework.org/schema/mvc"
       xmlns:context="http://www.springframework.org/schema/context"
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
       http://www.springframework.org/schema/mvc  http://www.springframework.org/schema/mvc/spring-mvc.xsd http://www.springframework.org/schema/context https://www.springframework.org/schema/context/spring-context.xsd">

  <context:component-scan base-package="org.fao.geonet.listener"/>

And the test works now. Please check these changes and verify that all looks fine.

@tylerjmchugh
Copy link
Copy Markdown
Contributor Author

Thanks @josegar74, that fixed the test

@josegar74 josegar74 added this to the 4.4.11 milestone May 9, 2026
@josegar74 josegar74 merged commit 1cf5b70 into geonetwork:main May 9, 2026
7 checks passed
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.

3 participants