Removed created_by, status and status_date from user_group_member table.

Removed GroupMemberStatus (#764)

Change-Id: Ic5ec60cc05d95e6d805aa2abc2ffec1114d702f8
diff --git a/src/main/java/de/ids_mannheim/korap/constant/GroupMemberStatus.java b/src/main/java/de/ids_mannheim/korap/constant/GroupMemberStatus.java
deleted file mode 100644
index 87f3d04..0000000
--- a/src/main/java/de/ids_mannheim/korap/constant/GroupMemberStatus.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package de.ids_mannheim.korap.constant;
-
-/**
- * Defines possible statuses of a user-group member
- * 
- * @author margaretha
- *
- */
-public enum GroupMemberStatus {
-    ACTIVE,
-    // membership invitation was sent and has not been accepted 
-    // or rejected yet
-    PENDING;
-}
diff --git a/src/main/java/de/ids_mannheim/korap/dao/QueryDao.java b/src/main/java/de/ids_mannheim/korap/dao/QueryDao.java
index 800be3d..9f2f70a 100644
--- a/src/main/java/de/ids_mannheim/korap/dao/QueryDao.java
+++ b/src/main/java/de/ids_mannheim/korap/dao/QueryDao.java
@@ -9,7 +9,6 @@
 import org.springframework.stereotype.Repository;
 import org.springframework.transaction.annotation.Transactional;
 
-import de.ids_mannheim.korap.constant.GroupMemberStatus;
 import de.ids_mannheim.korap.constant.QueryType;
 import de.ids_mannheim.korap.constant.ResourceType;
 import de.ids_mannheim.korap.entity.QueryDO;
@@ -275,13 +274,11 @@
         
         Predicate type = builder.equal(query.get(QueryDO_.queryType),
                 queryType);
-        Predicate memberStatus = builder.equal(
-                members.get(UserGroupMember_.status), GroupMemberStatus.ACTIVE);
         Predicate user = builder.equal(members.get(UserGroupMember_.userId),
                 userId);
 
         cq.select(query);
-        cq.where(builder.and(type, memberStatus, user));
+        cq.where(builder.and(type, user));
 
         Query q = entityManager.createQuery(cq);
         return q.getResultList();
diff --git a/src/main/java/de/ids_mannheim/korap/dao/UserGroupDao.java b/src/main/java/de/ids_mannheim/korap/dao/UserGroupDao.java
index 3d99612..6c7914a 100644
--- a/src/main/java/de/ids_mannheim/korap/dao/UserGroupDao.java
+++ b/src/main/java/de/ids_mannheim/korap/dao/UserGroupDao.java
@@ -8,7 +8,6 @@
 import org.springframework.stereotype.Repository;
 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.constant.PrivilegeType;
 import de.ids_mannheim.korap.constant.UserGroupStatus;
@@ -74,8 +73,6 @@
         
             UserGroupMember owner = new UserGroupMember();
             owner.setUserId(createdBy);
-            owner.setCreatedBy(createdBy);
-            owner.setStatus(GroupMemberStatus.ACTIVE);
             owner.setGroup(group);
             owner.setRoles(roles);
             entityManager.persist(owner);
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 4909019..86ab9dd 100644
--- a/src/main/java/de/ids_mannheim/korap/dao/UserGroupMemberDao.java
+++ b/src/main/java/de/ids_mannheim/korap/dao/UserGroupMemberDao.java
@@ -3,6 +3,17 @@
 import java.util.HashSet;
 import java.util.List;
 
+import org.springframework.stereotype.Repository;
+import org.springframework.transaction.annotation.Transactional;
+
+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;
+import de.ids_mannheim.korap.entity.UserGroupMember_;
+import de.ids_mannheim.korap.exceptions.KustvaktException;
+import de.ids_mannheim.korap.exceptions.StatusCodes;
+import de.ids_mannheim.korap.utils.ParameterChecker;
 import jakarta.persistence.EntityManager;
 import jakarta.persistence.NoResultException;
 import jakarta.persistence.PersistenceContext;
@@ -13,19 +24,6 @@
 import jakarta.persistence.criteria.Predicate;
 import jakarta.persistence.criteria.Root;
 
-import org.springframework.stereotype.Repository;
-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;
-import de.ids_mannheim.korap.entity.UserGroupMember_;
-import de.ids_mannheim.korap.exceptions.KustvaktException;
-import de.ids_mannheim.korap.exceptions.StatusCodes;
-import de.ids_mannheim.korap.utils.ParameterChecker;
-
 /**
  * Manages database queries and transactions regarding
  * {@link UserGroupMember} entity and
@@ -112,8 +110,6 @@
         Predicate predicate = criteriaBuilder.and(
                 criteriaBuilder.equal(root.get(UserGroupMember_.group),
                         groupId),
-                criteriaBuilder.equal(root.get(UserGroupMember_.status),
-                        GroupMemberStatus.ACTIVE),
                 criteriaBuilder.equal(memberRole.get(Role_.NAME), role));
 
         query.select(root);
diff --git a/src/main/java/de/ids_mannheim/korap/dto/UserGroupDto.java b/src/main/java/de/ids_mannheim/korap/dto/UserGroupDto.java
index 0ed52ef..b5501d4 100644
--- a/src/main/java/de/ids_mannheim/korap/dto/UserGroupDto.java
+++ b/src/main/java/de/ids_mannheim/korap/dto/UserGroupDto.java
@@ -4,7 +4,6 @@
 
 import com.fasterxml.jackson.annotation.JsonInclude;
 
-import de.ids_mannheim.korap.constant.GroupMemberStatus;
 import de.ids_mannheim.korap.constant.PrivilegeType;
 import de.ids_mannheim.korap.constant.UserGroupStatus;
 import lombok.Getter;
@@ -31,7 +30,5 @@
     private List<UserGroupMemberDto> members;
 
     @JsonInclude(JsonInclude.Include.NON_NULL)
-    private GroupMemberStatus userMemberStatus;
-    @JsonInclude(JsonInclude.Include.NON_NULL)
     private List<PrivilegeType> userPrivileges;
 }
diff --git a/src/main/java/de/ids_mannheim/korap/dto/UserGroupMemberDto.java b/src/main/java/de/ids_mannheim/korap/dto/UserGroupMemberDto.java
index ef50116..40ea6d4 100644
--- a/src/main/java/de/ids_mannheim/korap/dto/UserGroupMemberDto.java
+++ b/src/main/java/de/ids_mannheim/korap/dto/UserGroupMemberDto.java
@@ -2,7 +2,6 @@
 
 import java.util.List;
 
-import de.ids_mannheim.korap.constant.GroupMemberStatus;
 import de.ids_mannheim.korap.constant.PrivilegeType;
 import lombok.Getter;
 import lombok.Setter;
@@ -18,6 +17,5 @@
 @Getter
 public class UserGroupMemberDto {
     private String userId;
-    private GroupMemberStatus status;
     private List<PrivilegeType> privileges;
 }
diff --git a/src/main/java/de/ids_mannheim/korap/dto/converter/UserGroupConverter.java b/src/main/java/de/ids_mannheim/korap/dto/converter/UserGroupConverter.java
index 275ee70..3ffa646 100644
--- a/src/main/java/de/ids_mannheim/korap/dto/converter/UserGroupConverter.java
+++ b/src/main/java/de/ids_mannheim/korap/dto/converter/UserGroupConverter.java
@@ -7,7 +7,6 @@
 
 import org.springframework.stereotype.Component;
 
-import de.ids_mannheim.korap.constant.GroupMemberStatus;
 import de.ids_mannheim.korap.constant.PrivilegeType;
 import de.ids_mannheim.korap.dto.UserGroupDto;
 import de.ids_mannheim.korap.dto.UserGroupMemberDto;
@@ -28,8 +27,7 @@
 public class UserGroupConverter {
 
     public UserGroupDto createUserGroupDto (UserGroup group,
-            List<UserGroupMember> members, GroupMemberStatus userMemberStatus,
-            Set<Role> roleSet) {
+            List<UserGroupMember> members, Set<Role> roleSet) {
 
         UserGroupDto dto = new UserGroupDto();
         dto.setId(group.getId());
@@ -37,7 +35,6 @@
         dto.setDescription(group.getDescription());
         dto.setStatus(group.getStatus());
         dto.setOwner(group.getCreatedBy());
-        dto.setUserMemberStatus(userMemberStatus);
 
         if (roleSet != null) {
             dto.setUserPrivileges(createPrivilegeList(roleSet));
@@ -50,7 +47,6 @@
 
                 UserGroupMemberDto memberDto = new UserGroupMemberDto();
                 memberDto.setUserId(member.getUserId());
-                memberDto.setStatus(member.getStatus());
                 memberDto.setPrivileges(createPrivilegeList(member.getRoles()));
                 memberDtos.add(memberDto);
             }
diff --git a/src/main/java/de/ids_mannheim/korap/entity/UserGroupMember.java b/src/main/java/de/ids_mannheim/korap/entity/UserGroupMember.java
index 4030fc9..d5d54ae 100644
--- a/src/main/java/de/ids_mannheim/korap/entity/UserGroupMember.java
+++ b/src/main/java/de/ids_mannheim/korap/entity/UserGroupMember.java
@@ -1,12 +1,10 @@
 package de.ids_mannheim.korap.entity;
 
-import java.time.ZonedDateTime;
 import java.util.Set;
 
+import de.ids_mannheim.korap.constant.PredefinedRole;
 import jakarta.persistence.Column;
 import jakarta.persistence.Entity;
-import jakarta.persistence.EnumType;
-import jakarta.persistence.Enumerated;
 import jakarta.persistence.FetchType;
 import jakarta.persistence.GeneratedValue;
 import jakarta.persistence.GenerationType;
@@ -18,9 +16,6 @@
 import jakarta.persistence.ManyToOne;
 import jakarta.persistence.Table;
 import jakarta.persistence.UniqueConstraint;
-
-import de.ids_mannheim.korap.constant.GroupMemberStatus;
-import de.ids_mannheim.korap.constant.PredefinedRole;
 import lombok.Getter;
 import lombok.Setter;
 
@@ -45,15 +40,6 @@
     private int id;
     @Column(name = "user_id")
     private String userId;
-    @Column(name = "created_by")
-    private String createdBy;
-
-    // auto update in the database
-    @Column(name = "status_date")
-    private ZonedDateTime statusDate;
-
-    @Enumerated(EnumType.STRING)
-    private GroupMemberStatus status;
 
     @ManyToOne(fetch = FetchType.EAGER)
     @JoinColumn(name = "group_id")
@@ -72,7 +58,6 @@
     @Override
     public String toString () {
         return "id=" + id + ", group= " + group + ", userId= " + userId
-                + ", createdBy= " + createdBy 
                 + ", roles=" + roles;
     }
 }
diff --git a/src/main/java/de/ids_mannheim/korap/service/QueryService.java b/src/main/java/de/ids_mannheim/korap/service/QueryService.java
index 2c1f9ac..60c4bef 100644
--- a/src/main/java/de/ids_mannheim/korap/service/QueryService.java
+++ b/src/main/java/de/ids_mannheim/korap/service/QueryService.java
@@ -19,7 +19,6 @@
 
 import de.ids_mannheim.korap.cache.VirtualCorpusCache;
 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.QueryType;
@@ -29,10 +28,10 @@
 import de.ids_mannheim.korap.dao.RoleDao;
 import de.ids_mannheim.korap.dao.UserGroupDao;
 import de.ids_mannheim.korap.dao.UserGroupMemberDao;
-import de.ids_mannheim.korap.dto.RoleDto;
 import de.ids_mannheim.korap.dto.QueryDto;
-import de.ids_mannheim.korap.dto.converter.RoleConverter;
+import de.ids_mannheim.korap.dto.RoleDto;
 import de.ids_mannheim.korap.dto.converter.QueryConverter;
+import de.ids_mannheim.korap.dto.converter.RoleConverter;
 import de.ids_mannheim.korap.entity.QueryDO;
 import de.ids_mannheim.korap.entity.Role;
 import de.ids_mannheim.korap.entity.UserGroup;
@@ -732,7 +731,7 @@
                     memberRoles.add(r1);
                     
                     userGroupService.addGroupMember(username, userGroup,
-                            "system", GroupMemberStatus.ACTIVE, memberRoles);    
+                            "system", memberRoles);    
                     // member roles are not set (not necessary)
                 }
                 catch (NoResultException ne) {
@@ -743,7 +742,7 @@
                     memberRoles.add(r1);
                     
                     userGroupService.addGroupMember(username, userGroup,
-                            "system", GroupMemberStatus.ACTIVE, memberRoles);                
+                            "system", memberRoles);                
                 }
                 catch (KustvaktException e) {
                     // member exists
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 7456ee4..fedd573 100644
--- a/src/main/java/de/ids_mannheim/korap/service/UserGroupService.java
+++ b/src/main/java/de/ids_mannheim/korap/service/UserGroupService.java
@@ -1,7 +1,6 @@
 package de.ids_mannheim.korap.service;
 
 import java.sql.SQLException;
-import java.time.ZonedDateTime;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.HashSet;
@@ -102,8 +101,8 @@
             members = retrieveMembers(group.getId(), username);
             userAsMember = groupMemberDao.retrieveMemberById(username,
                     group.getId());
-            groupDto = converter.createUserGroupDto(group, members,
-                    userAsMember.getStatus(), userAsMember.getRoles());
+            groupDto = converter.createUserGroupDto(group, members, 
+                    userAsMember.getRoles());
             dtos.add(groupDto);
         }
 
@@ -148,7 +147,7 @@
                 .retrieveHiddenGroupByQueryName(queryName);
         List<UserGroupMember> members = groupMemberDao
                 .retrieveMemberByGroupId(group.getId());
-        return converter.createUserGroupDto(group, members, null, null);
+        return converter.createUserGroupDto(group, members, null);
     }
 
     public List<UserGroupDto> retrieveUserGroupByStatus (String username,
@@ -163,7 +162,7 @@
         UserGroupDto groupDto;
         for (UserGroup group : userGroups) {
             members = groupMemberDao.retrieveMemberByGroupId(group.getId());
-            groupDto = converter.createUserGroupDto(group, members, null, null);
+            groupDto = converter.createUserGroupDto(group, members, null);
             dtos.add(groupDto);
         }
         return dtos;
@@ -308,10 +307,10 @@
      * @throws KustvaktException
      */
     public void inviteGroupMember (String username, UserGroup userGroup,
-            String createdBy, GroupMemberStatus status)
+            String createdBy)
             throws KustvaktException {
 
-        addGroupMember(username, userGroup, createdBy, status);
+        addGroupMember(username, userGroup, createdBy);
 
         if (config.isMailEnabled()
                 && userGroup.getStatus() != UserGroupStatus.HIDDEN) {
@@ -321,31 +320,19 @@
     }
 
     public void addGroupMember (String username, UserGroup userGroup,
-            String createdBy, GroupMemberStatus status)
+            String createdBy)
             throws KustvaktException {
-        addGroupMember(username, userGroup, createdBy, status, null);
+        addGroupMember(username, userGroup, createdBy, null);
     }
     
     public void addGroupMember (String username, UserGroup userGroup,
-            String createdBy, GroupMemberStatus status, Set<Role> roles)
+            String createdBy, Set<Role> roles)
             throws KustvaktException {
         int groupId = userGroup.getId();
         ParameterChecker.checkIntegerValue(groupId, "userGroupId");
 
-        GroupMemberStatus existingStatus = memberExists(username, groupId,
-                status);
-        if (existingStatus != null) {
-            throw new KustvaktException(StatusCodes.GROUP_MEMBER_EXISTS,
-                    "Username " + username + " with status " + existingStatus
-                            + " exists in the user-group "
-                            + userGroup.getName(),
-                    username, existingStatus.name(), userGroup.getName());
-        }
-
         UserGroupMember member = new UserGroupMember();
-        member.setCreatedBy(createdBy);
         member.setGroup(userGroup);
-        member.setStatus(status);
         member.setUserId(username);
         if (roles !=null) {
             member.setRoles(roles);
@@ -353,25 +340,6 @@
         groupMemberDao.addMember(member);
     }
 
-    private GroupMemberStatus memberExists (String username, int groupId,
-            GroupMemberStatus status) throws KustvaktException {
-        UserGroupMember existingMember;
-        try {
-            existingMember = groupMemberDao.retrieveMemberById(username,
-                    groupId);
-        }
-        catch (KustvaktException e) {
-            return null;
-        }
-
-        GroupMemberStatus existingStatus = existingMember.getStatus();
-        if (existingStatus.equals(GroupMemberStatus.ACTIVE)
-                || existingStatus.equals(status)) {
-            return existingStatus;
-        }
-        return null;
-    }
-
     public void inviteGroupMembers (String groupName, String groupMembers,
             String inviter) throws KustvaktException {
         String[] members = groupMembers.split(",");
@@ -381,8 +349,7 @@
         UserGroup userGroup = retrieveUserGroupByName(groupName);
         if (isUserGroupAdmin(inviter, userGroup) || adminDao.isAdmin(inviter)) {
             for (String memberName : members) {
-                inviteGroupMember(memberName, userGroup, inviter,
-                        GroupMemberStatus.PENDING);
+                inviteGroupMember(memberName, userGroup, inviter);
             }
         }
         else {
@@ -438,35 +405,27 @@
         UserGroup userGroup = retrieveUserGroupByName(groupName);
         UserGroupMember member = groupMemberDao.retrieveMemberById(username,
                 userGroup.getId());
-        GroupMemberStatus status = member.getStatus();
-        if (member.getStatus().equals(GroupMemberStatus.ACTIVE)) {
-            throw new KustvaktException(StatusCodes.GROUP_MEMBER_EXISTS,
-                    "Username " + username + " with status " + status
-                            + " exists in the user-group "
-                            + userGroup.getName(),
-                    username, status.name(), userGroup.getName());
-        }
         // status pending
-        else {
-            if (DEBUG) {
-                jlog.debug("status: " + member.getStatusDate());
-            }
-            ZonedDateTime expiration = member.getStatusDate().plusMinutes(30);
-            ZonedDateTime now = ZonedDateTime.now();
-            if (DEBUG) {
-                jlog.debug("expiration: " + expiration + ", now: " + now);
-            }
-
-            if (expiration.isAfter(now)) {
-                member.setStatus(GroupMemberStatus.ACTIVE);
-                Set<Role> memberRoles = prepareMemberRoles(userGroup);
-                member.setRoles(memberRoles);
-                groupMemberDao.updateMember(member);
-            }
-            else {
-                throw new KustvaktException(StatusCodes.INVITATION_EXPIRED);
-            }
-        }
+//        else {
+//            if (DEBUG) {
+//                jlog.debug("status: " + member.getStatusDate());
+//            }
+//            ZonedDateTime expiration = member.getStatusDate().plusMinutes(30);
+//            ZonedDateTime now = ZonedDateTime.now();
+//            if (DEBUG) {
+//                jlog.debug("expiration: " + expiration + ", now: " + now);
+//            }
+//
+//            if (expiration.isAfter(now)) {
+//                member.setStatus(GroupMemberStatus.ACTIVE);
+//                Set<Role> memberRoles = prepareMemberRoles(userGroup);
+//                member.setRoles(memberRoles);
+//                groupMemberDao.updateMember(member);
+//            }
+//            else {
+//                throw new KustvaktException(StatusCodes.INVITATION_EXPIRED);
+//            }
+//        }
     }
 
     public boolean isMember (String username, UserGroup userGroup)
@@ -474,8 +433,7 @@
         List<UserGroupMember> members = groupMemberDao
                 .retrieveMemberByGroupId(userGroup.getId());
         for (UserGroupMember member : members) {
-            if (member.getUserId().equals(username)
-                    && member.getStatus().equals(GroupMemberStatus.ACTIVE)) {
+            if (member.getUserId().equals(username)) {
                 return true;
             }
         }
@@ -508,7 +466,7 @@
             throws KustvaktException {
         UserGroup userGroup = userGroupDao.retrieveGroupByName(groupName, true);
         UserGroupDto groupDto = converter.createUserGroupDto(userGroup,
-                userGroup.getMembers(), null, null);
+                userGroup.getMembers(), null);
         return groupDto;
     }
 
@@ -526,12 +484,6 @@
             UserGroupMember member = groupMemberDao
                     .retrieveMemberById(memberUsername, userGroup.getId());
 
-            if (!member.getStatus().equals(GroupMemberStatus.ACTIVE)) {
-                throw new KustvaktException(StatusCodes.GROUP_MEMBER_INACTIVE,
-                        memberUsername + " has status " + member.getStatus(),
-                        memberUsername, member.getStatus().name());
-            }
-
             if (!isUserGroupAdmin(memberUsername, userGroup)) {
                 Set<Role> existingRoles = member.getRoles();
                 PredefinedRole role = PredefinedRole.GROUP_ADMIN;
diff --git a/src/main/resources/db/sqlite/V1.13__user_group_alteration.sql b/src/main/resources/db/sqlite/V1.13__role_alteration.sql
similarity index 63%
rename from src/main/resources/db/sqlite/V1.13__user_group_alteration.sql
rename to src/main/resources/db/sqlite/V1.13__role_alteration.sql
index 84daff6..6deca6b 100644
--- a/src/main/resources/db/sqlite/V1.13__user_group_alteration.sql
+++ b/src/main/resources/db/sqlite/V1.13__role_alteration.sql
@@ -1,32 +1,5 @@
---DROP INDEX IF EXISTS group_member_role_index;
---DROP INDEX IF EXISTS user_group_member_index;
---DROP INDEX IF EXISTS user_group_member_status_index;
 DROP INDEX IF EXISTS role_index;
 
--- please commented out the triggers in V1.2__triggers.sql later
---DROP TRIGGER IF EXISTS insert_member_status;
---DROP TRIGGER IF EXISTS update_member_status;
-DROP TRIGGER IF EXISTS delete_member;
-
-ALTER TABLE user_group
-DROP COLUMN deleted_by;
-
-ALTER TABLE user_group
-ADD COLUMN created_date TIMESTAMP;
---
---ALTER TABLE user_group_member
---DROP COLUMN created_by;
---
-ALTER TABLE user_group_member
-DROP COLUMN deleted_by;
---
---ALTER TABLE user_group_member
---DROP COLUMN status;
---
---ALTER TABLE user_group_member
---DROP COLUMN status_date;
-
-
 CREATE TABLE IF NOT EXISTS role_new (
   id INTEGER PRIMARY KEY AUTOINCREMENT,
   name VARCHAR(100) NOT NULL,
@@ -66,4 +39,5 @@
 WHERE query_id IS 0;
 
 CREATE UNIQUE INDEX IF NOT EXISTS role_index on role(name, 
-  privilege, group_id, query_id);
\ No newline at end of file
+  privilege, group_id, query_id);
+  
\ No newline at end of file
diff --git a/src/main/resources/db/sqlite/V1.14__user_group_alteration.sql b/src/main/resources/db/sqlite/V1.14__user_group_alteration.sql
new file mode 100644
index 0000000..1be030e
--- /dev/null
+++ b/src/main/resources/db/sqlite/V1.14__user_group_alteration.sql
@@ -0,0 +1,27 @@
+-- please commented out the indexes in V1.1 later
+DROP INDEX IF EXISTS group_member_role_index;
+DROP INDEX IF EXISTS user_group_member_status_index;
+
+-- please commented out the triggers in V1.2__triggers.sql later
+DROP TRIGGER IF EXISTS insert_member_status;
+DROP TRIGGER IF EXISTS update_member_status;
+DROP TRIGGER IF EXISTS delete_member;
+
+ALTER TABLE user_group
+ADD COLUMN created_date TIMESTAMP;
+
+ALTER TABLE user_group
+DROP COLUMN deleted_by;
+
+ALTER TABLE user_group_member
+DROP COLUMN created_by;
+
+ALTER TABLE user_group_member
+DROP COLUMN deleted_by;
+
+ALTER TABLE user_group_member
+DROP COLUMN status;
+
+ALTER TABLE user_group_member
+DROP COLUMN status_date;
+  
\ No newline at end of file
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 c79bd0a..019ecda 100644
--- a/src/test/java/de/ids_mannheim/korap/dao/DaoTestBase.java
+++ b/src/test/java/de/ids_mannheim/korap/dao/DaoTestBase.java
@@ -6,7 +6,6 @@
 
 import org.springframework.beans.factory.annotation.Autowired;
 
-import de.ids_mannheim.korap.constant.GroupMemberStatus;
 import de.ids_mannheim.korap.constant.UserGroupStatus;
 import de.ids_mannheim.korap.entity.UserGroup;
 import de.ids_mannheim.korap.exceptions.KustvaktException;
@@ -35,10 +34,8 @@
     
     protected UserGroup createDoryGroup () throws KustvaktException {
         UserGroup group = createUserGroup("dory-group", "dory");
-        userGroupService.addGroupMember("nemo", group, "dory",
-                GroupMemberStatus.ACTIVE);
-        userGroupService.addGroupMember("marlin", group, "dory",
-                GroupMemberStatus.PENDING);
+        userGroupService.addGroupMember("nemo", group, "dory");
+        userGroupService.addGroupMember("marlin", group, "dory");
         return group;
     }
     
diff --git a/src/test/java/de/ids_mannheim/korap/web/controller/usergroup/UserGroupControllerAdminTest.java b/src/test/java/de/ids_mannheim/korap/web/controller/usergroup/UserGroupControllerAdminTest.java
index c5af1a5..7cedc2b 100644
--- a/src/test/java/de/ids_mannheim/korap/web/controller/usergroup/UserGroupControllerAdminTest.java
+++ b/src/test/java/de/ids_mannheim/korap/web/controller/usergroup/UserGroupControllerAdminTest.java
@@ -9,7 +9,6 @@
 
 import de.ids_mannheim.korap.authentication.http.HttpAuthorizationHandler;
 import de.ids_mannheim.korap.config.Attributes;
-import de.ids_mannheim.korap.constant.GroupMemberStatus;
 import de.ids_mannheim.korap.constant.PredefinedRole;
 import de.ids_mannheim.korap.exceptions.KustvaktException;
 import de.ids_mannheim.korap.exceptions.StatusCodes;
@@ -279,8 +278,6 @@
         node = node.get(0);
         assertEquals(3, node.get("members").size());
         assertEquals(node.at("/members/1/userId").asText(), "nemo");
-        assertEquals(GroupMemberStatus.PENDING.name(),
-                node.at("/members/1/status").asText());
     }
 
     private void testInviteMember (String groupName)
@@ -301,8 +298,6 @@
         node = node.get(0);
         assertEquals(4, node.get("members").size());
         assertEquals(node.at("/members/3/userId").asText(), "darla");
-        assertEquals(GroupMemberStatus.PENDING.name(),
-                node.at("/members/1/status").asText());
         assertEquals(0, node.at("/members/1/privileges").size());
     }
 }
diff --git a/src/test/java/de/ids_mannheim/korap/web/controller/usergroup/UserGroupControllerTest.java b/src/test/java/de/ids_mannheim/korap/web/controller/usergroup/UserGroupControllerTest.java
index 8562fd3..673fbfc 100644
--- a/src/test/java/de/ids_mannheim/korap/web/controller/usergroup/UserGroupControllerTest.java
+++ b/src/test/java/de/ids_mannheim/korap/web/controller/usergroup/UserGroupControllerTest.java
@@ -9,7 +9,6 @@
 
 import de.ids_mannheim.korap.authentication.http.HttpAuthorizationHandler;
 import de.ids_mannheim.korap.config.Attributes;
-import de.ids_mannheim.korap.constant.GroupMemberStatus;
 import de.ids_mannheim.korap.exceptions.KustvaktException;
 import de.ids_mannheim.korap.exceptions.StatusCodes;
 import de.ids_mannheim.korap.utils.JsonUtils;
@@ -101,8 +100,6 @@
         assertEquals(username, node.get("owner").asText());
         assertEquals(1, node.get("members").size());
         assertEquals(username, node.at("/members/0/userId").asText());
-        assertEquals(GroupMemberStatus.ACTIVE.name(),
-                node.at("/members/0/status").asText());
         assertEquals(5,  node.at("/members/0/privileges").size());
 
         testUpdateUserGroup(groupName);
