{
for ( String groupName : role.getGroupArray() )
{
if ( groupName.equals( group.getName() ) )
{
Role memoryRole = userList.getRole( role.getName() );
if ( memoryRole != null )
{
if (logger.isDebugEnabled()) {
logger.debug("GROUP : " + memoryGroup.getName() + " in ROLE : " + memoryRole.getName() );
}
memoryGroup.addRole ( memoryRole );
}
}
}
}
userList.addGroup ( memoryGroup );
}
// constructs User.
for( org.apache.beehive.wsm.axis.security.xmlbeans.User user : beehiveRole.getUserArray() )
{
MemoryUserImpl memoryUser = new MemoryUserImpl();
memoryUser.setName ( user.getName() );
memoryUser.setPassword ( user.getPassword() );
memoryUser.setMd5 ( user.getMd5() );
for ( org.apache.beehive.wsm.axis.security.xmlbeans.Group group : beehiveRole.getGroupArray() )
{
for ( String userName : group.getUserArray() )
{
if ( userName.equals( user.getName() ) )
{
Group memoryGroup = userList.getGroup( group.getName() );
if ( memoryGroup != null )
{
if (logger.isDebugEnabled()) {
logger.debug("USER : " + memoryUser.getName() + " in GROUP : " + memoryGroup.getName() );
}
// User and Group hold references to each other
memoryGroup.addUser( memoryUser );
memoryUser.addGroup( memoryGroup );
// user inherits this group's roles.
for ( Role memoryRole : memoryGroup.getRoles() )
{
memoryUser.addRole ( memoryRole );
}
}
}
}
}
for ( org.apache.beehive.wsm.axis.security.xmlbeans.Role role : beehiveRole.getRoleArray() )
{
for ( String userName : role.getUserArray() )
{
if ( userName.equals( user.getName() ) )
{
Role memoryRole = userList.getRole( role.getName() );
if ( memoryRole != null )
{
if (logger.isDebugEnabled()) {
logger.debug("USER : " + memoryUser.getName() + " in ROLE : " + memoryRole.getName() );
}
memoryUser.addRole( memoryRole );
}
}
}