protected override void OnNodeDeletedPhysically(object sender, NodeEventArgs e)
        {
            base.OnNodeDeletedPhysically(sender, e);

            SharingHandler.OnContentDeleted(e?.SourceNode);

            // if there are sharing groups that should be deleted
            var sharingGroupIds = e?.GetCustomData(SharingGroupIdsCustomDataKey) as int[];

            if (sharingGroupIds?.Any() ?? false)
            {
                //TODO: if the list is too big, postpone deleting the groups
                // using a local task management API.

                System.Threading.Tasks.Task.Run(() =>
                {
                    try
                    {
                        using (new SystemAccount())
                        {
                            Parallel.ForEach(sharingGroupIds.Select(Node.LoadNode).Where(n => n != null),
                                             new ParallelOptions {
                                MaxDegreeOfParallelism = 4
                            },
                                             group => group.ForceDelete());
                        }
                    }
                    catch (System.Exception ex)
                    {
                        SnLog.WriteException(ex, "Error during deleting sharing groups.");
                    }
                });
            }
        }
Exemple #2
0
        protected override void OnNodeDeletedPhysically(object sender, NodeEventArgs e)
        {
            base.OnNodeDeletedPhysically(sender, e);

            if (e.GetCustomData(IdentitiesCustomDataKey) is List <int> ids)
            {
                SecurityHandler.DeleteIdentities(ids);
            }
        }
Exemple #3
0
        private static bool MustRefreshDimensions(Image image, NodeEventArgs e)
        {
            var setDimensions = e.GetCustomData(SETDIMENSION_KEYNAME);

            if (setDimensions == null)
            {
                return(false);
            }

            return(Convert.ToBoolean(setDimensions) &&
                   image.SavingState == ContentSavingState.Finalized &&
                   SetDimension(image));
        }