Skip to content
This repository has been archived by the owner on Mar 31, 2022. It is now read-only.

Commit

Permalink
Rework admin multitenancy role #14
Browse files Browse the repository at this point in the history
change after CR
  • Loading branch information
plakhov committed Jul 22, 2021
1 parent 0d45c27 commit b568c21
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,9 @@ access to writing native SQL or Groovy code (JMX Console, SQL/Groovy bands in th
@Autowired
private ComboBox<String> tenantIdField;

@Autowired
private TenantProvider tenantProvider;

@Autowired
private MultitenancyUiSupport multitenancyUiSupport;

Expand All @@ -179,6 +182,15 @@ access to writing native SQL or Groovy code (JMX Console, SQL/Groovy bands in th
public void onInit(InitEvent event){
tenantIdField.setOptionsList(multitenancyUiSupport.getTenantOptions());
}

@Subscribe
public void onBeforeShow(BeforeShowEvent event) {
String currentTenantId = tenantProvider.getCurrentUserTenantId();
if (!currentTenantId.equals(TenantProvider.NO_TENANT) && Strings.isNullOrEmpty(tenantIdField.getValue())) {
tenantIdField.setEditable(false);
tenantIdField.setValue(currentTenantId);
}
}

@Subscribe("tenantIdField")
public void onTenantIdFieldValueChange(HasValue.ValueChangeEvent<String> event) {
Expand Down

0 comments on commit b568c21

Please sign in to comment.