private Dictionary <Guid, int> SaveAndProcessGroups(PermissionCheckBase permChecker, int appId, List <EntityWithHeader> items, bool partOfPage) { var allowWriteLive = permChecker.UserMay(GrantSets.WritePublished); var forceDraft = !allowWriteLive; // first, save all to do it in 1 transaction // note that it won't save the SlotIsEmpty ones, as these won't be needed var ids = EavEntitiesController.SaveMany(appId, items, partOfPage, forceDraft); Log.Add("check groupings"); // now assign all content-groups as needed var groupItems = items.Where(i => i.Header.Group != null) .GroupBy(i => i.Header.Group.Guid.ToString() + i.Header.Group.Index.ToString() + i.Header.Group.Add) .ToList(); // if it's new, it has to be added to a group // only add if the header wants it, AND we started with ID unknown if (groupItems.Any()) { DoAdditionalGroupProcessing(SxcInstance, Log, appId, ids, groupItems); } return(ids); }
private static bool UserMayWriteEverywhereOrThrowIfAttempted(bool usePortalRoot, PermissionCheckBase permCheck) { var everywhereOk = permCheck.UserMay(GrantSets.WritePublished); if (usePortalRoot && !everywhereOk) { throw Http.BadRequest("you may only create draft-data, so file operations outside of ADAM is not allowed"); } return(everywhereOk); }