diff --git a/modules/lib/lib-auth/src/main/java/com/enonic/xp/lib/auth/CreateRoleHandler.java b/modules/lib/lib-auth/src/main/java/com/enonic/xp/lib/auth/CreateRoleHandler.java index 6ec48c2dade..839951e5fcd 100644 --- a/modules/lib/lib-auth/src/main/java/com/enonic/xp/lib/auth/CreateRoleHandler.java +++ b/modules/lib/lib-auth/src/main/java/com/enonic/xp/lib/auth/CreateRoleHandler.java @@ -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 ); diff --git a/modules/lib/lib-auth/src/main/java/com/enonic/xp/lib/auth/CreateUserHandler.java b/modules/lib/lib-auth/src/main/java/com/enonic/xp/lib/auth/CreateUserHandler.java index 75509ac35b5..da2ab72ec88 100644 --- a/modules/lib/lib-auth/src/main/java/com/enonic/xp/lib/auth/CreateUserHandler.java +++ b/modules/lib/lib-auth/src/main/java/com/enonic/xp/lib/auth/CreateUserHandler.java @@ -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 ); }