isolated tenant improvements
This commit is contained in:
parent
d380ac7106
commit
e83d69c40c
@ -28,6 +28,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
|
|||||||
import org.springframework.web.bind.annotation.ResponseStatus;
|
import org.springframework.web.bind.annotation.ResponseStatus;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
import org.thingsboard.server.common.data.Tenant;
|
import org.thingsboard.server.common.data.Tenant;
|
||||||
|
import org.thingsboard.server.common.data.exception.ThingsboardErrorCode;
|
||||||
import org.thingsboard.server.common.data.exception.ThingsboardException;
|
import org.thingsboard.server.common.data.exception.ThingsboardException;
|
||||||
import org.thingsboard.server.common.data.id.TenantId;
|
import org.thingsboard.server.common.data.id.TenantId;
|
||||||
import org.thingsboard.server.common.data.page.TextPageData;
|
import org.thingsboard.server.common.data.page.TextPageData;
|
||||||
@ -72,6 +73,16 @@ public class TenantController extends BaseController {
|
|||||||
try {
|
try {
|
||||||
boolean newTenant = tenant.getId() == null;
|
boolean newTenant = tenant.getId() == null;
|
||||||
|
|
||||||
|
if (!newTenant) {
|
||||||
|
Tenant oldTenant = tenantService.findTenantById(tenant.getTenantId());
|
||||||
|
if (oldTenant.isIsolatedTbCore() != tenant.isIsolatedTbCore()) {
|
||||||
|
throw new ThingsboardException("Field isolatedTbCore from Tenant can't be changed.", ThingsboardErrorCode.BAD_REQUEST_PARAMS);
|
||||||
|
}
|
||||||
|
if (oldTenant.isIsolatedTbRuleEngine() != tenant.isIsolatedTbRuleEngine()) {
|
||||||
|
throw new ThingsboardException("Field isolatedTbRuleEngine from Tenant can't be changed.", ThingsboardErrorCode.BAD_REQUEST_PARAMS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Operation operation = newTenant ? Operation.CREATE : Operation.WRITE;
|
Operation operation = newTenant ? Operation.CREATE : Operation.WRITE;
|
||||||
|
|
||||||
accessControlService.checkPermission(getCurrentUser(), Resource.TENANT, operation,
|
accessControlService.checkPermission(getCurrentUser(), Resource.TENANT, operation,
|
||||||
|
|||||||
@ -221,7 +221,10 @@ public class SqlDatabaseUpgradeService implements DatabaseEntitiesUpgradeService
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
try {
|
||||||
conn.createStatement().execute("ALTER TABLE tenant ADD COLUMN isolated_tb_core boolean DEFAULT (false), ADD COLUMN isolated_tb_rule_engine boolean DEFAULT (false)");
|
conn.createStatement().execute("ALTER TABLE tenant ADD COLUMN isolated_tb_core boolean DEFAULT (false), ADD COLUMN isolated_tb_rule_engine boolean DEFAULT (false)");
|
||||||
|
} catch (Exception e) {
|
||||||
|
}
|
||||||
log.info("Schema updated.");
|
log.info("Schema updated.");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|||||||
@ -47,14 +47,14 @@
|
|||||||
</md-input-container>
|
</md-input-container>
|
||||||
<tb-contact contact="tenant" the-form="theForm" is-edit="isEdit"></tb-contact>
|
<tb-contact contact="tenant" the-form="theForm" is-edit="isEdit"></tb-contact>
|
||||||
<md-input-container class="md-block">
|
<md-input-container class="md-block">
|
||||||
<md-checkbox ng-disabled="$root.loading || !isEdit"
|
<md-checkbox ng-disabled="{{theForm.$name != 'theForm'}}"
|
||||||
ng-model="tenant.isolatedTbCore">
|
ng-model="tenant.isolatedTbCore">
|
||||||
{{'tenant.isolated-tb-core' | translate}}<br/>
|
{{'tenant.isolated-tb-core' | translate}}<br/>
|
||||||
<span style="font-size: 10px">{{'tenant.isolated-tb-core-details' | translate}}</span>
|
<span style="font-size: 10px">{{'tenant.isolated-tb-core-details' | translate}}</span>
|
||||||
</md-checkbox>
|
</md-checkbox>
|
||||||
</md-input-container>
|
</md-input-container>
|
||||||
<md-input-container class="md-block">
|
<md-input-container class="md-block">
|
||||||
<md-checkbox ng-disabled="$root.loading || !isEdit"
|
<md-checkbox ng-disabled="{{theForm.$name != 'theForm'}}"
|
||||||
ng-model="tenant.isolatedTbRuleEngine">
|
ng-model="tenant.isolatedTbRuleEngine">
|
||||||
{{'tenant.isolated-tb-rule-engine' | translate}}<br/>
|
{{'tenant.isolated-tb-rule-engine' | translate}}<br/>
|
||||||
<span style="font-size: 10px">{{'tenant.isolated-tb-rule-engine-details' | translate}}</span>
|
<span style="font-size: 10px">{{'tenant.isolated-tb-rule-engine-details' | translate}}</span>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user