committed by
GitHub
128 changed files with 1480 additions and 772 deletions
|
Before Width: | Height: | Size: 42 KiB After Width: | Height: | Size: 42 KiB |
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1,74 +0,0 @@ |
|||
{ |
|||
"widgetsBundle": { |
|||
"alias": "scada_water_system_symbols", |
|||
"title": "SCADA water system symbols", |
|||
"scada": true, |
|||
"image": null, |
|||
"description": "Bundle with SCADA symbols for water system", |
|||
"order": 9300, |
|||
"name": "SCADA water system symbols" |
|||
}, |
|||
"widgetTypeFqns": [ |
|||
"horizontal_pipe", |
|||
"long_horizontal_pipe", |
|||
"vertical_pipe", |
|||
"long_vertical_pipe", |
|||
"left_bottom_elbow_pipe", |
|||
"bottom_right_elbow_pipe", |
|||
"top_right_elbow_pipe", |
|||
"left_top_elbow_pipe", |
|||
"cross_pipe", |
|||
"left_tee_pipe", |
|||
"bottom_tee_pipe", |
|||
"right_tee_pipe", |
|||
"top_tee_pipe", |
|||
"right_elbow_drain_pipe", |
|||
"left_elbow_drain_pipe", |
|||
"left_drain_pipe", |
|||
"right_drain_pipe", |
|||
"short_left_drain_pipe", |
|||
"short_right_drain_pipe", |
|||
"top_flow_meter", |
|||
"right_flow_meter", |
|||
"bottom_flow_meter", |
|||
"left_flow_meter", |
|||
"horizontal_inline_flow_meter", |
|||
"vertical_inline_flow_meter", |
|||
"left_analog_water_level_meter", |
|||
"right_analog_water_level_meter", |
|||
"leak_sensor", |
|||
"centrifugal_pump", |
|||
"small_right_motor_pump", |
|||
"small_left_motor_pump", |
|||
"right_motor_pump", |
|||
"left_motor_pump", |
|||
"right_heat_pump", |
|||
"left_heat_pump", |
|||
"short_bottom_filter", |
|||
"long_bottom_filter", |
|||
"short_top_filter", |
|||
"long_top_filter", |
|||
"stand_filter", |
|||
"horizontal_wheel_valve", |
|||
"vertical_wheel_valve", |
|||
"horizontal_ball_valve", |
|||
"vertical_ball_valve", |
|||
"water_stop", |
|||
"vertical_tank", |
|||
"stand_vertical_tank", |
|||
"cylindrical_tank", |
|||
"stand_cylindrical_tank", |
|||
"vertical_short_tank", |
|||
"stand_vertical_short_tank", |
|||
"large_cylindrical_tank", |
|||
"large_stand_cylindrical_tank", |
|||
"large_vertical_tank", |
|||
"large_stand_vertical_tank", |
|||
"horizontal_tank", |
|||
"stand_horizontal_tank", |
|||
"spherical_tank", |
|||
"small_spherical_tank", |
|||
"elevated_tank", |
|||
"pool" |
|||
] |
|||
} |
|||
File diff suppressed because one or more lines are too long
@ -0,0 +1,26 @@ |
|||
/** |
|||
* Copyright © 2016-2024 The Thingsboard Authors |
|||
* |
|||
* Licensed under the Apache License, Version 2.0 (the "License"); |
|||
* you may not use this file except in compliance with the License. |
|||
* You may obtain a copy of the License at |
|||
* |
|||
* http://www.apache.org/licenses/LICENSE-2.0
|
|||
* |
|||
* Unless required by applicable law or agreed to in writing, software |
|||
* distributed under the License is distributed on an "AS IS" BASIS, |
|||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|||
* See the License for the specific language governing permissions and |
|||
* limitations under the License. |
|||
*/ |
|||
package org.thingsboard.server.cache; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
public interface VersionedCacheKey extends Serializable { |
|||
|
|||
default boolean isVersioned() { |
|||
return false; |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,19 @@ |
|||
/** |
|||
* Copyright © 2016-2024 The Thingsboard Authors |
|||
* |
|||
* Licensed under the Apache License, Version 2.0 (the "License"); |
|||
* you may not use this file except in compliance with the License. |
|||
* You may obtain a copy of the License at |
|||
* |
|||
* http://www.apache.org/licenses/LICENSE-2.0
|
|||
* |
|||
* Unless required by applicable law or agreed to in writing, software |
|||
* distributed under the License is distributed on an "AS IS" BASIS, |
|||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|||
* See the License for the specific language governing permissions and |
|||
* limitations under the License. |
|||
*/ |
|||
package org.thingsboard.server.common.data; |
|||
|
|||
public record UserActivationLink(String value, long ttlMs) { |
|||
} |
|||
@ -0,0 +1,81 @@ |
|||
/** |
|||
* Copyright © 2016-2024 The Thingsboard Authors |
|||
* |
|||
* Licensed under the Apache License, Version 2.0 (the "License"); |
|||
* you may not use this file except in compliance with the License. |
|||
* You may obtain a copy of the License at |
|||
* |
|||
* http://www.apache.org/licenses/LICENSE-2.0
|
|||
* |
|||
* Unless required by applicable law or agreed to in writing, software |
|||
* distributed under the License is distributed on an "AS IS" BASIS, |
|||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|||
* See the License for the specific language governing permissions and |
|||
* limitations under the License. |
|||
*/ |
|||
package org.thingsboard.server.dao.settings; |
|||
|
|||
import lombok.RequiredArgsConstructor; |
|||
import org.springframework.cache.annotation.CacheEvict; |
|||
import org.springframework.cache.annotation.Cacheable; |
|||
import org.springframework.stereotype.Service; |
|||
import org.thingsboard.common.util.JacksonUtil; |
|||
import org.thingsboard.server.common.data.AdminSettings; |
|||
import org.thingsboard.server.common.data.id.TenantId; |
|||
import org.thingsboard.server.common.data.security.model.SecuritySettings; |
|||
import org.thingsboard.server.common.data.security.model.UserPasswordPolicy; |
|||
import org.thingsboard.server.dao.service.ConstraintValidator; |
|||
|
|||
import static org.thingsboard.server.common.data.CacheConstants.SECURITY_SETTINGS_CACHE; |
|||
|
|||
@Service |
|||
@RequiredArgsConstructor |
|||
public class DefaultSecuritySettingsService implements SecuritySettingsService { |
|||
|
|||
private final AdminSettingsService adminSettingsService; |
|||
|
|||
public static final int DEFAULT_MOBILE_SECRET_KEY_LENGTH = 64; |
|||
|
|||
@Cacheable(cacheNames = SECURITY_SETTINGS_CACHE, key = "'securitySettings'") |
|||
@Override |
|||
public SecuritySettings getSecuritySettings() { |
|||
AdminSettings adminSettings = adminSettingsService.findAdminSettingsByKey(TenantId.SYS_TENANT_ID, "securitySettings"); |
|||
SecuritySettings securitySettings; |
|||
if (adminSettings != null) { |
|||
try { |
|||
securitySettings = JacksonUtil.convertValue(adminSettings.getJsonValue(), SecuritySettings.class); |
|||
} catch (Exception e) { |
|||
throw new RuntimeException("Failed to load security settings!", e); |
|||
} |
|||
} else { |
|||
securitySettings = new SecuritySettings(); |
|||
securitySettings.setPasswordPolicy(new UserPasswordPolicy()); |
|||
securitySettings.getPasswordPolicy().setMinimumLength(6); |
|||
securitySettings.getPasswordPolicy().setMaximumLength(72); |
|||
securitySettings.setMobileSecretKeyLength(DEFAULT_MOBILE_SECRET_KEY_LENGTH); |
|||
securitySettings.setPasswordResetTokenTtl(24); |
|||
securitySettings.setUserActivationTokenTtl(24); |
|||
} |
|||
return securitySettings; |
|||
} |
|||
|
|||
@CacheEvict(cacheNames = SECURITY_SETTINGS_CACHE, key = "'securitySettings'") |
|||
@Override |
|||
public SecuritySettings saveSecuritySettings(SecuritySettings securitySettings) { |
|||
ConstraintValidator.validateFields(securitySettings); |
|||
AdminSettings adminSettings = adminSettingsService.findAdminSettingsByKey(TenantId.SYS_TENANT_ID, "securitySettings"); |
|||
if (adminSettings == null) { |
|||
adminSettings = new AdminSettings(); |
|||
adminSettings.setTenantId(TenantId.SYS_TENANT_ID); |
|||
adminSettings.setKey("securitySettings"); |
|||
} |
|||
adminSettings.setJsonValue(JacksonUtil.valueToTree(securitySettings)); |
|||
AdminSettings savedAdminSettings = adminSettingsService.saveAdminSettings(TenantId.SYS_TENANT_ID, adminSettings); |
|||
try { |
|||
return JacksonUtil.convertValue(savedAdminSettings.getJsonValue(), SecuritySettings.class); |
|||
} catch (Exception e) { |
|||
throw new RuntimeException("Failed to load security settings!", e); |
|||
} |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,26 @@ |
|||
/** |
|||
* Copyright © 2016-2024 The Thingsboard Authors |
|||
* |
|||
* Licensed under the Apache License, Version 2.0 (the "License"); |
|||
* you may not use this file except in compliance with the License. |
|||
* You may obtain a copy of the License at |
|||
* |
|||
* http://www.apache.org/licenses/LICENSE-2.0
|
|||
* |
|||
* Unless required by applicable law or agreed to in writing, software |
|||
* distributed under the License is distributed on an "AS IS" BASIS, |
|||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|||
* See the License for the specific language governing permissions and |
|||
* limitations under the License. |
|||
*/ |
|||
package org.thingsboard.server.dao.settings; |
|||
|
|||
import org.thingsboard.server.common.data.security.model.SecuritySettings; |
|||
|
|||
public interface SecuritySettingsService { |
|||
|
|||
SecuritySettings getSecuritySettings(); |
|||
|
|||
SecuritySettings saveSecuritySettings(SecuritySettings securitySettings); |
|||
|
|||
} |
|||
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue