Merge pull request #11 from thingsboard/feature/cloud

Separate application artifact from spring boot jar
This commit is contained in:
Andrew Shvayka 2016-12-14 17:07:07 +02:00 committed by GitHub
commit 6dc6dc063c
7 changed files with 18 additions and 6 deletions

View File

@ -49,7 +49,7 @@ ospackage {
from(mainJar) {
// Strip the version from the jar filename
rename { String fileName ->
fileName.replace("-${project.version}", "")
"${pkgName}.jar"
}
fileMode 0500
into "bin"

View File

@ -379,6 +379,7 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<classifier>boot</classifier>
<layout>ZIP</layout>
<executable>true</executable>
<excludeDevtools>true</excludeDevtools>
@ -408,7 +409,7 @@
<args>
<arg>-PprojectBuildDir=${project.build.directory}</arg>
<arg>-PprojectVersion=${project.version}</arg>
<arg>-PmainJar=${project.build.directory}/${project.build.finalName}.${project.packaging}</arg>
<arg>-PmainJar=${project.build.directory}/${project.build.finalName}-boot.${project.packaging}</arg>
<arg>-PpkgName=${pkg.name}</arg>
<arg>-PpkgInstallFolder=${pkg.installFolder}</arg>
<arg>-PpkgLogFolder=${pkg.logFolder}</arg>

View File

@ -18,12 +18,14 @@ package org.thingsboard.server.config;
import org.springframework.context.MessageSource;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.springframework.context.support.ResourceBundleMessageSource;
@Configuration
public class ThingsboardMessageConfiguration {
@Bean
@Primary
public MessageSource messageSource() {
ResourceBundleMessageSource messageSource = new ResourceBundleMessageSource();
messageSource.setBasename("i18n/messages");

View File

@ -33,7 +33,7 @@ import java.util.List;
@RequestMapping("/api")
public class WidgetsBundleController extends BaseController {
@PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN')")
@PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN', 'CUSTOMER_USER')")
@RequestMapping(value = "/widgetsBundle/{widgetsBundleId}", method = RequestMethod.GET)
@ResponseBody
public WidgetsBundle getWidgetsBundleById(@PathVariable("widgetsBundleId") String strWidgetsBundleId) throws ThingsboardException {
@ -76,7 +76,7 @@ public class WidgetsBundleController extends BaseController {
}
}
@PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN')")
@PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN', 'CUSTOMER_USER')")
@RequestMapping(value = "/widgetsBundles", params = { "limit" }, method = RequestMethod.GET)
@ResponseBody
public TextPageData<WidgetsBundle> getWidgetsBundles(
@ -97,7 +97,7 @@ public class WidgetsBundleController extends BaseController {
}
}
@PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN')")
@PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN', 'CUSTOMER_USER')")
@RequestMapping(value = "/widgetsBundles", method = RequestMethod.GET)
@ResponseBody
public List<WidgetsBundle> getWidgetsBundles() throws ThingsboardException {

View File

@ -26,6 +26,7 @@ import javax.mail.internet.MimeMessage;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.apache.velocity.app.VelocityEngine;
import org.springframework.beans.factory.annotation.Qualifier;
import org.thingsboard.server.exception.ThingsboardErrorCode;
import org.thingsboard.server.exception.ThingsboardException;
import org.thingsboard.server.common.data.AdminSettings;
@ -50,6 +51,7 @@ public class DefaultMailService implements MailService {
private MessageSource messages;
@Autowired
@Qualifier("velocityEngine")
private VelocityEngine engine;
private JavaMailSenderImpl mailSender;
@ -101,6 +103,11 @@ public class DefaultMailService implements MailService {
throw new IncorrectParameterException(String.format("Invalid smtp port value: %s", strPort));
}
}
@Override
public void sendEmail(String email, String subject, String message) throws ThingsboardException {
sendMail(mailSender, mailFrom, email, subject, message);
}
@Override
public void sendTestMail(JsonNode jsonConfig, String email) throws ThingsboardException {

View File

@ -22,6 +22,8 @@ import com.fasterxml.jackson.databind.JsonNode;
public interface MailService {
void updateMailConfiguration();
void sendEmail(String email, String subject, String message) throws ThingsboardException;
void sendTestMail(JsonNode config, String email) throws ThingsboardException;

View File

@ -156,7 +156,7 @@ public class UserServiceImpl implements UserService {
UserCredentialsEntity userCredentialsEntity = userCredentialsDao.findByUserId(userEntity.getId());
UserCredentials userCredentials = getData(userCredentialsEntity);
if (!userCredentials.isEnabled()) {
throw new IncorrectParameterException("Unable to reset password for unactive user");
throw new IncorrectParameterException("Unable to reset password for inactive user");
}
userCredentials.setResetToken(RandomStringUtils.randomAlphanumeric(30));
return saveUserCredentials(userCredentials);