mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 18:40:39 +00:00
Implement new dbus group interface
This commit is contained in:
parent
b5d4a5000b
commit
997b4f0c3f
15 changed files with 803 additions and 136 deletions
|
@ -8,13 +8,12 @@ import org.asamk.signal.manager.api.RecipientIdentifier;
|
|||
import org.asamk.signal.manager.api.SendGroupMessageResults;
|
||||
import org.asamk.signal.manager.api.SendMessageResults;
|
||||
import org.asamk.signal.manager.api.TypingAction;
|
||||
import org.asamk.signal.manager.api.UpdateGroup;
|
||||
import org.asamk.signal.manager.config.ServiceConfig;
|
||||
import org.asamk.signal.manager.config.ServiceEnvironment;
|
||||
import org.asamk.signal.manager.groups.GroupId;
|
||||
import org.asamk.signal.manager.groups.GroupInviteLinkUrl;
|
||||
import org.asamk.signal.manager.groups.GroupLinkState;
|
||||
import org.asamk.signal.manager.groups.GroupNotFoundException;
|
||||
import org.asamk.signal.manager.groups.GroupPermission;
|
||||
import org.asamk.signal.manager.groups.GroupSendingNotAllowedException;
|
||||
import org.asamk.signal.manager.groups.LastGroupAdminException;
|
||||
import org.asamk.signal.manager.groups.NotAGroupMemberException;
|
||||
|
@ -138,20 +137,7 @@ public interface Manager extends Closeable {
|
|||
) throws IOException, AttachmentInvalidException;
|
||||
|
||||
SendGroupMessageResults updateGroup(
|
||||
GroupId groupId,
|
||||
String name,
|
||||
String description,
|
||||
Set<RecipientIdentifier.Single> members,
|
||||
Set<RecipientIdentifier.Single> removeMembers,
|
||||
Set<RecipientIdentifier.Single> admins,
|
||||
Set<RecipientIdentifier.Single> removeAdmins,
|
||||
boolean resetGroupLink,
|
||||
GroupLinkState groupLinkState,
|
||||
GroupPermission addMemberPermission,
|
||||
GroupPermission editDetailsPermission,
|
||||
File avatarFile,
|
||||
Integer expirationTimer,
|
||||
Boolean isAnnouncementGroup
|
||||
final GroupId groupId, final UpdateGroup updateGroup
|
||||
) throws IOException, GroupNotFoundException, AttachmentInvalidException, NotAGroupMemberException, GroupSendingNotAllowedException;
|
||||
|
||||
Pair<GroupId, SendGroupMessageResults> joinGroup(
|
||||
|
|
|
@ -25,13 +25,12 @@ import org.asamk.signal.manager.api.RecipientIdentifier;
|
|||
import org.asamk.signal.manager.api.SendGroupMessageResults;
|
||||
import org.asamk.signal.manager.api.SendMessageResults;
|
||||
import org.asamk.signal.manager.api.TypingAction;
|
||||
import org.asamk.signal.manager.api.UpdateGroup;
|
||||
import org.asamk.signal.manager.config.ServiceConfig;
|
||||
import org.asamk.signal.manager.config.ServiceEnvironmentConfig;
|
||||
import org.asamk.signal.manager.groups.GroupId;
|
||||
import org.asamk.signal.manager.groups.GroupInviteLinkUrl;
|
||||
import org.asamk.signal.manager.groups.GroupLinkState;
|
||||
import org.asamk.signal.manager.groups.GroupNotFoundException;
|
||||
import org.asamk.signal.manager.groups.GroupPermission;
|
||||
import org.asamk.signal.manager.groups.GroupSendingNotAllowedException;
|
||||
import org.asamk.signal.manager.groups.LastGroupAdminException;
|
||||
import org.asamk.signal.manager.groups.NotAGroupMemberException;
|
||||
|
@ -505,9 +504,12 @@ public class ManagerImpl implements Manager {
|
|||
.map(account.getRecipientStore()::resolveRecipientAddress)
|
||||
.collect(Collectors.toSet()),
|
||||
groupInfo.isBlocked(),
|
||||
groupInfo.getMessageExpirationTime(),
|
||||
groupInfo.isAnnouncementGroup(),
|
||||
groupInfo.isMember(account.getSelfRecipientId()));
|
||||
groupInfo.getMessageExpirationTimer(),
|
||||
groupInfo.getPermissionAddMember(),
|
||||
groupInfo.getPermissionEditDetails(),
|
||||
groupInfo.getPermissionSendMessage(),
|
||||
groupInfo.isMember(account.getSelfRecipientId()),
|
||||
groupInfo.isAdmin(account.getSelfRecipientId()));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -532,35 +534,22 @@ public class ManagerImpl implements Manager {
|
|||
|
||||
@Override
|
||||
public SendGroupMessageResults updateGroup(
|
||||
GroupId groupId,
|
||||
String name,
|
||||
String description,
|
||||
Set<RecipientIdentifier.Single> members,
|
||||
Set<RecipientIdentifier.Single> removeMembers,
|
||||
Set<RecipientIdentifier.Single> admins,
|
||||
Set<RecipientIdentifier.Single> removeAdmins,
|
||||
boolean resetGroupLink,
|
||||
GroupLinkState groupLinkState,
|
||||
GroupPermission addMemberPermission,
|
||||
GroupPermission editDetailsPermission,
|
||||
File avatarFile,
|
||||
Integer expirationTimer,
|
||||
Boolean isAnnouncementGroup
|
||||
final GroupId groupId, final UpdateGroup updateGroup
|
||||
) throws IOException, GroupNotFoundException, AttachmentInvalidException, NotAGroupMemberException, GroupSendingNotAllowedException {
|
||||
return groupHelper.updateGroup(groupId,
|
||||
name,
|
||||
description,
|
||||
members == null ? null : resolveRecipients(members),
|
||||
removeMembers == null ? null : resolveRecipients(removeMembers),
|
||||
admins == null ? null : resolveRecipients(admins),
|
||||
removeAdmins == null ? null : resolveRecipients(removeAdmins),
|
||||
resetGroupLink,
|
||||
groupLinkState,
|
||||
addMemberPermission,
|
||||
editDetailsPermission,
|
||||
avatarFile,
|
||||
expirationTimer,
|
||||
isAnnouncementGroup);
|
||||
updateGroup.getName(),
|
||||
updateGroup.getDescription(),
|
||||
updateGroup.getMembers() == null ? null : resolveRecipients(updateGroup.getMembers()),
|
||||
updateGroup.getRemoveMembers() == null ? null : resolveRecipients(updateGroup.getRemoveMembers()),
|
||||
updateGroup.getAdmins() == null ? null : resolveRecipients(updateGroup.getAdmins()),
|
||||
updateGroup.getRemoveAdmins() == null ? null : resolveRecipients(updateGroup.getRemoveAdmins()),
|
||||
updateGroup.isResetGroupLink(),
|
||||
updateGroup.getGroupLinkState(),
|
||||
updateGroup.getAddMemberPermission(),
|
||||
updateGroup.getEditDetailsPermission(),
|
||||
updateGroup.getAvatarFile(),
|
||||
updateGroup.getExpirationTimer(),
|
||||
updateGroup.getIsAnnouncementGroup());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -2,6 +2,7 @@ package org.asamk.signal.manager.api;
|
|||
|
||||
import org.asamk.signal.manager.groups.GroupId;
|
||||
import org.asamk.signal.manager.groups.GroupInviteLinkUrl;
|
||||
import org.asamk.signal.manager.groups.GroupPermission;
|
||||
import org.asamk.signal.manager.storage.recipients.RecipientAddress;
|
||||
|
||||
import java.util.Set;
|
||||
|
@ -17,9 +18,13 @@ public class Group {
|
|||
private final Set<RecipientAddress> requestingMembers;
|
||||
private final Set<RecipientAddress> adminMembers;
|
||||
private final boolean isBlocked;
|
||||
private final int messageExpirationTime;
|
||||
private final boolean isAnnouncementGroup;
|
||||
private final int messageExpirationTimer;
|
||||
|
||||
private final GroupPermission permissionAddMember;
|
||||
private final GroupPermission permissionEditDetails;
|
||||
private final GroupPermission permissionSendMessage;
|
||||
private final boolean isMember;
|
||||
private final boolean isAdmin;
|
||||
|
||||
public Group(
|
||||
final GroupId groupId,
|
||||
|
@ -31,9 +36,12 @@ public class Group {
|
|||
final Set<RecipientAddress> requestingMembers,
|
||||
final Set<RecipientAddress> adminMembers,
|
||||
final boolean isBlocked,
|
||||
final int messageExpirationTime,
|
||||
final boolean isAnnouncementGroup,
|
||||
final boolean isMember
|
||||
final int messageExpirationTimer,
|
||||
final GroupPermission permissionAddMember,
|
||||
final GroupPermission permissionEditDetails,
|
||||
final GroupPermission permissionSendMessage,
|
||||
final boolean isMember,
|
||||
final boolean isAdmin
|
||||
) {
|
||||
this.groupId = groupId;
|
||||
this.title = title;
|
||||
|
@ -44,9 +52,12 @@ public class Group {
|
|||
this.requestingMembers = requestingMembers;
|
||||
this.adminMembers = adminMembers;
|
||||
this.isBlocked = isBlocked;
|
||||
this.messageExpirationTime = messageExpirationTime;
|
||||
this.isAnnouncementGroup = isAnnouncementGroup;
|
||||
this.messageExpirationTimer = messageExpirationTimer;
|
||||
this.permissionAddMember = permissionAddMember;
|
||||
this.permissionEditDetails = permissionEditDetails;
|
||||
this.permissionSendMessage = permissionSendMessage;
|
||||
this.isMember = isMember;
|
||||
this.isAdmin = isAdmin;
|
||||
}
|
||||
|
||||
public GroupId getGroupId() {
|
||||
|
@ -85,15 +96,27 @@ public class Group {
|
|||
return isBlocked;
|
||||
}
|
||||
|
||||
public int getMessageExpirationTime() {
|
||||
return messageExpirationTime;
|
||||
public int getMessageExpirationTimer() {
|
||||
return messageExpirationTimer;
|
||||
}
|
||||
|
||||
public boolean isAnnouncementGroup() {
|
||||
return isAnnouncementGroup;
|
||||
public GroupPermission getPermissionAddMember() {
|
||||
return permissionAddMember;
|
||||
}
|
||||
|
||||
public GroupPermission getPermissionEditDetails() {
|
||||
return permissionEditDetails;
|
||||
}
|
||||
|
||||
public GroupPermission getPermissionSendMessage() {
|
||||
return permissionSendMessage;
|
||||
}
|
||||
|
||||
public boolean isMember() {
|
||||
return isMember;
|
||||
}
|
||||
|
||||
public boolean isAdmin() {
|
||||
return isAdmin;
|
||||
}
|
||||
}
|
||||
|
|
203
lib/src/main/java/org/asamk/signal/manager/api/UpdateGroup.java
Normal file
203
lib/src/main/java/org/asamk/signal/manager/api/UpdateGroup.java
Normal file
|
@ -0,0 +1,203 @@
|
|||
package org.asamk.signal.manager.api;
|
||||
|
||||
import org.asamk.signal.manager.groups.GroupLinkState;
|
||||
import org.asamk.signal.manager.groups.GroupPermission;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Set;
|
||||
|
||||
public class UpdateGroup {
|
||||
|
||||
private final String name;
|
||||
private final String description;
|
||||
private final Set<RecipientIdentifier.Single> members;
|
||||
private final Set<RecipientIdentifier.Single> removeMembers;
|
||||
private final Set<RecipientIdentifier.Single> admins;
|
||||
private final Set<RecipientIdentifier.Single> removeAdmins;
|
||||
private final boolean resetGroupLink;
|
||||
private final GroupLinkState groupLinkState;
|
||||
private final GroupPermission addMemberPermission;
|
||||
private final GroupPermission editDetailsPermission;
|
||||
private final File avatarFile;
|
||||
private final Integer expirationTimer;
|
||||
private final Boolean isAnnouncementGroup;
|
||||
|
||||
private UpdateGroup(final Builder builder) {
|
||||
name = builder.name;
|
||||
description = builder.description;
|
||||
members = builder.members;
|
||||
removeMembers = builder.removeMembers;
|
||||
admins = builder.admins;
|
||||
removeAdmins = builder.removeAdmins;
|
||||
resetGroupLink = builder.resetGroupLink;
|
||||
groupLinkState = builder.groupLinkState;
|
||||
addMemberPermission = builder.addMemberPermission;
|
||||
editDetailsPermission = builder.editDetailsPermission;
|
||||
avatarFile = builder.avatarFile;
|
||||
expirationTimer = builder.expirationTimer;
|
||||
isAnnouncementGroup = builder.isAnnouncementGroup;
|
||||
}
|
||||
|
||||
public static Builder newBuilder() {
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
public static Builder newBuilder(final UpdateGroup copy) {
|
||||
Builder builder = new Builder();
|
||||
builder.name = copy.getName();
|
||||
builder.description = copy.getDescription();
|
||||
builder.members = copy.getMembers();
|
||||
builder.removeMembers = copy.getRemoveMembers();
|
||||
builder.admins = copy.getAdmins();
|
||||
builder.removeAdmins = copy.getRemoveAdmins();
|
||||
builder.resetGroupLink = copy.isResetGroupLink();
|
||||
builder.groupLinkState = copy.getGroupLinkState();
|
||||
builder.addMemberPermission = copy.getAddMemberPermission();
|
||||
builder.editDetailsPermission = copy.getEditDetailsPermission();
|
||||
builder.avatarFile = copy.getAvatarFile();
|
||||
builder.expirationTimer = copy.getExpirationTimer();
|
||||
builder.isAnnouncementGroup = copy.getIsAnnouncementGroup();
|
||||
return builder;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public Set<RecipientIdentifier.Single> getMembers() {
|
||||
return members;
|
||||
}
|
||||
|
||||
public Set<RecipientIdentifier.Single> getRemoveMembers() {
|
||||
return removeMembers;
|
||||
}
|
||||
|
||||
public Set<RecipientIdentifier.Single> getAdmins() {
|
||||
return admins;
|
||||
}
|
||||
|
||||
public Set<RecipientIdentifier.Single> getRemoveAdmins() {
|
||||
return removeAdmins;
|
||||
}
|
||||
|
||||
public boolean isResetGroupLink() {
|
||||
return resetGroupLink;
|
||||
}
|
||||
|
||||
public GroupLinkState getGroupLinkState() {
|
||||
return groupLinkState;
|
||||
}
|
||||
|
||||
public GroupPermission getAddMemberPermission() {
|
||||
return addMemberPermission;
|
||||
}
|
||||
|
||||
public GroupPermission getEditDetailsPermission() {
|
||||
return editDetailsPermission;
|
||||
}
|
||||
|
||||
public File getAvatarFile() {
|
||||
return avatarFile;
|
||||
}
|
||||
|
||||
public Integer getExpirationTimer() {
|
||||
return expirationTimer;
|
||||
}
|
||||
|
||||
public Boolean getIsAnnouncementGroup() {
|
||||
return isAnnouncementGroup;
|
||||
}
|
||||
|
||||
public static final class Builder {
|
||||
|
||||
private String name;
|
||||
private String description;
|
||||
private Set<RecipientIdentifier.Single> members;
|
||||
private Set<RecipientIdentifier.Single> removeMembers;
|
||||
private Set<RecipientIdentifier.Single> admins;
|
||||
private Set<RecipientIdentifier.Single> removeAdmins;
|
||||
private boolean resetGroupLink;
|
||||
private GroupLinkState groupLinkState;
|
||||
private GroupPermission addMemberPermission;
|
||||
private GroupPermission editDetailsPermission;
|
||||
private File avatarFile;
|
||||
private Integer expirationTimer;
|
||||
private Boolean isAnnouncementGroup;
|
||||
|
||||
private Builder() {
|
||||
}
|
||||
|
||||
public Builder withName(final String val) {
|
||||
name = val;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder withDescription(final String val) {
|
||||
description = val;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder withMembers(final Set<RecipientIdentifier.Single> val) {
|
||||
members = val;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder withRemoveMembers(final Set<RecipientIdentifier.Single> val) {
|
||||
removeMembers = val;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder withAdmins(final Set<RecipientIdentifier.Single> val) {
|
||||
admins = val;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder withRemoveAdmins(final Set<RecipientIdentifier.Single> val) {
|
||||
removeAdmins = val;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder withResetGroupLink(final boolean val) {
|
||||
resetGroupLink = val;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder withGroupLinkState(final GroupLinkState val) {
|
||||
groupLinkState = val;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder withAddMemberPermission(final GroupPermission val) {
|
||||
addMemberPermission = val;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder withEditDetailsPermission(final GroupPermission val) {
|
||||
editDetailsPermission = val;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder withAvatarFile(final File val) {
|
||||
avatarFile = val;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder withExpirationTimer(final Integer val) {
|
||||
expirationTimer = val;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder withIsAnnouncementGroup(final Boolean val) {
|
||||
isAnnouncementGroup = val;
|
||||
return this;
|
||||
}
|
||||
|
||||
public UpdateGroup build() {
|
||||
return new UpdateGroup(this);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -639,7 +639,7 @@ public class GroupHelper {
|
|||
|
||||
return SignalServiceDataMessage.newBuilder()
|
||||
.asGroupMessage(group.build())
|
||||
.withExpiration(g.getMessageExpirationTime());
|
||||
.withExpiration(g.getMessageExpirationTimer());
|
||||
}
|
||||
|
||||
private SignalServiceDataMessage.Builder getGroupUpdateMessageBuilder(GroupInfoV2 g, byte[] signedGroupChange) {
|
||||
|
@ -648,7 +648,7 @@ public class GroupHelper {
|
|||
.withSignedGroupChange(signedGroupChange);
|
||||
return SignalServiceDataMessage.newBuilder()
|
||||
.asGroupMessage(group.build())
|
||||
.withExpiration(g.getMessageExpirationTime());
|
||||
.withExpiration(g.getMessageExpirationTimer());
|
||||
}
|
||||
|
||||
private SendGroupMessageResults sendUpdateGroupV2Message(
|
||||
|
|
|
@ -100,7 +100,7 @@ public class SendHelper {
|
|||
final SignalServiceDataMessage.Builder messageBuilder, final GroupInfo g
|
||||
) throws IOException, GroupSendingNotAllowedException {
|
||||
GroupUtils.setGroupContext(messageBuilder, g);
|
||||
messageBuilder.withExpiration(g.getMessageExpirationTime());
|
||||
messageBuilder.withExpiration(g.getMessageExpirationTimer());
|
||||
|
||||
final var message = messageBuilder.build();
|
||||
final var recipients = g.getMembersWithout(account.getSelfRecipientId());
|
||||
|
|
|
@ -2,6 +2,7 @@ package org.asamk.signal.manager.storage.groups;
|
|||
|
||||
import org.asamk.signal.manager.groups.GroupId;
|
||||
import org.asamk.signal.manager.groups.GroupInviteLinkUrl;
|
||||
import org.asamk.signal.manager.groups.GroupPermission;
|
||||
import org.asamk.signal.manager.storage.recipients.RecipientId;
|
||||
|
||||
import java.util.Set;
|
||||
|
@ -38,10 +39,16 @@ public abstract class GroupInfo {
|
|||
|
||||
public abstract void setBlocked(boolean blocked);
|
||||
|
||||
public abstract int getMessageExpirationTime();
|
||||
public abstract int getMessageExpirationTimer();
|
||||
|
||||
public abstract boolean isAnnouncementGroup();
|
||||
|
||||
public abstract GroupPermission getPermissionAddMember();
|
||||
|
||||
public abstract GroupPermission getPermissionEditDetails();
|
||||
|
||||
public abstract GroupPermission getPermissionSendMessage();
|
||||
|
||||
public Set<RecipientId> getMembersWithout(RecipientId recipientId) {
|
||||
return getMembers().stream().filter(member -> !member.equals(recipientId)).collect(Collectors.toSet());
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package org.asamk.signal.manager.storage.groups;
|
|||
import org.asamk.signal.manager.groups.GroupIdV1;
|
||||
import org.asamk.signal.manager.groups.GroupIdV2;
|
||||
import org.asamk.signal.manager.groups.GroupInviteLinkUrl;
|
||||
import org.asamk.signal.manager.groups.GroupPermission;
|
||||
import org.asamk.signal.manager.groups.GroupUtils;
|
||||
import org.asamk.signal.manager.storage.recipients.RecipientId;
|
||||
|
||||
|
@ -85,7 +86,7 @@ public class GroupInfoV1 extends GroupInfo {
|
|||
}
|
||||
|
||||
@Override
|
||||
public int getMessageExpirationTime() {
|
||||
public int getMessageExpirationTimer() {
|
||||
return messageExpirationTime;
|
||||
}
|
||||
|
||||
|
@ -94,6 +95,21 @@ public class GroupInfoV1 extends GroupInfo {
|
|||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public GroupPermission getPermissionAddMember() {
|
||||
return GroupPermission.EVERY_MEMBER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public GroupPermission getPermissionEditDetails() {
|
||||
return GroupPermission.EVERY_MEMBER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public GroupPermission getPermissionSendMessage() {
|
||||
return GroupPermission.EVERY_MEMBER;
|
||||
}
|
||||
|
||||
public void addMembers(Collection<RecipientId> members) {
|
||||
this.members.addAll(members);
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package org.asamk.signal.manager.storage.groups;
|
|||
|
||||
import org.asamk.signal.manager.groups.GroupIdV2;
|
||||
import org.asamk.signal.manager.groups.GroupInviteLinkUrl;
|
||||
import org.asamk.signal.manager.groups.GroupPermission;
|
||||
import org.asamk.signal.manager.storage.recipients.RecipientId;
|
||||
import org.asamk.signal.manager.storage.recipients.RecipientResolver;
|
||||
import org.signal.storageservice.protos.groups.AccessControl;
|
||||
|
@ -151,7 +152,7 @@ public class GroupInfoV2 extends GroupInfo {
|
|||
}
|
||||
|
||||
@Override
|
||||
public int getMessageExpirationTime() {
|
||||
public int getMessageExpirationTimer() {
|
||||
return this.group != null && this.group.hasDisappearingMessagesTimer()
|
||||
? this.group.getDisappearingMessagesTimer().getDuration()
|
||||
: 0;
|
||||
|
@ -162,6 +163,23 @@ public class GroupInfoV2 extends GroupInfo {
|
|||
return this.group != null && this.group.getIsAnnouncementGroup() == EnabledState.ENABLED;
|
||||
}
|
||||
|
||||
@Override
|
||||
public GroupPermission getPermissionAddMember() {
|
||||
final var accessControl = getAccessControl();
|
||||
return accessControl == null ? GroupPermission.EVERY_MEMBER : toGroupPermission(accessControl.getMembers());
|
||||
}
|
||||
|
||||
@Override
|
||||
public GroupPermission getPermissionEditDetails() {
|
||||
final var accessControl = getAccessControl();
|
||||
return accessControl == null ? GroupPermission.EVERY_MEMBER : toGroupPermission(accessControl.getAttributes());
|
||||
}
|
||||
|
||||
@Override
|
||||
public GroupPermission getPermissionSendMessage() {
|
||||
return isAnnouncementGroup() ? GroupPermission.ONLY_ADMINS : GroupPermission.EVERY_MEMBER;
|
||||
}
|
||||
|
||||
public void setPermissionDenied(final boolean permissionDenied) {
|
||||
this.permissionDenied = permissionDenied;
|
||||
}
|
||||
|
@ -169,4 +187,22 @@ public class GroupInfoV2 extends GroupInfo {
|
|||
public boolean isPermissionDenied() {
|
||||
return permissionDenied;
|
||||
}
|
||||
|
||||
private AccessControl getAccessControl() {
|
||||
if (this.group == null || !this.group.hasAccessControl()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return this.group.getAccessControl();
|
||||
}
|
||||
|
||||
private static GroupPermission toGroupPermission(final AccessControl.AccessRequired permission) {
|
||||
switch (permission) {
|
||||
case ADMINISTRATOR:
|
||||
return GroupPermission.ONLY_ADMINS;
|
||||
case MEMBER:
|
||||
default:
|
||||
return GroupPermission.EVERY_MEMBER;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue