Skip to content

Commit

Permalink
[25968] fix saving changes to user is admin and is active
Browse files Browse the repository at this point in the history
  • Loading branch information
huthomas committed Dec 1, 2023
1 parent ea323ea commit 0cd3987
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@
import ch.elexis.core.ui.actions.RestrictedAction;
import ch.elexis.core.ui.coolbar.MandantSelectionContributionItem;
import ch.elexis.core.ui.data.UiMandant;
import ch.elexis.core.ui.databinding.SavingUpdateValueStrategy;
import ch.elexis.core.ui.dialogs.ChangePasswordDialog;
import ch.elexis.core.ui.dialogs.KontaktSelektor;
import ch.elexis.core.ui.icons.Images;
Expand Down Expand Up @@ -1003,20 +1004,22 @@ public void update(ViewerCell cell) {
}
}

@SuppressWarnings({ "unchecked", "deprecation", "rawtypes" })
protected DataBindingContext initDataBindings() {
DataBindingContext bindingContext = new DataBindingContext();
//
IObservableValue observeSelectionBtnIsAdminObserveWidget = WidgetProperties.selection().observe(btnUserIsAdmin);
IObservableValue wvAdminObserveDetailValue = PojoProperties.value(IUser.class, "administrator", Boolean.class) //$NON-NLS-1$
.observeDetail(wvUser);
bindingContext.bindValue(observeSelectionBtnIsAdminObserveWidget, wvAdminObserveDetailValue, null, null);
bindingContext.bindValue(observeSelectionBtnIsAdminObserveWidget, wvAdminObserveDetailValue,
new SavingUpdateValueStrategy(CoreModelServiceHolder.get(), wvUser), null);

IObservableValue observeSelectionBtnIsActiveObserveWidget = WidgetProperties.selection()
.observe(btnUserIsLocked);
IObservableValue wvActiveObserveDetailValue = PojoProperties.value(IUser.class, "active", Boolean.class) //$NON-NLS-1$
.observeDetail(wvUser);
bindingContext.bindValue(observeSelectionBtnIsActiveObserveWidget, wvActiveObserveDetailValue,
new UpdateValueStrategy().setConverter(new BooleanNotConverter()),
new SavingUpdateValueStrategy(CoreModelServiceHolder.get(), wvUser).setConverter(new BooleanNotConverter()),
new UpdateValueStrategy().setConverter(new BooleanNotConverter()));
//
return bindingContext;
Expand Down

0 comments on commit 0cd3987

Please sign in to comment.