AccessControlObjectAccessCheck Method (ConnectionId, SessionId, CSObjectPermissions, CSSecurableObjects, Int32) Content Studio 5.7 SDK
Content Studio Web Content Management System

[This is preliminary documentation and is subject to change.]

Checks if a user has a certain permission on a Content Studio object.

Namespace: ContentStudio.Security
Assembly: CSServer5 (in CSServer5.dll) Version: 5.7.5016.0 (5.7.5016.0)
Syntax

public bool ObjectAccessCheck(
	ConnectionId connectionId,
	SessionId sessionId,
	CSObjectPermissions accessMask,
	CSSecurableObjects objectType,
	int objectId
)

Parameters

connectionId
Type: ContentStudioConnectionId
A value that identifies the web site
sessionId
Type: ContentStudio.SecuritySessionId
A value that identifies the user's session. This value usually originates from a call to OpenSession(ConnectionId).
accessMask
Type: ContentStudio.SecurityCSObjectPermissions
An access mask that specifies the permission to check
objectType
Type: ContentStudio.SecurityCSSecurableObjects
A member in the CSSecurableObjects enumeration that indicates the type of object to check access for.
objectId
Type: SystemInt32
A value that identifies the object to check

Return Value

Type: Boolean
true if the caller has the desired permission, false otherwise.
Exceptions

ExceptionCondition
CSInvalidSessionExceptionThe session is invalid
CSExceptionA business rule was violated in the underlying Content Studio database
SqlExceptionAn error occurred when executing the command against the Content Studio database
Remarks

This version of the call checks the caller's permission on the specified object
Examples

The following sample shows how to check if the calling user has permission to create and write new documents in the current category.

try
{
   AccessControl acc = new AccessControl();
   if(acc.ObjectAccessCheck(CS_ConnectionId, 
                            CS_UserSessionId,
                            CSObjectPermissions.Create | CSObjectPermissions.Write,
                            CSSecurableObjects.DocumentCategory,
                            CS_InsertedCategoryId))
       Response.Write("You have access!");    
   else
       Response.Write("Sorry, no access for you!");    
}
catch (Exception ex)
{
   Response.Write(Server.HtmlEncode(ex.GetType().ToString() + ": " + ex.Message));
}
See Also

Reference