Skip to content

Commit

Permalink
CreateRoleParams displayName is optional but throws NPE #10486
Browse files Browse the repository at this point in the history
  • Loading branch information
alansemenov committed Apr 4, 2024
1 parent c80742c commit b2152bc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public PrincipalMapper createRole()
{
final Role role = this.securityService.get().createRole( CreateRoleParams.create().
roleKey( PrincipalKey.ofRole( name ) ).
displayName( this.displayName ).
displayName( this.displayName != null ? this.displayName : this.name ).
description( this.description ).
build() );
return new PrincipalMapper( role );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,12 @@ public void setEmail( final String email )

public PrincipalMapper createUser()
{
final User user = this.securityService.get().createUser(
CreateUserParams.create().displayName( this.displayName ).email( this.email ).login( this.name ).userKey(
PrincipalKey.ofUser( this.idProviderKey, this.name ) ).build() );
final User user = this.securityService.get().createUser( CreateUserParams.create().
displayName( this.displayName != null ? this.displayName : this.name ).
email( this.email ).
login( this.name ).
userKey( PrincipalKey.ofUser( this.idProviderKey, this.name ) ).
build() );
return new PrincipalMapper( user );
}

Expand Down

0 comments on commit b2152bc

Please sign in to comment.