Skip to content
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

[APPS-3152] fix for mnt-24137 #3102

Merged
merged 2 commits into from
Dec 24, 2024
Merged

Conversation

SathishK-T
Copy link
Contributor

@SathishK-T SathishK-T commented Dec 18, 2024

https://hyland.atlassian.net/browse/APPS-3129

This issue is happening when appNamePair shortvalue is generated with stringlowercase irrespective of caseSensitive flag, but as per the scenario the appName in audit application is differed by case (Upper vs Lower).

When its try to get appNamePair for appName its not matching value and its returning null from convertFromRestAuditQueryParameters(parameters) in getAuditEntriesCountByAppAndProperties method in AuditDAOImpl class.

So instead of getting auditEntries by the appKey we are now getting auditEntries by appName it will resolve the issue. Same approch already was there in getAuditEntry method in AuditImpl class.

Tested Scenarios:

  1. name="TESTPermissionAudit" key="testpermissionaudit"
  2. name="testpermissionaudit" key="testpermissionaudit"
  3. name="testpermissionaudit" key="test"
  4. name="test" key="testpermissionaudit"

We can’t use same AppName or AppKey for multiple applications which is already validated.
If we use same AppName or AppKey for multiple applications we are getting exception like org.alfresco.repo.audit.model.AuditModelException: 11200000 Audit application key 'testpermissionaudit' is used by: AuditApplication[ name=TESTPermissionaudit, id=3, disabledPathsId=4]

@SathishK-T SathishK-T marked this pull request as ready for review December 19, 2024 13:59
Copy link
Contributor

@purusothaman-mm purusothaman-mm left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@code4uuuu code4uuuu left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Contributor

@kavitshah-gl kavitshah-gl left a comment

Choose a reason for hiding this comment

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

Code seems to be okay considering the test that it pass.

@@ -913,7 +913,7 @@ public int getAuditEntriesCountByAppAndProperties(AuditService.AuditApplication
final String applicationName = auditApplication.getKey().substring(1);
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we can change this line to:

final String applicationName = auditApplication.getName();

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changes are done as per the comment.

@@ -913,7 +913,7 @@ public int getAuditEntriesCountByAppAndProperties(AuditService.AuditApplication
final String applicationName = auditApplication.getKey().substring(1);

AuditQueryParameters parameters = new AuditQueryParameters();
parameters.setApplicationName(applicationName);
parameters.setApplicationName(auditApplication.getName());
Copy link
Contributor

Choose a reason for hiding this comment

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

Following the previous suggestion, we could supply the applicationName variable again here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changes are done as per the comment.

@tiagosalvado10
Copy link
Contributor

I have added two suggestions in order to avoid having two different logic for the application name inside the same method.

@SathishK-T SathishK-T merged commit 9d704df into master Dec 24, 2024
89 checks passed
@SathishK-T SathishK-T deleted the fix/APPS-3152-fix-for-mnt-24137 branch December 24, 2024 11:05
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.

7 participants