添加新的群组类型:组织群
This commit is contained in:
@@ -29,6 +29,10 @@ public class KickoffGroupMember extends GroupHandler<WFCMessage.RemoveGroupMembe
|
|||||||
errorCode = ErrorCode.ERROR_CODE_NOT_EXIST;
|
errorCode = ErrorCode.ERROR_CODE_NOT_EXIST;
|
||||||
} else {
|
} else {
|
||||||
boolean isAdmin = requestSourceType == ProtoConstants.RequestSourceType.Request_From_Admin;
|
boolean isAdmin = requestSourceType == ProtoConstants.RequestSourceType.Request_From_Admin;
|
||||||
|
if (!isAdmin && groupInfo.getType() == ProtoConstants.GroupType.GroupType_Organization) {
|
||||||
|
return ErrorCode.ERROR_CODE_NOT_RIGHT;
|
||||||
|
}
|
||||||
|
|
||||||
boolean isAllow = isAdmin;
|
boolean isAllow = isAdmin;
|
||||||
if (!isAllow) {
|
if (!isAllow) {
|
||||||
if (groupInfo.getOwner() != null) {
|
if (groupInfo.getOwner() != null) {
|
||||||
|
|||||||
@@ -1266,6 +1266,9 @@ public class MemoryMessagesStore implements IMessagesStore {
|
|||||||
int maxCount = Integer.MAX_VALUE;
|
int maxCount = Integer.MAX_VALUE;
|
||||||
|
|
||||||
if (!isAdmin) {
|
if (!isAdmin) {
|
||||||
|
if (groupInfo.getType() == ProtoConstants.GroupType.GroupType_Organization) {
|
||||||
|
return ErrorCode.ERROR_CODE_NOT_RIGHT;
|
||||||
|
}
|
||||||
boolean isMember = false;
|
boolean isMember = false;
|
||||||
boolean isManager = false;
|
boolean isManager = false;
|
||||||
WFCMessage.GroupMember gm = getGroupMember(groupId, operator);
|
WFCMessage.GroupMember gm = getGroupMember(groupId, operator);
|
||||||
@@ -1511,6 +1514,7 @@ public class MemoryMessagesStore implements IMessagesStore {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!isAdmin && (groupInfo.getType() == ProtoConstants.GroupType.GroupType_Free ||
|
if (!isAdmin && (groupInfo.getType() == ProtoConstants.GroupType.GroupType_Free ||
|
||||||
|
groupInfo.getType() == ProtoConstants.GroupType.GroupType_Organization ||
|
||||||
(groupInfo.getType() == ProtoConstants.GroupType.GroupType_Restricted || groupInfo.getType() == ProtoConstants.GroupType.GroupType_Normal)
|
(groupInfo.getType() == ProtoConstants.GroupType.GroupType_Restricted || groupInfo.getType() == ProtoConstants.GroupType.GroupType_Normal)
|
||||||
&& (groupInfo.getOwner() == null || !groupInfo.getOwner().equals(operator)))) {
|
&& (groupInfo.getOwner() == null || !groupInfo.getOwner().equals(operator)))) {
|
||||||
return ErrorCode.ERROR_CODE_NOT_RIGHT;
|
return ErrorCode.ERROR_CODE_NOT_RIGHT;
|
||||||
@@ -1554,7 +1558,11 @@ public class MemoryMessagesStore implements IMessagesStore {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!isAdmin) {
|
if (!isAdmin) {
|
||||||
if (oldInfo.getType() == ProtoConstants.GroupType.GroupType_Restricted) {
|
if (oldInfo.getType() == ProtoConstants.GroupType.GroupType_Organization && modifyType != Modify_Group_Extra && modifyType != Modify_Group_Mute && modifyType != Modify_Group_PrivateChat) {
|
||||||
|
return ErrorCode.ERROR_CODE_NOT_RIGHT;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (oldInfo.getType() == ProtoConstants.GroupType.GroupType_Restricted || oldInfo.getType() == ProtoConstants.GroupType.GroupType_Organization) {
|
||||||
boolean isAllow = false;
|
boolean isAllow = false;
|
||||||
if ((oldInfo.getOwner() != null && oldInfo.getOwner().equals(operator))) {
|
if ((oldInfo.getOwner() != null && oldInfo.getOwner().equals(operator))) {
|
||||||
isAllow = true;
|
isAllow = true;
|
||||||
@@ -1920,6 +1928,10 @@ public class MemoryMessagesStore implements IMessagesStore {
|
|||||||
return ErrorCode.ERROR_CODE_NOT_RIGHT;
|
return ErrorCode.ERROR_CODE_NOT_RIGHT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!isAdmin && groupInfo.getType() == ProtoConstants.GroupType.GroupType_Organization) {
|
||||||
|
return ErrorCode.ERROR_CODE_NOT_RIGHT;
|
||||||
|
}
|
||||||
|
|
||||||
//check the new owner is in member list? is that necessary?
|
//check the new owner is in member list? is that necessary?
|
||||||
long updateDt = System.currentTimeMillis();
|
long updateDt = System.currentTimeMillis();
|
||||||
groupInfo = groupInfo.toBuilder().setOwner(newOwner).setUpdateDt(updateDt).setMemberUpdateDt(updateDt).build();
|
groupInfo = groupInfo.toBuilder().setOwner(newOwner).setUpdateDt(updateDt).setMemberUpdateDt(updateDt).build();
|
||||||
|
|||||||
@@ -19,6 +19,8 @@ public class ProtoConstants {
|
|||||||
int GroupType_Free = 1;
|
int GroupType_Free = 1;
|
||||||
//member can only quit, owner can do all the operations
|
//member can only quit, owner can do all the operations
|
||||||
int GroupType_Restricted = 2;
|
int GroupType_Restricted = 2;
|
||||||
|
//member can not do anything, server api manage the group
|
||||||
|
int GroupType_Organization = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
//message GroupMember -> type
|
//message GroupMember -> type
|
||||||
|
|||||||
Reference in New Issue
Block a user