diff --git a/src/main/java/de/ids_mannheim/korap/dao/UserGroupMemberDao.java b/src/main/java/de/ids_mannheim/korap/dao/UserGroupMemberDao.java
index c399fd6..1bf7fb9 100644
--- a/src/main/java/de/ids_mannheim/korap/dao/UserGroupMemberDao.java
+++ b/src/main/java/de/ids_mannheim/korap/dao/UserGroupMemberDao.java
@@ -17,6 +17,7 @@
 import org.springframework.transaction.annotation.Transactional;
 
 import de.ids_mannheim.korap.constant.GroupMemberStatus;
+import de.ids_mannheim.korap.constant.PredefinedRole;
 import de.ids_mannheim.korap.entity.Role;
 import de.ids_mannheim.korap.entity.Role_;
 import de.ids_mannheim.korap.entity.UserGroupMember;
@@ -104,9 +105,8 @@
     }
 
     @SuppressWarnings("unchecked")
-    public List<UserGroupMember> retrieveMemberByRole (int groupId, int roleId)
-            throws KustvaktException {
-        ParameterChecker.checkIntegerValue(roleId, "roleId");
+    public List<UserGroupMember> retrieveMemberByRole (int groupId,
+            PredefinedRole role) throws KustvaktException {
         ParameterChecker.checkIntegerValue(groupId, "groupId");
 
         CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder();
@@ -121,7 +121,7 @@
                         groupId),
                 criteriaBuilder.equal(root.get(UserGroupMember_.status),
                         GroupMemberStatus.ACTIVE),
-                criteriaBuilder.equal(memberRole.get(Role_.id), roleId));
+                criteriaBuilder.equal(memberRole.get(Role_.NAME), role));
 
         query.select(root);
         query.where(predicate);
@@ -131,9 +131,9 @@
         }
         catch (NoResultException e) {
             throw new KustvaktException(
-                    StatusCodes.NO_RESULT_FOUND, "No member with role " + roleId
+                    StatusCodes.NO_RESULT_FOUND, "No member with role " + role.name()
                             + " is found in group " + groupId,
-                    String.valueOf(roleId));
+                    role.name());
         }
     }
 
diff --git a/src/main/java/de/ids_mannheim/korap/service/UserGroupService.java b/src/main/java/de/ids_mannheim/korap/service/UserGroupService.java
index 22fe070..bfa8b45 100644
--- a/src/main/java/de/ids_mannheim/korap/service/UserGroupService.java
+++ b/src/main/java/de/ids_mannheim/korap/service/UserGroupService.java
@@ -18,6 +18,7 @@
 import de.ids_mannheim.korap.config.FullConfiguration;
 import de.ids_mannheim.korap.constant.GroupMemberStatus;
 import de.ids_mannheim.korap.constant.PredefinedRole;
+import de.ids_mannheim.korap.constant.PrivilegeType;
 import de.ids_mannheim.korap.constant.UserGroupStatus;
 import de.ids_mannheim.korap.dao.AdminDao;
 import de.ids_mannheim.korap.dao.RoleDao;
@@ -115,7 +116,7 @@
     private List<UserGroupMember> retrieveMembers (int groupId, String username)
             throws KustvaktException {
         List<UserGroupMember> groupAdmins = groupMemberDao.retrieveMemberByRole(
-                groupId, PredefinedRole.USER_GROUP_ADMIN.getId());
+                groupId, PredefinedRole.USER_GROUP_ADMIN_DELETE);
 
         List<UserGroupMember> members = null;
         for (UserGroupMember admin : groupAdmins) {
@@ -165,17 +166,23 @@
     public List<UserGroupMember> retrieveQueryAccessAdmins (UserGroup userGroup)
             throws KustvaktException {
         List<UserGroupMember> groupAdmins = groupMemberDao.retrieveMemberByRole(
-                userGroup.getId(), PredefinedRole.VC_ACCESS_ADMIN.getId());
+                userGroup.getId(), PredefinedRole.QUERY_ADMIN_DELETE);
         return groupAdmins;
     }
 
-    private void setMemberRoles () {
+    private void setMemberRoles (UserGroup userGroup) {
         if (memberRoles == null) {
+            
+            Role r1 = new Role(PredefinedRole.USER_GROUP_MEMBER_DELETE,
+                    PrivilegeType.DELETE, userGroup);
+            Role r2 = new Role(PredefinedRole.QUERY_MEMBER_READ,
+                    PrivilegeType.DELETE, userGroup);
+            roleDao.addRole(r1);
+            roleDao.addRole(r2);
+            
             memberRoles = new HashSet<Role>(2);
-            memberRoles.add(roleDao.retrieveRoleById(
-                    PredefinedRole.USER_GROUP_MEMBER.getId()));
-            memberRoles.add(roleDao
-                    .retrieveRoleById(PredefinedRole.VC_ACCESS_MEMBER.getId()));
+            memberRoles.add(r1);
+            memberRoles.add(r2);
         }
     }
 
@@ -407,7 +414,7 @@
 
         List<UserGroupMember> userGroupAdmins = groupMemberDao
                 .retrieveMemberByRole(userGroup.getId(),
-                        PredefinedRole.USER_GROUP_ADMIN.getId());
+                        PredefinedRole.USER_GROUP_ADMIN_DELETE);
 
         for (UserGroupMember admin : userGroupAdmins) {
             if (username.equals(admin.getUserId())) {
@@ -432,7 +439,7 @@
             throws KustvaktException {
 
         ParameterChecker.checkStringValue(username, "userId");
-        ParameterChecker.checkStringValue(groupName, "groupId");
+        ParameterChecker.checkStringValue(groupName, "groupName");
 
         UserGroup userGroup = userGroupDao.retrieveGroupByName(groupName,
                 false);
@@ -471,7 +478,7 @@
 
             if (expiration.isAfter(now)) {
                 member.setStatus(GroupMemberStatus.ACTIVE);
-                setMemberRoles();
+                setMemberRoles(userGroup);
                 member.setRoles(memberRoles);
                 groupMemberDao.updateMember(member);
             }
@@ -564,7 +571,7 @@
     }
 
     public void editMemberRoles (String username, String groupName,
-            String memberUsername, List<Integer> roleIds)
+            String memberUsername, List<PredefinedRole> roleIds)
             throws KustvaktException {
 
         ParameterChecker.checkStringValue(username, "username");
@@ -591,7 +598,7 @@
 
             Set<Role> roles = new HashSet<>();
             for (int i = 0; i < roleIds.size(); i++) {
-                roles.add(roleDao.retrieveRoleById(roleIds.get(i)));
+                roles.add(roleDao.retrieveRoleByName(roleIds.get(i)));
             }
             member.setRoles(roles);
             groupMemberDao.updateMember(member);
@@ -604,7 +611,7 @@
     }
 
     public void addMemberRoles (String username, String groupName,
-            String memberUsername, List<Integer> roleIds)
+            String memberUsername, List<PredefinedRole> roleNames)
             throws KustvaktException {
 
         ParameterChecker.checkStringValue(username, "username");
@@ -630,8 +637,8 @@
             }
 
             Set<Role> roles = member.getRoles();
