public static IndexedContainer getGroupsOfUser ( CmsObject cms , CmsUser user , String caption , String iconProp , String ou , String propStatus , Function < CmsGroup , CmsCssIcon > iconProvider ) { IndexedContainer container = new IndexedContainer ( ) ; container . addContainerProperty ( caption , String . class , "" ) ; container . addContainerProperty ( ou , String . class , "" ) ; container . addContainerProperty ( propStatus , Boolean . class , new Boolean ( true ) ) ; if ( iconProvider != null ) { container . addContainerProperty ( iconProp , CmsCssIcon . class , null ) ; } try { for ( CmsGroup group : cms . getGroupsOfUser ( user . getName ( ) , true ) ) { Item item = container . addItem ( group ) ; item . getItemProperty ( caption ) . setValue ( group . getSimpleName ( ) ) ; item . getItemProperty ( ou ) . setValue ( group . getOuFqn ( ) ) ; if ( iconProvider != null ) { item . getItemProperty ( iconProp ) . setValue ( iconProvider . apply ( group ) ) ; } } } catch ( CmsException e ) { LOG . error ( "Unable to read groups from user" , e ) ; } return container ; }
Gets container with alls groups of a certain user .