Commit 6dc6dc063cbf8fce88ed30013ad1d19e3b4f0936

Authored by Andrew Shvayka
Committed by GitHub
2 parents a4ae4162 d2654c93

Merge pull request #11 from thingsboard/feature/cloud

Separate application artifact from spring boot jar
... ... @@ -49,7 +49,7 @@ ospackage {
49 49 from(mainJar) {
50 50 // Strip the version from the jar filename
51 51 rename { String fileName ->
52   - fileName.replace("-${project.version}", "")
  52 + "${pkgName}.jar"
53 53 }
54 54 fileMode 0500
55 55 into "bin"
... ...
... ... @@ -379,6 +379,7 @@
379 379 <groupId>org.springframework.boot</groupId>
380 380 <artifactId>spring-boot-maven-plugin</artifactId>
381 381 <configuration>
  382 + <classifier>boot</classifier>
382 383 <layout>ZIP</layout>
383 384 <executable>true</executable>
384 385 <excludeDevtools>true</excludeDevtools>
... ... @@ -408,7 +409,7 @@
408 409 <args>
409 410 <arg>-PprojectBuildDir=${project.build.directory}</arg>
410 411 <arg>-PprojectVersion=${project.version}</arg>
411   - <arg>-PmainJar=${project.build.directory}/${project.build.finalName}.${project.packaging}</arg>
  412 + <arg>-PmainJar=${project.build.directory}/${project.build.finalName}-boot.${project.packaging}</arg>
412 413 <arg>-PpkgName=${pkg.name}</arg>
413 414 <arg>-PpkgInstallFolder=${pkg.installFolder}</arg>
414 415 <arg>-PpkgLogFolder=${pkg.logFolder}</arg>
... ...
... ... @@ -18,12 +18,14 @@ package org.thingsboard.server.config;
18 18 import org.springframework.context.MessageSource;
19 19 import org.springframework.context.annotation.Bean;
20 20 import org.springframework.context.annotation.Configuration;
  21 +import org.springframework.context.annotation.Primary;
21 22 import org.springframework.context.support.ResourceBundleMessageSource;
22 23
23 24 @Configuration
24 25 public class ThingsboardMessageConfiguration {
25 26
26 27 @Bean
  28 + @Primary
27 29 public MessageSource messageSource() {
28 30 ResourceBundleMessageSource messageSource = new ResourceBundleMessageSource();
29 31 messageSource.setBasename("i18n/messages");
... ...
... ... @@ -33,7 +33,7 @@ import java.util.List;
33 33 @RequestMapping("/api")
34 34 public class WidgetsBundleController extends BaseController {
35 35
36   - @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN')")
  36 + @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN', 'CUSTOMER_USER')")
37 37 @RequestMapping(value = "/widgetsBundle/{widgetsBundleId}", method = RequestMethod.GET)
38 38 @ResponseBody
39 39 public WidgetsBundle getWidgetsBundleById(@PathVariable("widgetsBundleId") String strWidgetsBundleId) throws ThingsboardException {
... ... @@ -76,7 +76,7 @@ public class WidgetsBundleController extends BaseController {
76 76 }
77 77 }
78 78
79   - @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN')")
  79 + @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN', 'CUSTOMER_USER')")
80 80 @RequestMapping(value = "/widgetsBundles", params = { "limit" }, method = RequestMethod.GET)
81 81 @ResponseBody
82 82 public TextPageData<WidgetsBundle> getWidgetsBundles(
... ... @@ -97,7 +97,7 @@ public class WidgetsBundleController extends BaseController {
97 97 }
98 98 }
99 99
100   - @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN')")
  100 + @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN', 'CUSTOMER_USER')")
101 101 @RequestMapping(value = "/widgetsBundles", method = RequestMethod.GET)
102 102 @ResponseBody
103 103 public List<WidgetsBundle> getWidgetsBundles() throws ThingsboardException {
... ...
... ... @@ -26,6 +26,7 @@ import javax.mail.internet.MimeMessage;
26 26 import lombok.extern.slf4j.Slf4j;
27 27 import org.apache.commons.lang3.StringUtils;
28 28 import org.apache.velocity.app.VelocityEngine;
  29 +import org.springframework.beans.factory.annotation.Qualifier;
29 30 import org.thingsboard.server.exception.ThingsboardErrorCode;
30 31 import org.thingsboard.server.exception.ThingsboardException;
31 32 import org.thingsboard.server.common.data.AdminSettings;
... ... @@ -50,6 +51,7 @@ public class DefaultMailService implements MailService {
50 51 private MessageSource messages;
51 52
52 53 @Autowired
  54 + @Qualifier("velocityEngine")
53 55 private VelocityEngine engine;
54 56
55 57 private JavaMailSenderImpl mailSender;
... ... @@ -101,6 +103,11 @@ public class DefaultMailService implements MailService {
101 103 throw new IncorrectParameterException(String.format("Invalid smtp port value: %s", strPort));
102 104 }
103 105 }
  106 +
  107 + @Override
  108 + public void sendEmail(String email, String subject, String message) throws ThingsboardException {
  109 + sendMail(mailSender, mailFrom, email, subject, message);
  110 + }
104 111
105 112 @Override
106 113 public void sendTestMail(JsonNode jsonConfig, String email) throws ThingsboardException {
... ...
... ... @@ -22,6 +22,8 @@ import com.fasterxml.jackson.databind.JsonNode;
22 22 public interface MailService {
23 23
24 24 void updateMailConfiguration();
  25 +
  26 + void sendEmail(String email, String subject, String message) throws ThingsboardException;
25 27
26 28 void sendTestMail(JsonNode config, String email) throws ThingsboardException;
27 29
... ...
... ... @@ -156,7 +156,7 @@ public class UserServiceImpl implements UserService {
156 156 UserCredentialsEntity userCredentialsEntity = userCredentialsDao.findByUserId(userEntity.getId());
157 157 UserCredentials userCredentials = getData(userCredentialsEntity);
158 158 if (!userCredentials.isEnabled()) {
159   - throw new IncorrectParameterException("Unable to reset password for unactive user");
  159 + throw new IncorrectParameterException("Unable to reset password for inactive user");
160 160 }
161 161 userCredentials.setResetToken(RandomStringUtils.randomAlphanumeric(30));
162 162 return saveUserCredentials(userCredentials);
... ...