-
-
Notifications
You must be signed in to change notification settings - Fork 490
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
metadata history viewing with user profile level #7450
metadata history viewing with user profile level #7450
Conversation
Note: I would expect to also see permissions checks added to the api to ensure that only the people with the correct permissions are able to run the api. |
I cannot find the related API. It was using genera search feature and we cannot block search result. Can you point me which specific backend service we can potentially block? |
@wangf1122 |
Thanks. This seems the right API. But FYI, the 4.0 API is different from 3.12. We will need to resolve the merging issue also need a separated PR to deal with 3.12. Here is the 4.0 API core-geonetwork/services/src/main/java/org/fao/geonet/api/records/MetadataWorkflowApi.java Lines 636 to 640 in b417ead
vs the 3.12 core-geonetwork/services/src/main/java/org/fao/geonet/api/records/MetadataWorkflowApi.java Lines 605 to 609 in 3cda243
The method is renamed from getStatusByType in 3.12 to getWorkflowStatusByType in 4.0 |
services/src/main/java/org/fao/geonet/api/records/MetadataWorkflowApi.java
Outdated
Show resolved
Hide resolved
I attempt this. No luck. This config was part of system/metadata. It treated /system path as special path. I also attempt to put such configuration to the system path but the select drop down UI didn't work properly. |
services/src/main/java/org/fao/geonet/api/records/MetadataWorkflowApi.java
Outdated
Show resolved
Hide resolved
…egistered user is allowed to see history
…egistered user is allowed to see history.
…red user level for viewing data.
services/src/main/java/org/fao/geonet/api/records/MetadataWorkflowApi.java
Show resolved
Hide resolved
@@ -704,7 +712,12 @@ public List<MetadataStatusResponse> getWorkflowStatusByType( | |||
if (!CollectionUtils.isEmpty(recordIdentifier)) { | |||
for (Integer recordId : recordIdentifier) { | |||
try { | |||
ApiUtils.canEditRecord(String.valueOf(recordId), request); | |||
if (allowedAccessLevelProfile == Profile.RegisteredUser) { |
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.
With this change, when selecting the RegisteredUser
access level, users will be able to see the history of metadata that they can view, while selecting other values, only the metadata they can edit.
I think at least should be added some explanation in https://github.com/geonetwork/core-geonetwork/pull/7450/files#diff-e312a431007c32b1300d73d63418ba4ef8154f864ce4734d7461822738478ca9R886
Also at the end of this manual page a section describing the feature would be good: https://docs.geonetwork-opensource.org/4.2/administrator-guide/configuring-the-catalog/system-configuration/
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.
I have update both help text, also add the the section in system-configuration.md
@@ -2,3 +2,4 @@ UPDATE Settings SET value='4.4.0' WHERE name='system/platform/version'; | |||
UPDATE Settings SET value='0' WHERE name='system/platform/subVersion'; | |||
|
|||
INSERT INTO Settings (name, value, datatype, position, internal) SELECT distinct 'metadata/batchediting/accesslevel', 'Editor', 0, 12020, 'n' from settings WHERE NOT EXISTS (SELECT name FROM Settings WHERE name = 'metadata/batchediting/accesslevel'); | |||
INSERT INTO Settings (name, value, datatype, position, internal) SELECT distinct 'metadata/history/accesslevel', 'Editor', 0, 12021, 'n' from settings WHERE NOT EXISTS (SELECT name FROM Settings WHERE name = 'metadata/history/accesslevel'); |
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.
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.
I moved the script to v441. I also added update statement to set the name of system/metadata/history/enabled to metadata/history/enabled as you suggested in another comment
return true; | ||
} | ||
return angular.isFunction(this[fnName]) ? this[fnName]() : false; | ||
}, |
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.
Please update the file with prettier formatting.
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.
@@ -5,7 +5,7 @@ INSERT INTO Settings (name, value, datatype, position, internal) VALUES ('system | |||
INSERT INTO Settings (name, value, datatype, position, internal) VALUES ('system/publication/doi/doipassword', '', 0, 194, 'n'); | |||
INSERT INTO Settings (name, value, datatype, position, internal) VALUES ('system/publication/doi/doikey', '', 0, 195, 'n'); | |||
INSERT INTO Settings (name, value, datatype, position, internal) VALUES ('system/publication/doi/doilandingpagetemplate', 'http://localhost:8080/geonetwork/srv/resources/records/{{uuid}}', 0, 195, 'n'); | |||
INSERT INTO Settings (name, value, datatype, position, internal) VALUES ('system/metadata/history/enabled', 'false', 2, 9171, 'n'); | |||
INSERT INTO Settings (name, value, datatype, position, internal) VALUES ('metadata/history/enabled', 'false', 2, 9171, 'n'); |
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.
This change is not required, would be done in the 4.4.2 migration.
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.
I have removed the change. The update itself will be part of 442 script
profile !== "" | ||
? "is" + profile[0].toUpperCase() + profile.substring(1) + "OrMore" | ||
: ""; | ||
if (profile === "RegisteredUser") { |
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.
Is this check required because there is no RegisteredUserOrMore
function defined I guess?
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.
There is no RegisteredUserOrMore function and this is why I am adding this condition. There is a case when the user is totally not logged in, like the was access by some random internet visitor
6e08271
to
9aa3b6e
Compare
…el' into main.metadata.history.access.level # Conflicts: # web/src/main/webapp/WEB-INF/classes/setup/sql/migrate/v443/migrate-default.sql
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.
@wangf1122 Tested, looks ok.
Please check the to update the setting name in https://github.com/wangf1122/core-geonetwork/blob/a499d1eb57a0f4a0a6596ae91ccecbefe0e0ee9b/web-ui/src/main/resources/catalog/components/search/mdview/mdviewModule.js#L108
Also resolve the conflicts and move the SQL migration to 4.4.4.
I have made the change, thanks for pointing it out |
The backport to
stderr
stdout
To backport manually, run these commands in your terminal: # Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-3.12.x 3.12.x
# Navigate to the new working tree
cd .worktrees/backport-3.12.x
# Create a new branch
git switch --create backport-7450-to-3.12.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick ba0888f64271446814ae26ba5f1880b385ccb431,b7f7b3ee21916d01240bf776d14651159d778e0f,fd48d9fef40bc3f8a265c3808fad09d526bb29bd,9b4b3f6501514f04eb6f329b4df67efac356c296,7c2d18419ec384d6cf41d8fe0b3b7bc65ee26000,9e9d09a33ed4a27eddd7421c7623bb81ad8de37f,4c224296468b0cac9a3e5148197af8fcc4e40977,7709646684d747208b7c940ff3c4c9721f5f0bc2,ac9d91ce1e66bdf9f1777c393d803a1026a97e29,c294463be98578e97b39a44abafd77f803217cd6,8d13b8eaa985bcb8ec58c75dde58be95c42bf290,0dcfcab998a0224e698da7773aa99fe32d555409,deaf064c56842a9ab99101b1eaafe2c61d8e720b,4f16b91e014fe8321e3eb6269687b8036b7a7d31,e2e76ffb5361d397c0b9a384e25e24c0274135d7,7974efa28df068f6aaf2a12afb8b3d6aeb54b585,80eddabf769ab2bc6c36fc0c789f540af517386d,f4ee0866392797b07133da680ea429182dd250ad,d908561e2f3b64f6b79122a96fc975ef621bd218,3d172b855cbd502ffc3e5530cd1304583cb42e2f,9aa3b6edd097ee919b0e42fa4b633564235fddcc,62dfa16821c1d0b30dbaec76d41bb2e547a65e36,f2a5ffa67faad40475c3173db0e67cfd35c3e51b,9ac4bcfcfa96aa96531e6d27589163ec7b5cc182,38e31a5b458d380b722750a8922420e7c0ffe70b,a499d1eb57a0f4a0a6596ae91ccecbefe0e0ee9b,87e2637eb0a6db8397dac72a5a2e6d01cfb73ffe,ead9a51b78f01ddcd0e9a979cfd161b0b8015706,eac2007602a740541218bcf5ea16ec9e72c7ad31,9fa5a4b540d0f2b598be8f2e969fc9e192ce9982
# Push it to GitHub
git push --set-upstream origin backport-7450-to-3.12.x
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-3.12.x Then, create a pull request where the |
The backport to
stderr
stdout
To backport manually, run these commands in your terminal: # Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-4.2.x 4.2.x
# Navigate to the new working tree
cd .worktrees/backport-4.2.x
# Create a new branch
git switch --create backport-7450-to-4.2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick ba0888f64271446814ae26ba5f1880b385ccb431,b7f7b3ee21916d01240bf776d14651159d778e0f,fd48d9fef40bc3f8a265c3808fad09d526bb29bd,9b4b3f6501514f04eb6f329b4df67efac356c296,7c2d18419ec384d6cf41d8fe0b3b7bc65ee26000,9e9d09a33ed4a27eddd7421c7623bb81ad8de37f,4c224296468b0cac9a3e5148197af8fcc4e40977,7709646684d747208b7c940ff3c4c9721f5f0bc2,ac9d91ce1e66bdf9f1777c393d803a1026a97e29,c294463be98578e97b39a44abafd77f803217cd6,8d13b8eaa985bcb8ec58c75dde58be95c42bf290,0dcfcab998a0224e698da7773aa99fe32d555409,deaf064c56842a9ab99101b1eaafe2c61d8e720b,4f16b91e014fe8321e3eb6269687b8036b7a7d31,e2e76ffb5361d397c0b9a384e25e24c0274135d7,7974efa28df068f6aaf2a12afb8b3d6aeb54b585,80eddabf769ab2bc6c36fc0c789f540af517386d,f4ee0866392797b07133da680ea429182dd250ad,d908561e2f3b64f6b79122a96fc975ef621bd218,3d172b855cbd502ffc3e5530cd1304583cb42e2f,9aa3b6edd097ee919b0e42fa4b633564235fddcc,62dfa16821c1d0b30dbaec76d41bb2e547a65e36,f2a5ffa67faad40475c3173db0e67cfd35c3e51b,9ac4bcfcfa96aa96531e6d27589163ec7b5cc182,38e31a5b458d380b722750a8922420e7c0ffe70b,a499d1eb57a0f4a0a6596ae91ccecbefe0e0ee9b,87e2637eb0a6db8397dac72a5a2e6d01cfb73ffe,ead9a51b78f01ddcd0e9a979cfd161b0b8015706,eac2007602a740541218bcf5ea16ec9e72c7ad31,9fa5a4b540d0f2b598be8f2e969fc9e192ce9982
# Push it to GitHub
git push --set-upstream origin backport-7450-to-4.2.x
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-4.2.x Then, create a pull request where the |
Allow metadata history viewing with user profile level Co-authored-by: Jose García <[email protected]>
Allow metadata history viewing with user profile level Co-authored-by: wangf1122 <[email protected]> Co-authored-by: Jose García <[email protected]>
This PR will add such configuration to restrict user profile level to see the record history. The default is set to Editor level which was the old default level. But the feature itself gives more control to the system admin to allow certain level of user to see the history.
On the setting page:
Please note this feature will need 3.12.x backporting. The UI html is different in 3.12.x
core-geonetwork/web-ui/src/main/resources/catalog/views/default/templates/recordView.html
Lines 691 to 693 in 1105846
There will be another small pull request for 3.12 after this one merged.