Scenario: Find whether the current user has permissions for a specified SPList object
Output:
true if the current user has permissions for the object; otherwise, false.
Code:
Where,
permissionContext: value that indicates the context object to which a permission mask is applied.
permissions: An SPBasePermissions value that specifies the built-in permissions available in
permissionMode: A PermissionMode value that specifies whether the user must have all of the rights specified in the permission mask to view a link, or only one of the rights specified in the permission mask.
contextList: The SPList object to evaluate.
Output:
true if the current user has permissions for the object; otherwise, false.
Code:
public static bool UserHasRights (
PermissionContext permissionContext,
SPBasePermissions permissions,
PermissionMode permissionMode,
SPList contextList
)
Where,
permissionContext: value that indicates the context object to which a permission mask is applied.
permissions: An SPBasePermissions value that specifies the built-in permissions available in
permissionMode: A PermissionMode value that specifies whether the user must have all of the rights specified in the permission mask to view a link, or only one of the rights specified in the permission mask.
contextList: The SPList object to evaluate.
Comments