Chester needs to get the credits for the findings in the following blog as he pointed me to this specific behaviour!
MCMS does not have a documented method to identify if the current user is a MCMS administrator or not. But there is a very easy way around this if you are using the CmsHttpContext!
The CmsHttpContext has a UserCacheKey property which is used by ASP.NET output caching with MCMS in combination with the VaryByCustom=”cmsrole” method to ensure that content can be varied for different user roles.
The MCMS help gives the following statement for this property:
UserCacheKey is guaranteed to be the same for two users, of those two users are both members of all the same MCMS rights groups. UserCacheKey will also be the same for two users if both users are MCMS administrators. In contrast, UserCacheKey is different for two users if those two users do not meet either of the above two requirements.
Looking at the value returned for this property for MCMS administrators shows that always “A” is returned!
So a simple check for this property for the string “A” is sufficient to identify if the current user is a MCMS administrator or not!
Actually there is no guarantee that this property value will be the same with the next service pack. But the chance that this gets changed is very low.
Permalink
Hi Stefan
Is there a way to Export and Import just user group rights and users from Site Manager in MCMS 2002?
Permalink
Hi Ankit,
no, this can only be done using the Site Deployment API.
Cheers,
Stefan
Permalink
Can you give me an example how to do it using Site Deployment API’s ? I have an existing MCMS Database which has more then 100 users and 50 User groups I need to Import all new SDO to it how do I retain the user groups and right there so that channel hierarchy is new but rights are old.
Permalink
Hi Ankit,
the following script can be used to export all users and rights groups:
Dim pCmsDeployExport
Dim shell
Dim pExportOptions
Set pCmsUserGroupBackupRestore =
CreateObject("CmsDeployServer.CmsUserGroupBackupRestore.1")
pCmsUserGroupBackupRestore.AuthenticateAsCurrentUser()
If ( Err.Number <> 0 ) Then
Call MsgBox(Err.Description, vbCritical, "Backup/Restore PROBLEM")
Set pCmsUserGroupBackupRestore = Nothing
else
strPackageFileName = "c:export-users.sdo"
strReportUrl = pCmsUserGroupBackupRestore.Backup("strPackageFileName")
‘ Display the report in the Web browser.
Set shell = WScript.CreateObject("WScript.Shell")
shell.Run "http://localhost" & strReportUrl, 7
WScript.Echo "Export complete."
end if
Cheers,
Stefan
Permalink
Thank Stefan, It worked for me 🙂
Permalink
Just checked it did imported the users but the Channel rights were not imported, while Importing the SDO I chose:
Use Package Container Rights in Containers
Replace with package container rights
I dont know what am I doing wrong it is importing all the users and groups but not the Channel/Resource/Template rights, can you tell me why please.
Permalink
Hi Ankit,
that is as expected. This CmsUserGroupBackupRestore allows to backup/restore rights groups with users. To deploy rights on the channels you need to export the channels with the appropriate option in Site Manager. There is a "Rights Options" tab on the Site Deployment export dialog and there are options on whether to import container rights on the import dialog.
Cheers,
Stefan
Permalink
PingBack from http://www.keyongtech.com/365503-delete-option-in-web-author