fixed user multi selection

This commit is contained in:
anhefti 2020-03-04 09:30:49 +01:00
parent a076c62d46
commit db143e1b37
3 changed files with 49 additions and 43 deletions

View file

@ -21,6 +21,7 @@ import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size; import javax.validation.constraints.Size;
import ch.ethz.seb.sebserver.gbl.model.EntityName;
import org.apache.commons.lang3.BooleanUtils; import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.joda.time.DateTime; import org.joda.time.DateTime;
@ -243,6 +244,14 @@ public final class UserInfo implements UserAccount, Serializable {
return new EntityKey(this.uuid, entityType()); return new EntityKey(this.uuid, entityType());
} }
@Override
public EntityName toName() {
return new EntityName(
this.getModelId(),
this.entityType(),
this.getUsername() + " (" + this.getSurname() + " " + this.getName() + ")");
}
@Override @Override
public int hashCode() { public int hashCode() {
final int prime = 31; final int prime = 31;

View file

@ -74,6 +74,7 @@ public final class MultiSelectionCombo extends Composite implements Selection {
this.dropDown = new DropDown(this.textInput, SWT.NONE); this.dropDown = new DropDown(this.textInput, SWT.NONE);
this.textInput.addListener(SWT.FocusIn, event -> openDropDown()); this.textInput.addListener(SWT.FocusIn, event -> openDropDown());
this.textInput.addListener(SWT.Modify, event -> openDropDown()); this.textInput.addListener(SWT.Modify, event -> openDropDown());
this.textInput.addListener(SWT.MouseUp, event -> openDropDown());
this.dropDown.addListener(SWT.Selection, event -> { this.dropDown.addListener(SWT.Selection, event -> {
final int selectionIndex = this.dropDown.getSelectionIndex(); final int selectionIndex = this.dropDown.getSelectionIndex();
if (selectionIndex >= 0) { if (selectionIndex >= 0) {
@ -171,7 +172,6 @@ public final class MultiSelectionCombo extends Composite implements Selection {
this.availableValues.remove(item); this.availableValues.remove(item);
PageService.updateScrolledComposite(this); PageService.updateScrolledComposite(this);
this.updateAnchor.layout(true, true); this.updateAnchor.layout(true, true);
} }
private void removeComboSelection(final Event event) { private void removeComboSelection(final Event event) {

View file

@ -89,8 +89,6 @@ class AdminUserInitializer {
} }
} else { } else {
final CharSequence generateAdminPassword = this.generateAdminPassword(); final CharSequence generateAdminPassword = this.generateAdminPassword();
if (generateAdminPassword != null) {
Long institutionId = this.institutionDAO.allMatching(new FilterMap()) Long institutionId = this.institutionDAO.allMatching(new FilterMap())
.getOrElse(Collections::emptyList) .getOrElse(Collections::emptyList)
.stream() .stream()
@ -133,7 +131,6 @@ class AdminUserInitializer {
}) })
.getOrThrow(); .getOrThrow();
} }
}
} catch (final Exception e) { } catch (final Exception e) {
SEBServerInit.INIT_LOGGER.error("---->"); SEBServerInit.INIT_LOGGER.error("---->");
SEBServerInit.INIT_LOGGER.error("----> SEB Server initial admin-account creation failed: ", e); SEBServerInit.INIT_LOGGER.error("----> SEB Server initial admin-account creation failed: ", e);
@ -161,7 +158,7 @@ class AdminUserInitializer {
return ClientCredentialServiceImpl.generateClientSecret(); return ClientCredentialServiceImpl.generateClientSecret();
} catch (final Exception e) { } catch (final Exception e) {
log.error("Unable to generate admin password: ", e); log.error("Unable to generate admin password: ", e);
return null; throw e;
} }
} }