Skip to content

Commit

Permalink
LPS-193573 Allow delete system fields only by allowed bundles
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielwas committed Aug 23, 2023
1 parent 648f326 commit 0b10012
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,9 @@ private ObjectField _toObjectField(
HashMapBuilder.put(
"delete",
() -> {
if (!objectField.isDeletionAllowed()) {
if (!objectField.isDeletionAllowed() ||
objectField.isSystem()) {

return null;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public List<ObjectFieldSetting> getObjectFieldSettings() {

@Override
public boolean isDeletionAllowed() throws PortalException {
if (isSystem() || Validator.isNotNull(getRelationshipType())) {
if (Validator.isNotNull(getRelationshipType())) {
return false;
}

Expand All @@ -62,12 +62,6 @@ public boolean isDeletionAllowed() throws PortalException {
return false;
}

if (objectDefinition.isApproved() && objectDefinition.isModifiable() &&
objectDefinition.isSystem()) {

return false;
}

return true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -983,9 +983,8 @@ else if (!deleteRelationshipObjectField) {
throw new RequiredObjectFieldException();
}

if (FeatureFlagManagerUtil.isEnabled("LPS-190890") &&
objectDefinition.isApproved() && objectDefinition.isModifiable() &&
objectDefinition.isSystem()) {
if (objectField.isSystem() && objectDefinition.isModifiable() &&
!SystemUtil.allowManageSystemEntities()) {

throw new UnsupportedOperationException();
}
Expand Down

0 comments on commit 0b10012

Please sign in to comment.