diff --git a/src/test/java/de/ids_mannheim/korap/web/controller/usergroup/UserGroupSubscriptionTest.java b/src/test/java/de/ids_mannheim/korap/web/controller/usergroup/UserGroupSubscriptionTest.java
index 8c12e55..b0c80a5 100644
--- a/src/test/java/de/ids_mannheim/korap/web/controller/usergroup/UserGroupSubscriptionTest.java
+++ b/src/test/java/de/ids_mannheim/korap/web/controller/usergroup/UserGroupSubscriptionTest.java
@@ -9,7 +9,6 @@
 
 import de.ids_mannheim.korap.authentication.http.HttpAuthorizationHandler;
 import de.ids_mannheim.korap.config.Attributes;
-import de.ids_mannheim.korap.constant.GroupMemberStatus;
 import de.ids_mannheim.korap.exceptions.KustvaktException;
 import de.ids_mannheim.korap.exceptions.StatusCodes;
 import de.ids_mannheim.korap.utils.JsonUtils;
@@ -73,8 +72,6 @@
         assertEquals(group.at("/owner").asText(), "dory");
         // group members are not allowed to see other members
         assertEquals(0, group.at("/members").size());
-        assertEquals(GroupMemberStatus.ACTIVE.name(),
-                group.at("/userMemberStatus").asText());
         
         assertEquals(1, group.at("/userPrivileges").size());
         
