Search in sources :

Example 36 with IdentityUser

use of com.sequenceiq.cloudbreak.common.model.user.IdentityUser in project cloudbreak by hortonworks.

the class EmailSenderService method sendTerminationSuccessEmail.

@Async
public void sendTerminationSuccessEmail(String owner, String email, String ambariServer, String clusterName) {
    IdentityUser user = userDetailsService.getDetails(owner, UserFilterField.USERID);
    sendEmail(user, email, successClusterMailTemplatePath, "Your cluster has been terminated", getEmailModel(user.getGivenName(), ambariServer, State.TERMINATION_SUCCESS, clusterName));
}
Also used : IdentityUser(com.sequenceiq.cloudbreak.common.model.user.IdentityUser) Async(org.springframework.scheduling.annotation.Async)

Example 37 with IdentityUser

use of com.sequenceiq.cloudbreak.common.model.user.IdentityUser in project cloudbreak by hortonworks.

the class EmailSenderService method sendUpscaleSuccessEmail.

public void sendUpscaleSuccessEmail(String owner, String email, String ambariServer, String clusterName) {
    IdentityUser user = userDetailsService.getDetails(owner, UserFilterField.USERID);
    sendEmail(user, email, successClusterMailTemplatePath, String.format(CLUSTER_READY_SUBJECT, clusterName), getEmailModel(user.getGivenName(), ambariServer, State.UPSCALE_SUCCESS, clusterName));
}
Also used : IdentityUser(com.sequenceiq.cloudbreak.common.model.user.IdentityUser)

Example 38 with IdentityUser

use of com.sequenceiq.cloudbreak.common.model.user.IdentityUser in project cloudbreak by hortonworks.

the class EmailSenderService method sendStartFailureEmail.

@Async
public void sendStartFailureEmail(String owner, String email, String ambariServer, String clusterName) {
    IdentityUser user = userDetailsService.getDetails(owner, UserFilterField.USERID);
    sendEmail(user, email, failedClusterMailTemplatePath, "Cluster start failed", getEmailModel(user.getGivenName(), ambariServer, State.START_FAILURE, clusterName));
}
Also used : IdentityUser(com.sequenceiq.cloudbreak.common.model.user.IdentityUser) Async(org.springframework.scheduling.annotation.Async)

Example 39 with IdentityUser

use of com.sequenceiq.cloudbreak.common.model.user.IdentityUser in project cloudbreak by hortonworks.

the class EmailSenderService method sendStopFailureEmail.

@Async
public void sendStopFailureEmail(String owner, String email, String ambariServer, String clusterName) {
    IdentityUser user = userDetailsService.getDetails(owner, UserFilterField.USERID);
    sendEmail(user, email, failedClusterMailTemplatePath, "Cluster stop failed", getEmailModel(user.getGivenName(), ambariServer, State.STOP_FAILURE, clusterName));
}
Also used : IdentityUser(com.sequenceiq.cloudbreak.common.model.user.IdentityUser) Async(org.springframework.scheduling.annotation.Async)

Example 40 with IdentityUser

use of com.sequenceiq.cloudbreak.common.model.user.IdentityUser in project cloudbreak by hortonworks.

the class AccountPreferencesValidator method validateUserTimeToLive.

public void validateUserTimeToLive(String owner, AccountPreferences preferences) throws AccountPreferencesValidationException {
    Long userTimeToLive = preferences.getUserTimeToLive();
    if (needToValidateField(userTimeToLive)) {
        IdentityUser identityUser = userDetailsService.getDetails(owner, UserFilterField.USERID);
        long now = Calendar.getInstance().getTimeInMillis();
        long userActiveTime = now - identityUser.getCreated().getTime();
        if (userActiveTime > userTimeToLive) {
            throw new AccountPreferencesValidationException("The user demo time is expired!");
        }
    }
}
Also used : IdentityUser(com.sequenceiq.cloudbreak.common.model.user.IdentityUser)

Aggregations

IdentityUser (com.sequenceiq.cloudbreak.common.model.user.IdentityUser)133 Test (org.junit.Test)14 Stack (com.sequenceiq.cloudbreak.domain.Stack)13 UserFilterField (com.sequenceiq.cloudbreak.common.service.user.UserFilterField)9 Async (org.springframework.scheduling.annotation.Async)9 Blueprint (com.sequenceiq.cloudbreak.domain.Blueprint)8 Credential (com.sequenceiq.cloudbreak.domain.Credential)8 FlexSubscription (com.sequenceiq.cloudbreak.domain.FlexSubscription)8 Cluster (com.sequenceiq.cloudbreak.domain.Cluster)7 LdapConfig (com.sequenceiq.cloudbreak.domain.LdapConfig)7 ProxyConfig (com.sequenceiq.cloudbreak.domain.ProxyConfig)7 ImageCatalog (com.sequenceiq.cloudbreak.domain.ImageCatalog)6 RDSConfig (com.sequenceiq.cloudbreak.domain.RDSConfig)6 Before (org.junit.Before)6 TestingAuthenticationToken (org.springframework.security.authentication.TestingAuthenticationToken)6 UpdateStackJson (com.sequenceiq.cloudbreak.api.model.UpdateStackJson)5 Template (com.sequenceiq.cloudbreak.domain.Template)5 ConstraintTemplate (com.sequenceiq.cloudbreak.domain.ConstraintTemplate)4 Network (com.sequenceiq.cloudbreak.domain.Network)4 Recipe (com.sequenceiq.cloudbreak.domain.Recipe)4