Skip to content

Commit

Permalink
Column 'defaultUser' in User table was replaced by 'type' in 7.4 U73 …
Browse files Browse the repository at this point in the history
…by LPS-178826
  • Loading branch information
jorgediaz-lr committed May 5, 2023
1 parent 15eac6b commit 2d7f262
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,18 @@ protected static Map<String, Object> readConfiguration(
configurationFileName + CharPool.PERIOD + configurationFileExt);
}

String guestUserFilter;

if (_hasNewUserTypeColumn()) {
guestUserFilter = "type_=1";
}
else {
guestUserFilter = "defaultUser=[$FALSE$]";
}

configuration = configuration.replace(
"$$GUEST_USER_FILTER$$", guestUserFilter);

String journalArticleIndexPrimaryKeyAttribute;

if (getJournalArticleIndexAllVersions()) {
Expand Down Expand Up @@ -347,6 +359,38 @@ private static Object _getModelInfo(String modelName, String key) {
return modelMap.get(key);
}

private static boolean _hasNewUserTypeColumn() {
String version = ReleaseInfo.getVersion();

String[] versionArr = version.split("\\.");

if (!versionArr[0].equals("7") || !versionArr[1].equals("4")) {
return false;
}

long update = Long.MAX_VALUE;

try {
if (versionArr[2].equals("3") && (versionArr.length > 3)) {
update = Long.parseLong(versionArr[3]);
}
else if (versionArr[2].equals("13")) {
String versionDisplayName = ReleaseInfo.getVersionDisplayName();

update = Long.parseLong(versionDisplayName.split(" ")[2]);
}

if (update < 72) {
return false;
}
}
catch (Exception exception) {
_log.error(exception);
}

return true;
}

private static final String _CONFIGURATION_FILE_EXT = "yml";

private static final String _CONFIGURATION_FILE_NAME = "configuration";
Expand Down
2 changes: 1 addition & 1 deletion modules/index-checker/src/main/resources/configuration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ modelInfo: [{
},
{
model: com.liferay.portal.kernel.model.User,
filter: "defaultUser=[$FALSE$]",
filter: "$$GUEST_USER_FILTER$$",
attributesToQuery: [pk,companyId,groupId,modifiedDate,status,organizationId,roleId,teamId,userGroupId],
exactAttributesToCheck: [groupId,"<=modifiedDate",status,organizationId,roleId,teamId,userGroupId,permissionsRoleId,permissionsGroupRoleId,AssetEntries_AssetCategories.categoryId,AssetCategory.title,AssetEntries_AssetTags.tagId,AssetTag.name],
relatedDataToQuery: [
Expand Down

0 comments on commit 2d7f262

Please sign in to comment.