@@ -202,7 +202,7 @@ private void revokeRole(RoleAssignment ra) {
202202 commandEngine .submit (new RevokeRoleCommand (ra , dvRequestService .getDataverseRequest ()));
203203 JsfHelper .addSuccessMessage (BundleUtil .getStringFromBundle ("permission.roleWasRemoved" , Arrays .asList (ra .getRole ().getName (), roleAssigneeService .getRoleAssignee (ra .getAssigneeIdentifier ()).getDisplayInfo ().getTitle ())));
204204 RoleAssignee assignee = roleAssigneeService .getRoleAssignee (ra .getAssigneeIdentifier ());
205- notifyRoleChange (assignee , UserNotification .Type .REVOKEROLE );
205+ notifyRoleChange (assignee , UserNotification .Type .REVOKEROLE , ra . getRole () );
206206 } catch (PermissionException ex ) {
207207 JH .addMessage (FacesMessage .SEVERITY_ERROR , BundleUtil .getStringFromBundle ("permission.roleNotAbleToBeRemoved" ), BundleUtil .getStringFromBundle ("permission.permissionsMissing" , Arrays .asList (ex .getRequiredPermissions ().toString ())));
208208 } catch (CommandException ex ) {
@@ -525,17 +525,21 @@ public void assignRole(ActionEvent evt) {
525525 * Will notify all members of a group.
526526 * @param ra The {@code RoleAssignee} to be notified.
527527 * @param type The type of notification.
528+ * @param r The {@code DataverseRole} associated with the change
528529 */
529- private void notifyRoleChange (RoleAssignee ra , UserNotification .Type type ) {
530+ private void notifyRoleChange (RoleAssignee ra , UserNotification .Type type , DataverseRole r ) {
531+ String additionalInfo = r != null ? String .format ("{ roleId: %d, roleName: %s }" , r .getId (), r .getName ()) : null ;
530532 if (ra instanceof AuthenticatedUser ) {
531- userNotificationService .sendNotification ((AuthenticatedUser ) ra , new Timestamp (new Date ().getTime ()), type , dvObject .getId ());
533+ userNotificationService .sendNotification ((AuthenticatedUser ) ra , new Timestamp (new Date ().getTime ()), type ,
534+ dvObject .getId (), null , null , false , additionalInfo );
532535 } else if (ra instanceof ExplicitGroup ) {
533536 ExplicitGroup eg = (ExplicitGroup ) ra ;
534537 Set <String > explicitGroupMembers = eg .getContainedRoleAssgineeIdentifiers ();
535538 for (String id : explicitGroupMembers ) {
536539 RoleAssignee explicitGroupMember = roleAssigneeService .getRoleAssignee (id );
537540 if (explicitGroupMember instanceof AuthenticatedUser ) {
538- userNotificationService .sendNotification ((AuthenticatedUser ) explicitGroupMember , new Timestamp (new Date ().getTime ()), type , dvObject .getId ());
541+ userNotificationService .sendNotification ((AuthenticatedUser ) explicitGroupMember , new Timestamp (new Date ().getTime ()), type ,
542+ dvObject .getId (), null , null , false , additionalInfo );
539543 }
540544 }
541545 }
@@ -553,7 +557,7 @@ private void assignRole(RoleAssignee ra, DataverseRole r) {
553557 JsfHelper .addSuccessMessage (BundleUtil .getStringFromBundle ("permission.roleAssignedToFor" , args ));
554558 // don't notify if role = file downloader and object is not released
555559 if (!(r .getAlias ().equals (DataverseRole .FILE_DOWNLOADER ) && !dvObject .isReleased ()) ){
556- notifyRoleChange (ra , UserNotification .Type .ASSIGNROLE );
560+ notifyRoleChange (ra , UserNotification .Type .ASSIGNROLE , r );
557561 }
558562
559563 } catch (PermissionException ex ) {
0 commit comments