public void updateGroupMembers ( GroupForm groupForm , IPerson updater ) { if ( ! canEditGroup ( updater , groupForm . getKey ( ) ) ) { throw new RuntimeAuthorizationException ( updater , IPermission . EDIT_GROUP_ACTIVITY , groupForm . getKey ( ) ) ; } if ( log . isDebugEnabled ( ) ) { log . debug ( "Updating group members for group form [" + groupForm . toString ( ) + "]" ) ; } // find the current version of this group entity IEntityGroup group = GroupService . findGroup ( groupForm . getKey ( ) ) ; // clear the current group membership list for ( IGroupMember child : group . getChildren ( ) ) { group . removeChild ( child ) ; } // add all the group membership information from the group form // to the group for ( JsonEntityBean child : groupForm . getMembers ( ) ) { EntityEnum type = EntityEnum . getEntityEnum ( child . getEntityTypeAsString ( ) ) ; if ( type . isGroup ( ) ) { IEntityGroup member = GroupService . findGroup ( child . getId ( ) ) ; group . addChild ( member ) ; } else { IGroupMember member = GroupService . getGroupMember ( child . getId ( ) , type . getClazz ( ) ) ; group . addChild ( member ) ; } } // save the group, updating both its basic information and group // membership group . updateMembers ( ) ; }
Update the members of an existing group in the group store .