Welcome to TechNet Blogs Sign in | Join | Help

How to identify if a user is a MCMS administrator?

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.

Published Friday, June 10, 2005 12:26 PM by Stefan_Gossner
Filed under:

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

Saturday, June 11, 2005 4:02 PM by Andrew Connell [MVP MCMS]

# How to identify if a user is a MCMS administrator without going into the database?

Thursday, August 07, 2008 2:26 PM by Ankit

# re: How to identify if a user is a MCMS administrator?

Hi Stefan

Is there a way to Export and Import just user group rights and users from Site Manager in MCMS 2002?

Thursday, August 07, 2008 4:41 PM by Stefan_Gossner

# re: How to identify if a user is a MCMS administrator?

Hi Ankit,

no, this can only be done using the Site Deployment API.

Cheers,

Stefan

Friday, August 08, 2008 1:21 AM by Ankit

# re: How to identify if a user is a MCMS administrator?

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.

Friday, August 08, 2008 2:52 AM by Stefan_Gossner

# re: How to identify if a user is a MCMS administrator?

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

Friday, August 08, 2008 1:21 PM by Ankit

# re: How to identify if a user is a MCMS administrator?

Thank Stefan, It worked for me :)

Friday, August 08, 2008 3:21 PM by Ankit

# re: How to identify if a user is a MCMS administrator?

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.

Monday, August 11, 2008 2:47 AM by Stefan_Gossner

# re: How to identify if a user is a MCMS administrator?

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

Sunday, January 18, 2009 11:29 AM by Delete option in Web Author Console | keyongtech

# Delete option in Web Author Console | keyongtech

Leave a Comment

(required) 
required 
(required) 
 
Page view tracker