mirror of
https://github.com/Sheldan/abstracto.git
synced 2026-04-02 16:05:00 +00:00
added mod mail thread notification, if a user initiates a mod mail thread
added the concept of a mod mail role, these are roles being pinged when a thread is opened, and they also are able to execute mod mail related commands fixed past thread count in mod mail header added convenience method to allow a role to execute a whole feature
This commit is contained in:
@@ -56,6 +56,14 @@ public class CommandServiceBean implements CommandService {
|
||||
commandForServer.setRestricted(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void allowFeatureForRole(FeatureEnum featureEnum, ARole role) {
|
||||
AFeature feature = featureManagementService.getFeature(featureEnum.getKey());
|
||||
feature.getCommands().forEach(command -> {
|
||||
this.allowCommandForRole(command, role);
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void makeRoleImmuneForCommand(ACommand aCommand, ARole role) {
|
||||
ACommandInAServer commandForServer = commandInServerManagementService.getCommandForServer(aCommand, role.getServer());
|
||||
|
||||
@@ -15,6 +15,7 @@ import dev.sheldan.abstracto.core.config.FeatureEnum;
|
||||
import dev.sheldan.abstracto.core.config.features.CoreFeatures;
|
||||
import dev.sheldan.abstracto.core.models.database.AFeature;
|
||||
import dev.sheldan.abstracto.core.models.database.ARole;
|
||||
import dev.sheldan.abstracto.core.service.FeatureFlagService;
|
||||
import dev.sheldan.abstracto.core.service.management.RoleManagementService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
@@ -37,15 +38,16 @@ public class AllowRole extends AbstractConditionableCommand {
|
||||
@Autowired
|
||||
private RoleManagementService roleManagementService;
|
||||
|
||||
@Autowired
|
||||
private FeatureFlagService featureFlagService;
|
||||
|
||||
@Override
|
||||
public CommandResult execute(CommandContext commandContext) {
|
||||
String name = (String) commandContext.getParameters().getParameters().get(0);
|
||||
ARole role = (ARole) commandContext.getParameters().getParameters().get(1);
|
||||
if(featureManagementService.featureExists(name)) {
|
||||
AFeature feature = featureManagementService.getFeature(name);
|
||||
feature.getCommands().forEach(command ->
|
||||
commandService.allowCommandForRole(command, role)
|
||||
);
|
||||
FeatureEnum featureEnum = featureFlagService.getFeatureEnum(name);
|
||||
commandService.allowFeatureForRole(featureEnum, role);
|
||||
} else if(commandManagementService.doesCommandExist(name)) {
|
||||
ACommand command = commandManagementService.findCommandByName(name);
|
||||
commandService.allowCommandForRole(command, role);
|
||||
|
||||
Reference in New Issue
Block a user