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