Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions config/initial-objects/report/110-report-user-list.xml
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,16 @@
<previousColumn>nameColumn</previousColumn>
</column>
<column id="8">
<name>activationColumn</name>
<path>activation/administrativeStatus</path>
<name>displayNameColumn</name>
<path>displayName</path>
<previousColumn>fullNameColumn</previousColumn>
</column>
<column id="9">
<name>activationColumn</name>
<path>activation/administrativeStatus</path>
<previousColumn>displayNameColumn</previousColumn>
</column>
<column id="10">
<name>roleColumn</name>
<path>assignment</path>
<display>
Expand Down Expand Up @@ -133,7 +138,7 @@
</export>
<previousColumn>activationColumn</previousColumn>
</column>
<column id="10">
<column id="11">
<name>orgColumn</name>
<path>assignment</path>
<display>
Expand Down Expand Up @@ -165,7 +170,7 @@
</export>
<previousColumn>roleColumn</previousColumn>
</column>
<column id="11">
<column id="12">
<name>accountColumn</name>
<path>linkRef</path>
<display>
Expand Down
1 change: 1 addition & 0 deletions config/initial-objects/user/050-user-administrator.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
<name>administrator</name>
<indestructible>true</indestructible>
<fullName>midPoint Administrator</fullName>
<displayName>midPoint Administrator</displayName>
<givenName>midPoint</givenName>
<familyName>Administrator</familyName>
<assignment id="1">
Expand Down
11 changes: 11 additions & 0 deletions config/sql/native/postgres-upgrade.sql
Original file line number Diff line number Diff line change
Expand Up @@ -1168,6 +1168,17 @@ CREATE INDEX m_connector_typeVersionHost_key
WHERE connectorHostRefTargetOid IS NOT NULL;
$aa$);

call apply_change(58, $aa$
ALTER TABLE m_user
ADD COLUMN displayNameOrig TEXT,
ADD COLUMN displayNameNorm TEXT,
ADD COLUMN preferredNameOrig TEXT,
ADD COLUMN preferredNameNorm TEXT;

CREATE INDEX m_user_displayNameOrig_idx ON m_user (displayNameOrig);
CREATE INDEX m_user_preferredNameOrig_idx ON m_user (preferredNameOrig);
$aa$);

