Upgrades Questions on upgrading to version 7.x.
Version 7.x > Upgrades > Content staging after upgrade View modes: 
User avatar
Member
Member
charles.johnson1-bayer - 12/18/2012 9:32:30 AM
   
Content staging after upgrade
In trying to set up content staging after upgrading (from 5.5 -> 7.0), I am unable to get the staging module to load in CMSDesk. I am getting the message: Your UI profile is not granted with permission to access this section. Please contact the administrator.

I am logged in as the Global Admin.

After another upgrade, we received the same message regarding the Users UI and was able to correct the issue by running the following scripts found in another forum post:

Script1:
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

Script2:

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;

Any help with this would be appeciated.

User avatar
Kentico Consulting
Kentico Consulting
kentico_borisp - 12/21/2012 9:50:57 PM
   
RE:Content staging after upgrade
Hello,

Please try to run this script.

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! Please let me know if you've received any error messages when applying this script. If this won't work you can try to upgrade once more from version 6.0, but please be sure you are using the latest version of the upgrade script, since this issue should be already fixed there.

Best regards,
Boris Pocatko

User avatar
Member
Member
charles.johnson1-bayer - 1/8/2013 11:40:34 AM
   
RE:Content staging after upgrade
Boris,

Thanks for the response.

When trying to run the script that you provided, we received the following error:

Msg 134, Level 15, State 1, Line 39 

The variable name '@elementID' has already been declared. Variable names must be unique within a query batch or stored procedure


Is there a workaround for this?

User avatar
Kentico Consulting
Kentico Consulting
kentico_borisp - 1/15/2013 2:01:44 AM
   
RE:Content staging after upgrade
Hello,

You need to execute the script in two steps:

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;


Best regards,
Boris Pocatko

User avatar
Member
Member
charles.johnson1-bayer - 1/18/2013 10:41:53 AM
   
RE:Content staging after upgrade
Boris,

Thanks for the response.

We tried splitting the script into two as you listed above and both seemed to run successfully. However, the issue is still present (receiving the "Your UI profile is not granted with permission to access this section. Please contact the administrator." message).

Because of this, we decided to create a second stage instance with our 6.0 backup so that we could redo the upgrade to 7.0 completely. Prior to running the upgrade, I tried to see if I could set up content staging on the 6.0 instance and received the same message (Your UI profile is not granted with permission to access this section. Please contact the administrator).

If I have to go back to the 5.5 instance, I'm going to have to restore from tape and I really, really don't want to have to go that route.

User avatar
Member
Member
charles.johnson1-bayer - 1/28/2013 3:49:43 PM
   
RE:Content staging after upgrade
Okay...after creating the 6.0 instance and checking the staging module, it was still displaying the same error message:

"Your UI profile is not granted with permission to access this section. Please contact the administrator."

This is happening on multiple sites but is functional on some others. Is there someplace else (possibly in a config file) that I might look to see why this is not functioning?

User avatar
Kentico Consulting
Kentico Consulting
kentico_borisp - 1/29/2013 4:29:08 AM
   
RE:Content staging after upgrade
Hello,

This means that the issue was carried on from version 6.0 and that's why the mentioned SQL script didn't work. To try to fix it please follow this knoledge base article.

Best regards,
Boris Pocatko

User avatar
Member
Member
charles.johnson1-bayer - 1/29/2013 8:19:38 AM
   
RE:Content staging after upgrade
Boris,

Thanks for the link. I was able to get the Content Staging module working using the instructions there and re-importing the module.