Content Studio Web Content Management System
Assembly: CSServer5 (in CSServer5.dll) Version: 5.7.5016.0 (5.7.5016.0)
true if the caller has the desired permission, false otherwise.
This version of the call checks the permission for any user the specified object.
Tip
You can also use the ObjectAccessCheck(ConnectionId, SessionId, CSObjectPermissions, CSSecurableObjects, Int32) overloaded version of this method when you wish to check the permission of the calling user.
The following sample shows how to check if the calling user has permission to create and write new documents in the current category.
[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, int userId, 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 - userId
- Type: SystemInt32
The id of the user to test access for. Use zero to check for the calling user. - 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: Booleantrue if the caller has the desired permission, false otherwise.
Exceptions
Exception | Condition |
---|---|
CSInvalidSessionException | The session is invalid |
CSException | A business rule was violated in the underlying Content Studio database |
SqlException | An error occurred when executing the command against the Content Studio database |
Remarks
Tip
You can also use the ObjectAccessCheck(ConnectionId, SessionId, CSObjectPermissions, CSSecurableObjects, Int32) overloaded version of this method when you wish to check the permission of the calling user.
Examples
try { AccessControl acc = new AccessControl(); if(acc.ObjectAccessCheck(CS_ConnectionId, CS_UserSessionId, CSObjectPermissions.Create | CSObjectPermissions.Write, 0, 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