Skip to content

Commit

Permalink
Merge pull request #3972 from dseurotech/fix-npeOnUnknownDomain
Browse files Browse the repository at this point in the history
:fix: avoid npe on unknown domain
  • Loading branch information
Coduz authored Feb 19, 2024
2 parents 60e6b95 + 1f00b46 commit b5f9539
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import org.eclipse.kapua.service.authorization.group.Group;

import javax.inject.Inject;
import java.util.Optional;

public class PermissionMapperImpl implements PermissionMapper {
private final DomainRegistryService domainService;
Expand Down Expand Up @@ -195,7 +196,7 @@ private void checkTargetPermissionIsGroupable(org.eclipse.kapua.service.authoriz
try {
org.eclipse.kapua.service.authorization.domain.Domain domainDefinition = KapuaSecurityUtils.doPrivileged(() -> domainService.findByName(targetPermission.getDomain()));

if (!domainDefinition.getGroupable()) {
if (Optional.ofNullable(domainDefinition).map(d -> !d.getGroupable()).orElse(false)) {
this.setGroupId(null);
}
} catch (Exception e) {
Expand Down

0 comments on commit b5f9539

Please sign in to comment.