@@ -94,10 +91,6 @@
         // check member
         JsonNode node = listUserGroups(invitee);
         assertEquals(1, node.size());
-        JsonNode group = node.get(0);
-        assertEquals(GroupMemberStatus.PENDING.name(),
-                group.at("/userMemberStatus").asText());
-//        testDeletePendingMember();
     }
     
     private void checkGroupMemberRole (String groupName,
diff --git a/src/test/java/de/ids_mannheim/korap/web/controller/usergroup/UserGroupTestBase.java b/src/test/java/de/ids_mannheim/korap/web/controller/usergroup/UserGroupTestBase.java
index 4a5c6bd..81df9a5 100644
--- a/src/test/java/de/ids_mannheim/korap/web/controller/usergroup/UserGroupTestBase.java
+++ b/src/test/java/de/ids_mannheim/korap/web/controller/usergroup/UserGroupTestBase.java
@@ -7,7 +7,6 @@
 
 import de.ids_mannheim.korap.authentication.http.HttpAuthorizationHandler;
 import de.ids_mannheim.korap.config.Attributes;
-import de.ids_mannheim.korap.constant.GroupMemberStatus;
 import de.ids_mannheim.korap.constant.PredefinedRole;
 import de.ids_mannheim.korap.exceptions.KustvaktException;
 import de.ids_mannheim.korap.utils.JsonUtils;
@@ -84,8 +83,6 @@
         node = node.get(0);
         assertEquals(2, node.get("members").size());
         assertEquals(node.at("/members/1/userId").asText(), invitee);
-        assertEquals(GroupMemberStatus.PENDING.name(),
-                node.at("/members/1/status").asText());
         assertEquals(0, node.at("/members/1/privileges").size());
     }
 
