Ignore:
Timestamp:
08/15/14 16:02:36 (10 years ago)
Author:
olhsha@mpi.nl
Message:

fixing serialisation issues for List<String>. Adding unit tests for goup service

File:
1 edited

Legend:

Unmodified
Added
Removed
  • ComponentRegistry/trunk/ComponentRegistry/src/main/java/clarin/cmdi/componentregistry/impl/database/ComponentRegistryDbImpl.java

    r5552 r5553  
    4848import org.springframework.beans.factory.annotation.Qualifier;
    4949import org.springframework.dao.DataAccessException;
     50import org.springframework.orm.jpa.vendor.Database;
    5051import org.springframework.transaction.annotation.Transactional;
    5152
     
    154155        }
    155156    }
    156 
     157   
     158    @Override
     159    public Number makeGroupMember(String principalName, String groupName) throws  UserUnauthorizedException, ItemNotFoundException{
     160        RegistryUser regOwner = userDao.getPrincipalNameById(registryOwner.getId());
     161        if  (groupService.isUserOwnerOfGroup(groupName, regOwner.getPrincipalName()) ||
     162                configuration.isAdminUser(regOwner.getPrincipalName())) {
     163        return groupService.makeMember(principalName, groupName);
     164        } else {
     165            throw new UserUnauthorizedException("The registry owner is not the admin or not the owner of the group and cannot add users to the group");
     166        }
     167    }
     168   
     169//    @Override
     170//    public long removeGroupMember(String principalName, String groupName) throws  UserUnauthorizedException, ItemNotFoundException{
     171//        RegistryUser regOwner = userDao.getPrincipalNameById(registryOwner.getId());
     172//        if  (groupService.isUserOwnerOfGroup(groupName, regOwner.getPrincipalName()) ||
     173//                configuration.isAdminUser(regOwner.getPrincipalName())) {
     174//        return groupService.removeMember(principalName, groupName);
     175//        } else {
     176//            throw new UserUnauthorizedException("The registry owner is not the admin or not the owner of the group and cannot add users to the group");
     177//        }
     178//    }
     179   
     180   
    157181    @Override
    158182    public List<ProfileDescription> getProfileDescriptions() throws ComponentRegistryException, UserUnauthorizedException {
     
    960984        }
    961985    }
     986   
     987   
    962988}
Note: See TracChangeset for help on using the changeset viewer.