With the SitesUtil.updateLayoutSetPrototypesLinks we want to add a template site to an org site programmatically.
We notice that after the API is used the template is added to the site but the pages aren't generate: cause a 404 if the user reach the org site.
After an admin user access to the site page in the control panel section the 404 error resolves.
Follow step to reproduce.
1) Create an master organization 'B2B' (check 'create site for this org') - Org_new1.jpg
2) Create a child organization under 'B2B' (check 'create site for this org') - Org_new2.jpg
3) Create a non-admin user and add to the organizations - User_New1.jpg User_New2.jpg
4) Create a site template 'B2B Document Library' with a simple page that show 'Document and Media' portlet - Site_Template1.jpg, Site_Template2.jpg, Site_Template3.jpg
5) Use the attached code snippet to dinamically attach the site template to the child orgs - AttachTemplate2Site.java
6) Login with the non-admin user and notice that:
6a) the child orgs sites aren't show in the MySite menù on the top-right - My_Sites1.jpg
6b) if the user reach a link of the home page of any org sites get a 404
7) Login with the admin user and enter in the 'Manage Site' of each org site
After point 7 the non-admin user is able to view orgs sites in the MySite menù and is able to reach the home of each site. - Manage_Site.jpg and My_Sites2.jpg