This article provides an example of the method used for checking user access rights to a library. The Library Handle (or ID) can be found in the Manage Libraries view. 



Example

var user = instance.Broker.GetUserWithName("student");
var library = instance.Broker.GetLibrary(SWHandleUtility.ToHandle("x1300000000000317"));
var userAccess = library.GetUserAccess(user);

if (userAccess.Contains(SWAccessCodes.ChangeAccess))
Console.WriteLine("User has ChangeAccess");

if (userAccess.Contains(SWAccessCodes.LibraryItemsChangeAccess))
Console.WriteLine("User has LibraryItemsChangeAccess");

if (userAccess.Contains(SWAccessCodes.LibraryItemsWrite))
Console.WriteLine("User has LibraryItemsWrite");

if (userAccess.Contains(SWAccessCodes.Read))
Console.WriteLine("User has Read");

if (userAccess.Contains(SWAccessCodes.Write))
Console.WriteLine("User has Write");