Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #19150: Add option to disable email notifications for change-request #3588

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ trait ReadConfigService {
def rudder_workflow_enabled(): IOResult[Boolean]
def rudder_workflow_self_validation(): IOResult[Boolean]
def rudder_workflow_self_deployment(): IOResult[Boolean]
def rudder_workflow_email_notification_enabled(): IOResult[Boolean]

/**
* CFEngine server properties
Expand Down Expand Up @@ -253,6 +254,7 @@ trait UpdateConfigService {
def set_rudder_workflow_enabled(value: Boolean): IOResult[Unit]
def set_rudder_workflow_self_validation(value: Boolean): IOResult[Unit]
def set_rudder_workflow_self_deployment(value: Boolean): IOResult[Unit]
def set_rudder_workflow_email_notification_enabled(value: Boolean): IOResult[Unit]

/**
* Set CFEngine server properties
Expand Down Expand Up @@ -401,6 +403,7 @@ class LDAPBasedConfigService(
rudder.ui.changeMessage.mandatory=false
rudder.ui.changeMessage.explanation=Please enter a reason explaining this change.
rudder.workflow.enabled=false
rudder.workflow.email.notification.enabled=false
rudder.workflow.self.validation=false
rudder.workflow.self.deployment=true
cfengine.server.denybadclocks=true
Expand Down Expand Up @@ -578,6 +581,8 @@ class LDAPBasedConfigService(
false.succeed
}
}

def rudder_workflow_email_notification_enabled() = get("rudder_workflow_email_notification_enabled")
def rudder_workflow_self_validation() = get("rudder_workflow_self_validation")
def rudder_workflow_self_deployment() = get("rudder_workflow_self_deployment")
def set_rudder_workflow_enabled(value: Boolean): IOResult[Unit] = {
Expand All @@ -588,6 +593,8 @@ class LDAPBasedConfigService(
Inconsistency("You can't change the change validation workflow type. Perhaps are you missing the 'changes validation' plugin?").fail
}
}

def set_rudder_workflow_email_notification_enabled(value: Boolean): IOResult[Unit] = save("rudder_workflow_email_notification_enabled", value)
def set_rudder_workflow_self_validation(value: Boolean): IOResult[Unit] = save("rudder_workflow_self_validation", value)
def set_rudder_workflow_self_deployment(value: Boolean): IOResult[Unit] = save("rudder_workflow_self_deployment", value)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ class SettingsApi(
RestChangeMessageManadatory ::
RestChangeMessagePrompt ::
RestChangeRequestEnabled ::
RestChangeRequestEmailNotification ::
RestChangeRequestSelfValidation ::
RestChangeRequestSelfDeployment ::
RestChangesGraphs ::
Expand Down Expand Up @@ -507,6 +508,12 @@ final case object RestChangeRequestEnabled extends RestBooleanSetting {
def get = configService.rudder_workflow_enabled()
def set = (value : Boolean, _, _) => configService.set_rudder_workflow_enabled(value)
}
final case object RestChangeRequestEmailNotification extends RestBooleanSetting {
val startPolicyGeneration = false
val key = "enable_email_notification"
def get = configService.rudder_workflow_email_notification_enabled()
def set = (value : Boolean, _, _) => configService.set_rudder_workflow_email_notification_enabled(value)
}
final case object RestChangeRequestSelfDeployment extends RestBooleanSetting {
val startPolicyGeneration = false
val key = "enable_self_deployment"
Expand Down