-            for (int i = 0; i < roleIds.size(); i++) {
-                roles.add(roleDao.retrieveRoleById(roleIds.get(i)));
+            for (PredefinedRole role : roleNames) {
+                roles.add(roleDao.retrieveRoleByName(role));
             }
             member.setRoles(roles);
             groupMemberDao.updateMember(member);
diff --git a/src/test/java/de/ids_mannheim/korap/dao/DaoTestBase.java b/src/test/java/de/ids_mannheim/korap/dao/DaoTestBase.java
index 408f1a4..31cf098 100644
--- a/src/test/java/de/ids_mannheim/korap/dao/DaoTestBase.java
+++ b/src/test/java/de/ids_mannheim/korap/dao/DaoTestBase.java
@@ -4,7 +4,6 @@
 import static org.junit.jupiter.api.Assertions.assertNotNull;
 import static org.junit.jupiter.api.Assertions.assertThrows;
 
-import org.junit.jupiter.api.AfterAll;
 import org.springframework.beans.factory.annotation.Autowired;
 
 import de.ids_mannheim.korap.constant.GroupMemberStatus;
diff --git a/src/test/java/de/ids_mannheim/korap/dao/UserGroupMemberDaoTest.java b/src/test/java/de/ids_mannheim/korap/dao/UserGroupMemberDaoTest.java
index e3fdc87..4907c70 100644
--- a/src/test/java/de/ids_mannheim/korap/dao/UserGroupMemberDaoTest.java
+++ b/src/test/java/de/ids_mannheim/korap/dao/UserGroupMemberDaoTest.java
@@ -5,6 +5,8 @@
 import java.util.List;
 import java.util.Set;
 
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
 import org.junit.jupiter.api.extension.ExtendWith;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -12,41 +14,60 @@
 import org.springframework.test.context.junit.jupiter.SpringExtension;
 
 import de.ids_mannheim.korap.constant.PredefinedRole;
+import de.ids_mannheim.korap.constant.PrivilegeType;
 import de.ids_mannheim.korap.entity.Role;
+import de.ids_mannheim.korap.entity.UserGroup;
 import de.ids_mannheim.korap.entity.UserGroupMember;
 import de.ids_mannheim.korap.exceptions.KustvaktException;
 
 @ExtendWith(SpringExtension.class)
 @ContextConfiguration("classpath:test-config.xml")
-public class UserGroupMemberDaoTest {
+public class UserGroupMemberDaoTest extends DaoTestBase {
 
     @Autowired
     private UserGroupMemberDao dao;
 
     @Autowired
     private RoleDao roleDao;
+    
+    private static UserGroup group;
 
+    @BeforeEach
+    public void setUp() throws KustvaktException {
+        group = createDoryGroup();
+    }
+
+    @AfterEach
+    public void tearDown() throws KustvaktException {
+        deleteUserGroup(group.getId(), "dory");
+    }
+    
     @Test
     public void testRetrieveMemberByRole () throws KustvaktException {
         // dory group
-        List<UserGroupMember> vcaAdmins = dao.retrieveMemberByRole(2,
-                PredefinedRole.VC_ACCESS_ADMIN.getId());
+        List<UserGroupMember> vcaAdmins = dao.retrieveMemberByRole(group.getId(),
+                PredefinedRole.QUERY_ADMIN_DELETE);
         // System.out.println(vcaAdmins);
         assertEquals(1, vcaAdmins.size());
         assertEquals(vcaAdmins.get(0).getUserId(), "dory");
     }
 
+    // EM: now it is possible to add duplicate member role !
     @Test
     public void testAddSameMemberRole () throws KustvaktException {
-        UserGroupMember member = dao.retrieveMemberById("dory", 1);
+        int groupId = group.getId();
+        
+        Role newRole = new Role(PredefinedRole.USER_GROUP_ADMIN_DELETE,
+                PrivilegeType.DELETE, group);
+        roleDao.addRole(newRole);
+        
+        UserGroupMember member = dao.retrieveMemberById("dory", groupId);
         Set<Role> roles = member.getRoles();
-        Role adminRole = roleDao
-                .retrieveRoleById(PredefinedRole.USER_GROUP_ADMIN.getId());
-        roles.add(adminRole);
+        roles.add(newRole);
         member.setRoles(roles);
         dao.updateMember(member);
-        member = dao.retrieveMemberById("dory", 1);
+        member = dao.retrieveMemberById("dory", groupId);
         member.getRoles();
-        assertEquals(2, roles.size());
+        assertEquals(7, roles.size());
     }
 }