diff --git a/src/test/java/de/ids_mannheim/korap/web/controller/vc/VirtualCorpusPublishedTest.java b/src/test/java/de/ids_mannheim/korap/web/controller/vc/VirtualCorpusPublishedTest.java
index acfc3bb..9615fef 100644
--- a/src/test/java/de/ids_mannheim/korap/web/controller/vc/VirtualCorpusPublishedTest.java
+++ b/src/test/java/de/ids_mannheim/korap/web/controller/vc/VirtualCorpusPublishedTest.java
@@ -6,8 +6,6 @@
 
 import com.fasterxml.jackson.databind.JsonNode;
 
-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.ResourceType;
 import de.ids_mannheim.korap.constant.UserGroupStatus;
@@ -51,8 +49,6 @@
         assertEquals(UserGroupStatus.HIDDEN.name(), 
                 node.at("/status").asText());
         assertEquals(username, node.at("/members/0/userId").asText());
-        assertEquals(GroupMemberStatus.ACTIVE.name(), 
-                node.at("/members/0/status").asText());
         assertEquals(1, node.at("/members/0/privileges").size());
         assertEquals(PrivilegeType.READ_QUERY.name(), 
                 node.at("/members/0/privileges/0").asText());
diff --git a/src/test/java/de/ids_mannheim/korap/web/controller/vc/VirtualCorpusReferenceTest.java b/src/test/java/de/ids_mannheim/korap/web/controller/vc/VirtualCorpusReferenceTest.java
index 638a041..6b908e9 100644
--- a/src/test/java/de/ids_mannheim/korap/web/controller/vc/VirtualCorpusReferenceTest.java
+++ b/src/test/java/de/ids_mannheim/korap/web/controller/vc/VirtualCorpusReferenceTest.java
@@ -15,7 +15,6 @@
 import de.ids_mannheim.korap.authentication.http.HttpAuthorizationHandler;
 import de.ids_mannheim.korap.cache.VirtualCorpusCache;
 import de.ids_mannheim.korap.config.Attributes;
