Upgrades Questions on upgrading to version 7.x.
Version 7.x > Upgrades > No Access to User Management after Upgrade View modes: 
User avatar
Guest
S. Spautz - 11/20/2012 10:23:28 AM
   
No Access to User Management after Upgrade
I'm upgrading a old (Version 4.1) installation today step by step (Version 5.0, 5.5, 5.5 R2, 6.0, 7.0). The website works fine but I can't manager the users because my "UI profile is not granted with permission to access this section." It's the same message in CMSDesk (CMS Desk->Administration->Users) and CMSSitemanager (Site Manager->Administration->Users). I'm logged in as an global administrator. The view "Groups" works fine.

Can you give me a tip to solve this problem?


User avatar
Kentico Consulting
Kentico Consulting
kentico_borisp - 11/20/2012 1:48:53 PM
   
RE:No Access to User Management after Upgrade
Hello,

On which version are you currently on? If on 6.0 please follow this knowledge base article. If this is an issue on 7.0 you will need to apply the following script to your database:

DECLARE @resourceID int;
SET @resourceID = (SELECT TOP 1 [ResourceID] FROM [CMS_Resource] WHERE [ResourceName] = 'CMS.Users')
IF @resourceID <>0 BEGIN

DECLARE @elementID int;
SET @elementID = (SELECT TOP 1 [ElementID] FROM [CMS_UIElement] WHERE [ElementName] = 'cmsusers' AND [ElementResourceID] = @resourceID)
IF @elementID IS NULL BEGIN

INSERT [CMS_UIElement] ([ElementDisplayName], [ElementName], [ElementCaption], [ElementTargetURL], [ElementResourceID], [ElementParentID], [ElementChildCount], [ElementOrder], [ElementLevel], [ElementIDPath], [ElementIconPath], [ElementIsCustom], [ElementLastModified], [ElementGUID], [ElementSize], [ElementDescription], [ElementFromVersion])
VALUES ('Users', 'cmsusers', NULL, NULL, @resourceID, NULL, 0, NULL, 0, '####', NULL, 0, getDate(), '0CC5C231-E4EC-4C3E-AB91-176E810827A4', NULL, NULL, '5.0')

END

SET @elementID = (SELECT TOP 1 [ElementID] FROM [CMS_UIElement] WHERE [ElementName] = 'cmsusers' AND [ElementResourceID] = @resourceID)
IF @elementID <>0 BEGIN

INSERT [CMS_UIElement] ([ElementDisplayName], [ElementName], [ElementCaption], [ElementTargetURL], [ElementResourceID], [ElementParentID], [ElementChildCount], [ElementOrder], [ElementLevel], [ElementIDPath], [ElementIconPath], [ElementIsCustom], [ElementLastModified], [ElementGUID], [ElementSize], [ElementDescription], [ElementFromVersion])
VALUES ('{$administration.users.onlineusers$}', 'online_users', '{$administration.users.onlineusers$}', '~/CMSModules/Membership/Pages/Users/General/User_Online.aspx?siteid={%CurrentSite.SiteID%}', @resourceID, @elementID, 0, 1, 1, '####', '', 0, getDate(), 'caabbb9d-74b5-4b85-969a-81eeaa738c1c', 0, '', '6.0')

END

END


DECLARE @elementCursor CURSOR;
SET @elementCursor = CURSOR FOR SELECT [ElementID] FROM [CMS_UIElement] ORDER BY [ElementLevel], [ElementID]
DECLARE @elementID int;
OPEN @elementCursor
FETCH NEXT FROM @elementCursor INTO @elementID;
WHILE @@FETCH_STATUS = 0
BEGIN

UPDATE [CMS_UIElement] SET
[ElementChildCount] = (SELECT COUNT(*) FROM [CMS_UIElement] b WHERE b.[ElementParentID] = [Child].[ElementID]),
[ElementIDPath] = ISNULL((SELECT TOP 1 [ElementIDPath] FROM [CMS_UIElement] AS [Parent] WHERE [Parent].ElementID = [Child].ElementParentID), '') + '/' + REPLICATE('0', 8 - DATALENGTH([ElementID])) + CAST([ElementID] AS NVARCHAR(200)) FROM [CMS_UIElement] AS [Child]
WHERE [ElementID] = @elementID

