sitecore Diagnostics: Asserts Security Asserts


Example

CanRunApplication

To check to see if the user has permission to run the given application. If not, AccessDeniedException is thrown.

Assert.CanRunApplication("WebEdit");

HasAccess

HasAccess will check if the given parameter is true, otherwise an AccessDeniedException will be thrown.

Assert.HasAccess(Context.User.IsAdministrator, "Only administrators can create new domains");