-import de.ids_mannheim.korap.constant.GroupMemberStatus;
 import de.ids_mannheim.korap.constant.UserGroupStatus;
 import de.ids_mannheim.korap.dao.QueryDao;
 import de.ids_mannheim.korap.entity.QueryDO;
@@ -218,8 +217,6 @@
                 node.at("/status").asText());
         node = node.at("/members");
         assertEquals("squirt", node.at("/0/userId").asText());
-        assertEquals(GroupMemberStatus.ACTIVE.name(),
-                node.at("/0/status").asText());
         deleteVC(vcName, "marlin", "marlin");
     }
 }
diff --git a/src/test/java/de/ids_mannheim/korap/web/controller/vc/VirtualCorpusSharingTest.java b/src/test/java/de/ids_mannheim/korap/web/controller/vc/VirtualCorpusSharingTest.java
index 1ffbdb8..52d6b7f 100644
--- a/src/test/java/de/ids_mannheim/korap/web/controller/vc/VirtualCorpusSharingTest.java
+++ b/src/test/java/de/ids_mannheim/korap/web/controller/vc/VirtualCorpusSharingTest.java
@@ -10,8 +10,6 @@
 
 import de.ids_mannheim.korap.authentication.http.HttpAuthorizationHandler;
 import de.ids_mannheim.korap.config.Attributes;
-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.exceptions.KustvaktException;
 import de.ids_mannheim.korap.exceptions.StatusCodes;
@@ -307,8 +305,6 @@
         JsonNode node = listUserGroups(testUser).get(0);
         assertEquals(2, node.get("members").size());
         assertEquals(memberName, node.at("/members/1/userId").asText());
-        assertEquals(GroupMemberStatus.ACTIVE.name(),
-                node.at("/members/1/status").asText());
         assertEquals(PrivilegeType.DELETE_MEMBER.name(),
                 node.at("/members/1/privileges/0").asText());
     }