FETCH NEXT FROM @elementCursor INTO @elementID;
END

CLOSE @elementCursor;
DEALLOCATE @elementCursor;

Please backup everything at first.

Best regards,
Boris Pocatko

User avatar
Member
Member
spautz.s-com-online - 11/21/2012 1:24:32 AM
   
RE:No Access to User Management after Upgrade
Thanks, the script works fine on Kentico 7. You only need to execute it in to steps because it declares the variable @elementID two times.

First Part (Insert missing things):
DECLARE @resourceID int;
SET @resourceID = (SELECT TOP 1 [ResourceID] FROM [CMS_Resource] WHERE [ResourceName] = 'CMS.Users')
IF @resourceID <>0 BEGIN

DECLARE @elementID int;
SET @elementID = (SELECT TOP 1 [ElementID] FROM [CMS_UIElement] WHERE [ElementName] = 'cmsusers' AND [ElementResourceID] = @resourceID)
IF @elementID IS NULL BEGIN

INSERT [CMS_UIElement] ([ElementDisplayName], [ElementName], [ElementCaption], [ElementTargetURL], [ElementResourceID], [ElementParentID], [ElementChildCount], [ElementOrder], [ElementLevel], [ElementIDPath], [ElementIconPath], [ElementIsCustom], [ElementLastModified], [ElementGUID], [ElementSize], [ElementDescription], [ElementFromVersion])
VALUES ('Users', 'cmsusers', NULL, NULL, @resourceID, NULL, 0, NULL, 0, '####', NULL, 0, getDate(), '0CC5C231-E4EC-4C3E-AB91-176E810827A4', NULL, NULL, '5.0')

END

SET @elementID = (SELECT TOP 1 [ElementID] FROM [CMS_UIElement] WHERE [ElementName] = 'cmsusers' AND [ElementResourceID] = @resourceID)
IF @elementID <>0 BEGIN

INSERT [CMS_UIElement] ([ElementDisplayName], [ElementName], [ElementCaption], [ElementTargetURL], [ElementResourceID], [ElementParentID], [ElementChildCount], [ElementOrder], [ElementLevel], [ElementIDPath], [ElementIconPath], [ElementIsCustom], [ElementLastModified], [ElementGUID], [ElementSize], [ElementDescription], [ElementFromVersion])
VALUES ('{$administration.users.onlineusers$}', 'online_users', '{$administration.users.onlineusers$}', '~/CMSModules/Membership/Pages/Users/General/User_Online.aspx?siteid={%CurrentSite.SiteID%}', @resourceID, @elementID, 0, 1, 1, '####', '', 0, getDate(), 'caabbb9d-74b5-4b85-969a-81eeaa738c1c', 0, '', '6.0')

END

END

Second Part (Update UI Elements):

DECLARE @elementCursor CURSOR;
SET @elementCursor = CURSOR FOR SELECT [ElementID] FROM [CMS_UIElement] ORDER BY [ElementLevel], [ElementID]
DECLARE @elementID int;
OPEN @elementCursor
FETCH NEXT FROM @elementCursor INTO @elementID;
WHILE @@FETCH_STATUS = 0
BEGIN

UPDATE [CMS_UIElement] SET
[ElementChildCount] = (SELECT COUNT(*) FROM [CMS_UIElement] b WHERE b.[ElementParentID] = [Child].[ElementID]),
[ElementIDPath] = ISNULL((SELECT TOP 1 [ElementIDPath] FROM [CMS_UIElement] AS [Parent] WHERE [Parent].ElementID = [Child].ElementParentID), '') + '/' + REPLICATE('0', 8 - DATALENGTH([ElementID])) + CAST([ElementID] AS NVARCHAR(200)) FROM [CMS_UIElement] AS [Child]
WHERE [ElementID] = @elementID

FETCH NEXT FROM @elementCursor INTO @elementID;
END

CLOSE @elementCursor;
DEALLOCATE @elementCursor;