Example #1
0
        /// <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();
            }
        }
Example #2
0
 /// <summary>
 /// Deletes the list access by list.
 /// </summary>
 /// <param name="ListId">The list id.</param>
 public static void DeleteListAccessByList(int ListId)
 {
     DBListInfo.DeleteListAccessByList(ListId);
 }