---
-- WRITE CHANGES ABOVE ^^
-- IMPORTANT: update apply_change number at the end of postgres-new.sql
Expand Down
8 changes: 7 additions & 1 deletion config/sql/native/postgres.sql
Original file line number Diff line number Diff line change
Expand Up @@ -632,6 +632,8 @@ CREATE TABLE m_user (
CHECK (objectType = 'USER'),
additionalNameOrig TEXT,
additionalNameNorm TEXT,
displayNameOrig TEXT,
displayNameNorm TEXT,
employeeNumber TEXT,
familyNameOrig TEXT,
familyNameNorm TEXT,
Expand All @@ -646,6 +648,8 @@ CREATE TABLE m_user (
nickNameOrig TEXT,
nickNameNorm TEXT,
personalNumber TEXT,
preferredNameOrig TEXT,
preferredNameNorm TEXT,
titleOrig TEXT,
titleNorm TEXT,
organizations JSONB, -- array of {o,n} objects (poly-strings)
Expand All @@ -664,10 +668,12 @@ CREATE INDEX m_user_nameOrig_idx ON m_user (nameOrig);
CREATE UNIQUE INDEX m_user_nameNorm_key ON m_user (nameNorm);
CREATE INDEX m_user_policySituation_idx ON m_user USING gin(policysituations gin__int_ops);
CREATE INDEX m_user_ext_idx ON m_user USING gin(ext);
CREATE INDEX m_user_displayNameOrig_idx ON m_user (displayNameOrig);
CREATE INDEX m_user_fullNameOrig_idx ON m_user (fullNameOrig);
CREATE INDEX m_user_familyNameOrig_idx ON m_user (familyNameOrig);
CREATE INDEX m_user_givenNameOrig_idx ON m_user (givenNameOrig);
CREATE INDEX m_user_employeeNumber_idx ON m_user (employeeNumber);
CREATE INDEX m_user_preferredNameOrig_idx ON m_user (preferredNameOrig);
CREATE INDEX m_user_subtypes_idx ON m_user USING gin(subtypes);
CREATE INDEX m_user_organizations_idx ON m_user USING gin(organizations);
CREATE INDEX m_user_organizationUnits_idx ON m_user USING gin(organizationUnits);
Expand Down Expand Up @@ -2689,4 +2695,4 @@ END $$;
-- This is important to avoid applying any change more than once.
-- Also update SqaleUtils.CURRENT_SCHEMA_CHANGE_NUMBER
-- repo/repo-sqale/src/main/java/com/evolveum/midpoint/repo/sqale/SqaleUtils.java
call apply_change(57, $$ SELECT 1 $$, true);
call apply_change(58, $$ SELECT 1 $$, true);
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ public static String getReferencedObjectDisplayNameAndName(Referencable ref, boo
ObjectType object = prismObject.asObjectable();
String displayName = null;
if (object instanceof UserType) {
displayName = getTranslatedPolyString(((UserType) object).getFullName());
displayName = getTranslatedPolyString(((UserType) object).getDisplayName());
} else if (object instanceof AbstractRoleType) {
displayName = getTranslatedPolyString(((AbstractRoleType) object).getDisplayName());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ public class SearchBoxConfigurationBuilder {
ItemPath.create(ObjectType.F_NAME))
);
FIXED_SEARCH_ITEMS.put(UserType.class, Arrays.asList(
ItemPath.create(UserType.F_FULL_NAME)
ItemPath.create(UserType.F_FULL_NAME),
ItemPath.create(UserType.F_DISPLAY_NAME)
));
FIXED_SEARCH_ITEMS.put(AbstractRoleType.class, Arrays.asList(
ItemPath.create(RoleType.F_DISPLAY_NAME)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ public SearchableItemsDefinitions additionalSearchContext(SearchContext ctx) {
ItemPath.create(UserType.F_GIVEN_NAME),
ItemPath.create(UserType.F_FAMILY_NAME),
ItemPath.create(UserType.F_FULL_NAME),
ItemPath.create(UserType.F_DISPLAY_NAME),
ItemPath.create(UserType.F_ADDITIONAL_NAME),
ItemPath.create(UserType.F_EMPLOYEE_NUMBER),
ItemPath.create(UserType.F_ORGANIZATIONAL_UNIT),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ default ObjectFilter createAutocompleteFilter(String text, SearchFilterType filt

default String getDefaultUserDisplayName(PrismObject<UserType> o) {
String name = WebComponentUtil.getOrigStringFromPoly(o.getName());
String fullName = WebComponentUtil.getOrigStringFromPoly(o.asObjectable().getFullName());
String displayName = WebComponentUtil.getOrigStringFromPoly(o.asObjectable().getDisplayName());

return StringUtils.isNotEmpty(fullName) ? fullName + " (" + name + ")" : name;
return StringUtils.isNotEmpty(displayName) ? displayName + " (" + name + ")" : name;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import com.evolveum.midpoint.gui.api.model.LoadableModel;
import com.evolveum.midpoint.gui.api.page.PageBase;
import com.evolveum.midpoint.gui.api.util.LocalizationUtil;
import com.evolveum.midpoint.gui.api.util.WebComponentUtil;
import com.evolveum.midpoint.gui.api.util.WebModelServiceUtils;
import com.evolveum.midpoint.gui.impl.component.input.DateTimePickerPanel;
import com.evolveum.midpoint.gui.impl.page.admin.user.PageUser;
Expand Down Expand Up @@ -624,8 +625,8 @@ private String getUserDisplayName(){
} else {
UserType delegationUser = getModelObject().getDelegationOwner();
if (getModelObject().getDelegationOwner() != null) {
if (delegationUser.getFullName() != null && StringUtils.isNotEmpty(delegationUser.getFullName().getOrig())) {
displayName = delegationUser.getFullName().getOrig() + " (" + delegationUser.getName().getOrig() + ")";
if (delegationUser.getDisplayName() != null && StringUtils.isNotEmpty(delegationUser.getDisplayName().getOrig())) {
displayName = delegationUser.getDisplayName().getOrig() + " (" + delegationUser.getName().getOrig() + ")";
} else {
displayName = delegationUser.getName() != null ? delegationUser.getName().getOrig() : "";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,8 @@ public static <T extends ObjectType> List<IColumn<SelectableBean<T>, String>> ge
SelectableBeanImpl.F_VALUE + ".familyName", false, true),
new ColumnTypeDto<>("UserType.fullName", UserType.F_FULL_NAME.getLocalPart(),
SelectableBeanImpl.F_VALUE + ".fullName", false, true),
new ColumnTypeDto<>("UserType.displayName", UserType.F_DISPLAY_NAME.getLocalPart(),
SelectableBeanImpl.F_VALUE + ".displayName", false, true),
new ColumnTypeDto<>("UserType.emailAddress", UserType.F_EMAIL_ADDRESS.getLocalPart(),
SelectableBeanImpl.F_VALUE + ".emailAddress", false)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import com.evolveum.midpoint.security.api.MidPointPrincipal;
import com.evolveum.midpoint.util.logging.Trace;
import com.evolveum.midpoint.util.logging.TraceManager;
import com.evolveum.midpoint.xml.ns._public.common.common_3.UserType;

/**
* @author Viliam Repan (lazyman)
Expand Down Expand Up @@ -132,6 +133,12 @@ private String getShortUserName() {
}

if (principalObj instanceof MidPointPrincipal principal) {
if (principal.getFocus() instanceof UserType user) {
String displayName = WebComponentUtil.getOrigStringFromPoly(user.getDisplayName());
if (StringUtils.isNotEmpty(displayName)) {
return displayName;
}
}
return WebComponentUtil.getOrigStringFromPoly(principal.getName());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.UserType;

import org.apache.commons.lang3.StringUtils;

import static com.evolveum.midpoint.gui.api.page.PageBase.createEnumResourceKey;
import static com.evolveum.midpoint.gui.api.page.PageBase.createStringResourceStatic;
import static com.evolveum.midpoint.schema.util.CertCampaignTypeUtil.norm;
Expand Down Expand Up @@ -65,7 +67,7 @@ public static String resolveOwnerName(ObjectReferenceType ownerRef, PageBase pag
ObjectType owner = ownerObject.asObjectable();
if (owner instanceof UserType) {
UserType user = (UserType) owner;
return WebComponentUtil.getName(user) + " (" + WebComponentUtil.getOrigStringFromPoly(user.getFullName()) + ")";
return WebComponentUtil.getName(user) + " (" + WebComponentUtil.getOrigStringFromPoly(user.getDisplayName()) + ")";
} else {
return WebComponentUtil.getName(owner);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,16 +73,16 @@ public String getCaseInfoButtonTitle(IModel<? extends CertCaseOrWorkItemDto> row
String objectType = getLocalizedTypeName(acase.getObjectRef().getType(), page);
String objectName = dto.getObjectName();

// If object is UserType, display user's fullName in addition to the name
// If object is UserType, display user's displayName in addition to the name
if (QNameUtil.match(acase.getObjectRef().getType(), UserType.COMPLEX_TYPE)) {
try {
PrismObject<UserType> object = page.getModelService().getObject(UserType.class, acase.getObjectRef().getOid(), null, page.getPageTask(), page.getPageTask().getResult());

if (object != null) {
UserType userObj = object.asObjectable();
PolyStringType fullName = userObj.getFullName();
if (fullName != null && !StringUtils.isEmpty(fullName.getOrig())) {
objectName = fullName.getOrig() + " (" + objectName + ")";
PolyStringType displayName = userObj.getDisplayName();
if (displayName != null && !StringUtils.isEmpty(displayName.getOrig())) {
objectName = displayName.getOrig() + " (" + objectName + ")";
}
}
} catch (Exception e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ private void initLayout(Class<F> type){

Label fullNameLabel;
if (UserType.class.equals(type)){
fullNameLabel = new Label(ID_OBJECT_FULLNAME, ((UserType) mergeObject).getFullName());
fullNameLabel = new Label(ID_OBJECT_FULLNAME, ((UserType) mergeObject).getDisplayName());
} else {
fullNameLabel = new Label(ID_OBJECT_FULLNAME, ((AbstractRoleType) mergeObject).getDisplayName());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,10 @@
import com.evolveum.midpoint.gui.impl.util.RelationUtil;
import com.evolveum.midpoint.xml.ns._public.common.common_3.*;

import org.apache.wicket.model.IModel;

import com.evolveum.midpoint.gui.api.GuiStyleConstants;
import com.evolveum.midpoint.web.component.FocusSummaryPanel;
import com.evolveum.midpoint.web.component.util.SummaryTag;
import org.apache.wicket.model.IModel;

/**
* @author semancik
Expand Down Expand Up @@ -124,7 +123,7 @@ protected void initialize(UserType object) {

@Override
protected QName getDisplayNamePropertyName() {
return UserType.F_FULL_NAME;
return UserType.F_DISPLAY_NAME;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,10 @@ private List<IColumn<SelectableBean<UserType>, String>> initColumns() {
UserType.F_FAMILY_NAME.getLocalPart(), SelectableBeanImpl.F_VALUE + ".familyName");
columns.add(column);

column = new PropertyColumn<>(createStringResource("UserType.displayName"),
UserType.F_DISPLAY_NAME.getLocalPart(), SelectableBeanImpl.F_VALUE + ".displayName");
columns.add(column);

column = new PropertyColumn<>(createStringResource("UserType.fullName"),
UserType.F_FULL_NAME.getLocalPart(), SelectableBeanImpl.F_VALUE + ".fullName");
columns.add(column);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -884,16 +884,16 @@ public static LocalizableMessage createDisplayInformation(PrismObject<?> object,
}

/**
* - User name is in the form of "full name (object name)".
* - User name is in the form of "display name (object name)".
* - Names for other objects are either "detailed display name" ({@link #getDetailedDisplayName(Objectable)}) or plain name.
*/
private static Object getDescriptiveName(Objectable object) {
if (object instanceof UserType) {
PolyStringType fullName = ((UserType) object).getFullName();
if (fullName != null) {
PolyStringType displayName = ((UserType) object).getDisplayName();
if (displayName != null) {
return new LocalizableMessageBuilder()
.key(SchemaConstants.USER_DESCRIPTIVE_NAME)
.arg(fullName)
.arg(displayName)
.arg(object.getName())
.build();
} else {
Expand Down Expand Up @@ -1112,7 +1112,7 @@ public static Collection<ObjectReferenceType> createObjectRefs(Collection<PrismR
}

/**
* Returns display name for given object, e.g. fullName for a user, displayName for a role,
* Returns display name for given object, e.g. displayName for a user or role,
* and more detailed description for a shadow. TODO where exactly does this method belong?
*/
public static String getDetailedDisplayName(PrismObject<?> object) {
Expand All @@ -1122,7 +1122,7 @@ public static String getDetailedDisplayName(PrismObject<?> object) {

public static String getDetailedDisplayName(Objectable objectable) {
if (objectable instanceof UserType) {
return getOrig(((UserType) objectable).getFullName());
return getOrig(((UserType) objectable).getDisplayName());
} else if (objectable instanceof AbstractRoleType) {
return getOrig(((AbstractRoleType) objectable).getDisplayName());
} else if (objectable instanceof ShadowType) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2123,6 +2123,61 @@
</xsd:annotation>
</xsd:element>

<xsd:element name="preferredName" type="t:PolyStringType" minOccurs="0">
<xsd:annotation>
<xsd:documentation>
<p>
Preferred name of the user. This is the name that the user prefers
to use for display purposes. It does not replace legal-name attributes
such as given name, family name, or full name, and it is not intended
to be used as a login name, account identifier, or correlation identifier.
</p>
<p>
Examples:
<ul>
<li>Jack Smith</li>
<li>Liz Johnson</li>
</ul>
</p>
</xsd:documentation>
<xsd:appinfo>
<a:displayName>UserType.preferredName</a:displayName>
<a:displayOrder>105</a:displayOrder>
<a:displayHint>emphasized</a:displayHint>
<a:diagram>
<a:name>user-overview</a:name>
<a:inclusion>include</a:inclusion>
</a:diagram>
<a:help>UserType.preferredName.help</a:help>
</xsd:appinfo>
</xsd:annotation>
</xsd:element>

<xsd:element name="displayName" type="t:PolyStringType" minOccurs="0">
<xsd:annotation>
<xsd:documentation>
<p>
Effective visible name of the user for presentation-oriented display.
This property is intended to hold the user's preferred display value
for UI, reporting, and outbound provisioning scenarios where a visible
name is needed. It is distinct from the legal/full name and from login
or account identifiers.
</p>
</xsd:documentation>
<xsd:appinfo>
<a:displayName>UserType.displayNameProperty</a:displayName>
<a:displayOrder>106</a:displayOrder>
<a:displayHint>emphasized</a:displayHint>
<a:access>read</a:access>
<a:diagram>
<a:name>user-overview</a:name>
<a:inclusion>include</a:inclusion>
</a:diagram>
<a:help>UserType.displayNameProperty.help</a:help>
</xsd:appinfo>
</xsd:annotation>
</xsd:element>

<xsd:element name="givenName" type="t:PolyStringType" minOccurs="0">
<xsd:annotation>
<xsd:documentation>
Expand Down Expand Up @@ -6636,7 +6691,7 @@
If set to true the script will be evaluated with null value as argument when the input is
changed from or to an empty value. This generally works well for most cases. It may be set to
false as an optimization.
Note: default setting (true) for this property may be overridden in specific expression
Note: default setting (true) for this property may be overridden in specific expression
evaluators.
</xsd:documentation>
</xsd:annotation>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@
<xsd:annotation>
<xsd:documentation>
Expression that can be used to return String value which describes user object returned by search.
By default, `user.getFullName() + "(" + user.getName() + ")"` is used.
By default, `user.getDisplayName() + " (" + user.getName() + ")"` is used.

DEPRECATED:
Use autocompleteConfiguration.
Expand Down
Loading
Loading