/// <summary> /// Updates the list access. /// </summary> /// <param name="ListId">The list id.</param> /// <param name="ListAccess">The list access.</param> public static void UpdateListAccess(int ListId, DataTable ListAccess) { if (!CanAdmin(ListId)) { throw new AccessDeniedException(); } using (DbTransaction tran = DbTransaction.Begin()) { DBListInfo.DeleteListAccessByList(ListId); foreach (DataRow row in ListAccess.Rows) { int PrincipalId = (int)row["PrincipalId"]; byte AllowLevel = (byte)row["AllowLevel"]; if (AllowLevel < 1 || AllowLevel > 3) { throw new ArgumentOutOfRangeException("AllowLevel", AllowLevel, "should be > 0 and < 3"); } DBListInfo.CreateListAccess(ListId, PrincipalId, AllowLevel); } tran.Commit(); } }
/// <summary> /// Creates the list access. /// </summary> /// <param name="ListId">The list id.</param> /// <param name="PrincipalId">The principal id.</param> /// <param name="AllowLevel">The allow level.</param> /// <returns></returns> public static int CreateListAccess(int ListId, int PrincipalId, byte AllowLevel) { return(DBListInfo.CreateListAccess(ListId, PrincipalId, AllowLevel)); }