Renaming
This commit is contained in:
		
							parent
							
								
									349e7402a4
								
							
						
					
					
						commit
						63dd915e1b
					
				@ -130,7 +130,7 @@ public class AdminController extends BaseController {
 | 
			
		||||
            @PathVariable("key") String key) throws ThingsboardException {
 | 
			
		||||
        accessControlService.checkPermission(getCurrentUser(), Resource.ADMIN_SETTINGS, Operation.READ);
 | 
			
		||||
        AdminSettings adminSettings = checkNotNull(adminSettingsService.findAdminSettingsByKey(TenantId.SYS_TENANT_ID, key), "No Administration settings found for key: " + key);
 | 
			
		||||
        if (adminSettings.getKey().equals("mail")) {
 | 
			
		||||
        if (adminSettings.getKey().equals(MAIL_SETTINGS_KEY)) {
 | 
			
		||||
            ((ObjectNode) adminSettings.getJsonValue()).remove("password");
 | 
			
		||||
            ((ObjectNode) adminSettings.getJsonValue()).remove("refreshToken");
 | 
			
		||||
        }
 | 
			
		||||
@ -149,7 +149,7 @@ public class AdminController extends BaseController {
 | 
			
		||||
        accessControlService.checkPermission(getCurrentUser(), Resource.ADMIN_SETTINGS, Operation.WRITE);
 | 
			
		||||
        adminSettings.setTenantId(getTenantId());
 | 
			
		||||
        adminSettings = checkNotNull(adminSettingsService.saveAdminSettings(TenantId.SYS_TENANT_ID, adminSettings));
 | 
			
		||||
        if (adminSettings.getKey().equals("mail")) {
 | 
			
		||||
        if (adminSettings.getKey().equals(MAIL_SETTINGS_KEY)) {
 | 
			
		||||
            mailService.updateMailConfiguration();
 | 
			
		||||
            ((ObjectNode) adminSettings.getJsonValue()).remove("password");
 | 
			
		||||
            ((ObjectNode) adminSettings.getJsonValue()).remove("refreshToken");
 | 
			
		||||
@ -212,9 +212,9 @@ public class AdminController extends BaseController {
 | 
			
		||||
            @RequestBody AdminSettings adminSettings) throws ThingsboardException {
 | 
			
		||||
        accessControlService.checkPermission(getCurrentUser(), Resource.ADMIN_SETTINGS, Operation.READ);
 | 
			
		||||
        adminSettings = checkNotNull(adminSettings);
 | 
			
		||||
        if (adminSettings.getKey().equals("mail")) {
 | 
			
		||||
        if (adminSettings.getKey().equals(MAIL_SETTINGS_KEY)) {
 | 
			
		||||
            if (adminSettings.getJsonValue().has("enableOauth2") && adminSettings.getJsonValue().get("enableOauth2").asBoolean()) {
 | 
			
		||||
                AdminSettings mailSettings = checkNotNull(adminSettingsService.findAdminSettingsByKey(TenantId.SYS_TENANT_ID, "mail"));
 | 
			
		||||
                AdminSettings mailSettings = checkNotNull(adminSettingsService.findAdminSettingsByKey(TenantId.SYS_TENANT_ID, MAIL_SETTINGS_KEY));
 | 
			
		||||
                JsonNode refreshToken = mailSettings.getJsonValue().get("refreshToken");
 | 
			
		||||
                if (refreshToken == null) {
 | 
			
		||||
                    throw new ThingsboardException("Refresh token was not generated. Please, generate refresh token.", ThingsboardErrorCode.GENERAL);
 | 
			
		||||
@ -223,7 +223,7 @@ public class AdminController extends BaseController {
 | 
			
		||||
                settings.put("refreshToken", refreshToken.asText());
 | 
			
		||||
            } else {
 | 
			
		||||
                if (!adminSettings.getJsonValue().has("password")) {
 | 
			
		||||
                    AdminSettings mailSettings = checkNotNull(adminSettingsService.findAdminSettingsByKey(TenantId.SYS_TENANT_ID, "mail"));
 | 
			
		||||
                    AdminSettings mailSettings = checkNotNull(adminSettingsService.findAdminSettingsByKey(TenantId.SYS_TENANT_ID, MAIL_SETTINGS_KEY));
 | 
			
		||||
                    ((ObjectNode) adminSettings.getJsonValue()).put("password", mailSettings.getJsonValue().get("password").asText());
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user