Associating a single user with multiple fragment definitions (normally by accident) cripples the portal

Description

If you alter the fragment name on an existing fragment **-fragment-definition.xml) file and import it, the portal is unable to render any content. The logs have a stacktrace

org.springframework.dao.IncorrectResultSizeDataAccessException: Incorrect result size: expected 1, actual 2
in org.jasig.portal.layout.dlm.FragmentDefinitionDao.getFragmentDefinitionByOwner.

The issue is a fragment owner cannot be associated with multiple fragment definitions. In glancing at the table, I don't see how we can add a unique key constraint to catch this situation (too many nulls, would have to use a DB trigger).

  • Instead the data import process for a fragment definition should first check to see if there is a fragment with a different name but the same owner and abort the import with a suitable error message.

  • Perhaps also make FragmentDefinitionDao or the invoking classes ( org.jasig.portal.layout.dlm.RDBMConfigurationLoader.getFragmentByOwnerId(RDBMConfigurationLoader.java:61), org.jasig.portal.layout.dlm.RDBMDistributedLayoutStore.getOwnedFragment(RDBMDistributedLayoutStore.java:1303) ) more tolerant of the error and simply skip that fragment.

Example - welcome-lo.fragment-definition.xml

  • change dlm:fragment name="Welcome" to dlm:fragment name="Welcome2" and import the fragment

Portal no longer renders for anyone.

Also...

If you import a fragment definition with the wrong ownerID (the value is valid, but for a different fragment) the import succeeds but then if you try to log in again as a portal admin user, you get the generic error page. What is happening is that this causes a data integrity issue because you now have a user (identified by the ownerID) that is associated with two fragment definitions. What is needed is a unique constraint so that you only find a particular ownerID value at most once in the UP_DLM_EVALUATOR table.

Environment

None

Assignee

Unassigned

Reporter

James Wennmacher

Labels

None

Estimated End Date

None

Fix versions

Affects versions

Priority

Critical
Configure