Site structure
Version 6.x > Site structure > Creating new site from template issue View modes: 
User avatar
Member
Member
Aon_Vlado - 11/14/2012 12:42:50 PM
   
Creating new site from template issue
When we create a new site we prefer to create it from a site template. The exported site usually has some users so we uncheck under Global Objects->Administration->Users all checkboxes when exporting. (BTW, I think what should be controlled in the first page under root if I want to export users or not).
I would expect that this would prevent any existing users and theirs data to be imported when creating a new site. It looks like this is also happening and we do not see any users in newly created site but when we run SQL script
SELECT  CMS_Site.SiteName, CMS_User.UserName
FROM CMS_UserRole INNER JOIN
CMS_Role ON CMS_UserRole.RoleID = CMS_Role.RoleID INNER JOIN
CMS_Site ON CMS_Role.SiteID = CMS_Site.SiteID INNER JOIN
CMS_User ON CMS_UserRole.UserID = CMS_User.UserID
WHERE (CMS_Site.SiteName = N'300510')

(where 300510 is the name of newly created site)
there are all users from the old site in table CMS_UserRole associated with the new site. We need to delete them every time with similar script as above.

Are we missing something or this is not a correct import behavior?

Thanks,

Vlado

User avatar
Kentico Support
Kentico Support
kentico_janh - 11/15/2012 8:37:54 AM
   
RE:Creating new site from template issue
Hello,

When you export Roles with your site and import them to a new site, those linkages between roles and users stay unchanged. Please uncheck all roles from the All objects -> Website -> Administration -> Roles section in the second step of your exporting process.

Best regards,
Jan Hermann

User avatar
Member
Member
Aon_Vlado - 12/1/2012 5:55:32 PM
   
RE:Creating new site from template issue
But I want to keep the roles. What is the reason to export user-role relationship if no users exported/

Vlado

User avatar
Kentico Support
Kentico Support
kentico_janh - 12/3/2012 3:54:19 AM
   
RE:Creating new site from template issue
Hello Vlado,

The reason is, that those users can be present in the target database already and you would loose those relationships. However if you want I can add a suggestion to our system to make two different export options for roles and their relationships separately for implementation to a next version of Kentico CMS.

Best regards,
Jan Hermann

User avatar
Member
Member
Aon_Vlado - 12/3/2012 4:56:15 AM
   
RE:Creating new site from template issue
I am not sure what do you mean. When I indicate that I do not want to export users in export setting, than it should not matter and the relationship should be inserted. The functionality as it is inserts rows into CMS_UserRole and does not insert users. I realized that when I created a site template from Pre-Production and port it to Production. There are no users in CMS_User but rows in CMS_UserRole after creating a new site using wizard.

User avatar
Member
Member
Aon_Vlado - 12/3/2012 5:19:56 AM
   
RE:Creating new site from template issue
I meant: "When I indicate that I do not want to export users in export setting, than it should not matter and the relationship should not be inserted."

User avatar
Kentico Support
Kentico Support
kentico_janh - 12/6/2012 6:41:01 AM
   
RE:Creating new site from template issue
Hello,

I have discussed it with our consultant and this is actually a "by design" behavior, because there is no possibility in current version how to export those relationships separately, so they are exported with roles by default even you don't export those users. And as I said, if you want I can add this as a feature requirement to let our developers know to change this behavior to the next version.

Best regards,
Jan Hermann

User avatar
Member
Member
Aon_Vlado - 12/6/2012 3:02:36 PM
   
RE:Creating new site from template issue
Yes, please. Add that as a new feature.
Thanks.
Vlado