Merge pull request #161 from dBucik/fix_group

fix: 🐛 Allow Group description to be empty string
pull/1580/head
Dominik František Bučík 2022-03-23 07:08:04 +01:00 committed by GitHub
commit 51c0170582
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 6 deletions

View File

@ -60,8 +60,8 @@ public class Group extends Model {
} }
public void setDescription(String description) { public void setDescription(String description) {
if (Strings.isNullOrEmpty(description)) { if (null == description) {
throw new IllegalArgumentException("description cannot be null nor empty"); throw new IllegalArgumentException("description cannot be null");
} }
this.description = description; this.description = description;

View File

@ -114,7 +114,7 @@ public class RpcMapper {
Long id = getRequiredFieldAsLong(json, ID); Long id = getRequiredFieldAsLong(json, ID);
Long parentGroupId = getFieldAsLong(json, PARENT_GROUP_ID); Long parentGroupId = getFieldAsLong(json, PARENT_GROUP_ID);
String name = getRequiredFieldAsString(json, NAME); String name = getFieldAsString(json, NAME);
String description = getFieldAsString(json, DESCRIPTION); String description = getFieldAsString(json, DESCRIPTION);
Long voId = getRequiredFieldAsLong(json, VO_ID); Long voId = getRequiredFieldAsLong(json, VO_ID);
String uuid = getRequiredFieldAsString(json, UUID); String uuid = getRequiredFieldAsString(json, UUID);

View File

@ -557,15 +557,18 @@ public class PerunAdapterLdap extends PerunAdapterWithMappingServices implements
PERUN_VO_ID, PERUN_PARENT_GROUP_ID, UUID}; PERUN_VO_ID, PERUN_PARENT_GROUP_ID, UUID};
EntryMapper<Group> mapper = e -> { EntryMapper<Group> mapper = e -> {
if (!checkHasAttributes(e, new String[]{ if (!checkHasAttributes(e,
PERUN_GROUP_ID, CN, DESCRIPTION, PERUN_UNIQUE_GROUP_NAME, PERUN_VO_ID, UUID })) new String[]{ PERUN_GROUP_ID, CN, PERUN_UNIQUE_GROUP_NAME, PERUN_VO_ID, UUID }))
{ {
return null; return null;
} }
Long id = Long.valueOf(e.get(PERUN_GROUP_ID).getString()); Long id = Long.valueOf(e.get(PERUN_GROUP_ID).getString());
String name = e.get(CN).getString(); String name = e.get(CN).getString();
String description = e.get(DESCRIPTION).getString(); String description = "";
if (e.containsAttribute(DESCRIPTION)) {
description = e.get(DESCRIPTION).getString();
}
String uniqueName = e.get(PERUN_UNIQUE_GROUP_NAME).getString(); String uniqueName = e.get(PERUN_UNIQUE_GROUP_NAME).getString();
Long voId = Long.valueOf(e.get(PERUN_VO_ID).getString()); Long voId = Long.valueOf(e.get(PERUN_VO_ID).getString());
Long parentGroupId = null; Long parentGroupId = null;