Uploaded image for project: 'Crowd Data Center'
  1. Crowd Data Center
  2. CWD-3882

Add unique constraint on columns external_id and directory_id

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Unresolved
    • None
    • None
    • None
    • Our product teams collect and evaluate feedback from a number of different sources. To learn more about how we use customer feedback in the planning process, check out our new feature policy.

    Description

      In the table cwd_user, there should be no rows where the external_id is repeated for the same directory_id. Said in another way, the external_id should be unique for the same directory_id.

      To avoid this from causing problems, we should add a unique constraint at a database level in the table cwd_user.

      When two users share external_id and directory_id, the user is not able to login or update new information from the external user directory. Those actions will fail with the following error:

      org.springframework.dao.IncorrectResultSizeDataAccessException: query did not return a unique result: 2
              at org.springframework.orm.hibernate.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:590)
              at org.springframework.orm.hibernate.HibernateAccessor.convertHibernateAccessException(HibernateAccessor.java:353)
              at org.springframework.orm.hibernate.HibernateTemplate.execute(HibernateTemplate.java:375)
              at org.springframework.orm.hibernate.HibernateTemplate.execute(HibernateTemplate.java:337)
              at com.atlassian.crowd.embedded.hibernate2.HibernateUserDao.internalFindUserByExternalId(HibernateUserDao.java:501)
              at com.atlassian.crowd.embedded.hibernate2.HibernateUserDao.internalFindByExternalId(HibernateUserDao.java:473)
              at com.atlassian.crowd.embedded.hibernate2.HibernateUserDao.findByExternalId(HibernateUserDao.java:449)
              at com.atlassian.confluence.user.crowd.CachedCrowdUserDao.findByExternalId(CachedCrowdUserDao.java:164)
      ...

      This also affects embedded Crowd.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              aconde Alejandro Conde Carrillo (Inactive)
              Votes:
              22 Vote for this issue
              Watchers:
              30 Start watching this issue

              Dates

                Created:
                Updated: