When you use Windows authentication, which creates external users in Kentico CMS, the database can sometimes return an unexpected result when updating users. You might find a duplicated record for the same user or perhaps that a user loses roles or custom changes made through the administration interface. This article describes how to avoid this.
Sometimes, when the database returns no data for a user, even though that user does exist in the database, Kentico CMS creates a new record instead of updating the existing one, so you can see two records for the same user in the CMS_User table. It happens randomly, usually under heavy load of the database.
To stop this happening, we can change the indexes on the CMS_User table. Version 7 will already include these changes and also improves the performance of the new index.
Please open MS SQL Server Management Studio, find your database and expand the CMS_User table and its Indexes.
1. Change the ‘IX_CMS_User_UserID_UserName_Email_FullName’ index from ‘Clustered’ to ‘Nonclustered’. See the screenshot below:
2. Add a new ‘Clustered’ index on UserID. See the screenshot below:
Now these indexes will protect this table against duplicate records even if the database returns an unexpected result.