Merge pull request #11 from thingsboard/feature/cloud
Separate application artifact from spring boot jar
This commit is contained in:
		
						commit
						6dc6dc063c
					
				@ -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"
 | 
			
		||||
 | 
			
		||||
@ -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>
 | 
			
		||||
 | 
			
		||||
@ -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");
 | 
			
		||||
 | 
			
		||||
@ -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 {
 | 
			
		||||
 | 
			
		||||
@ -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;
 | 
			
		||||
@ -102,6 +104,11 @@ public class DefaultMailService implements MailService {
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @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 {
 | 
			
		||||
        JavaMailSenderImpl testMailSender = createMailSender(jsonConfig);
 | 
			
		||||
 | 
			
		||||
@ -23,6 +23,8 @@ public interface MailService {
 | 
			
		||||
 | 
			
		||||
    void updateMailConfiguration();
 | 
			
		||||
 | 
			
		||||
    void sendEmail(String email, String subject, String message) throws ThingsboardException;
 | 
			
		||||
    
 | 
			
		||||
    void sendTestMail(JsonNode config, String email) throws ThingsboardException;
 | 
			
		||||
    
 | 
			
		||||
    void sendActivationEmail(String activationLink, String email) throws ThingsboardException;
 | 
			
		||||
 | 
			
		||||
@ -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);
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user