OK
Here's a manual step-by-step procedure to mend badly created Portal data when using another language, for those finding this later on. This is what I did anyway !
select portalid,administratorid,RegisteredRoleId from Portals
shows you the bad portal data. Your new/broken portal will have NULLs here (whcih is why padlocks in wrong place on settings permissions).
SELECT PortalID, [Administrators] as AdministratorRoleId, [Registered Users] as RegisteredRoleId
FROM (SELECT PortalID, RoleID, RoleName from roles ) src
PIVOT (MIN(RoleID) FOR RoleName IN ([Administrators],[Registered Users]))pvt
shows you the RegisteredRoleID that the portals should have. Go back to the portals table and update the Portals table with the correct ID from RegisteredRoleID column.
(You might need to run EXEC sp_dbcmptlevel DBNAME, 90; to allow PIVOT clause)
(this is effectively what the query from http://jingyangli.wordpress.com/2011/... does with typos corrected -
UPDATE p SET p.AdministratorRoleId=d.AdministratorRoleId,
p.RegisteredRoleId =d.RegisteredRoleId FROM ( SELECT PortalID, [Administrators] as AdministratorRoleId, [Registered Users] as RegisteredRoleId
FROM (SELECT PortalID, RoleID, RoleName from roles ) src
PIVOT (MIN(RoleID) FOR RoleName IN ([Administrators],[Registered Users]))pvt
)d INNER JOIN dbo.Portals p ON d.PortalID=p.PortalID
)
Now go to the users table and find the UserID of the admin user for the new portal that was created when you created the portal. Use this number to update the Portals table AdministratorID column which will be NULL.
So now the portals table has the correct entries in it for administratorID and registeredRoleID.
All we need to go now is to remove the ‘All Users’ permission from the edit tabs, so that the top panel isn’t shown when logged out:
DELETE FROM dbo.TabPermission WHEREpermissionId=4 and RoleId=-1
Enjoy :)
Rob