コード例 #1
0
        protected override void OnNodeMoved(object sender, NodeOperationEventArgs e)
        {
            if (!Configuration.Enabled)
            {
                return;
            }

            var currentUser    = User.Current;
            var srcnode        = e.SourceNode;
            var creatorId      = srcnode.CreatedById;
            var lastModifierId = currentUser.Id;
            var who            = GetUserName(currentUser);

            if (IsInTrash(e.OriginalSourcePath))
            {
                Event.CreateAndSave(srcnode.Path, creatorId, lastModifierId, NotificationType.Restored, who);
                return;
            }
            if (IsInTrash(srcnode.Path))
            {
                Event.CreateAndSave(e.OriginalSourcePath, creatorId, lastModifierId, NotificationType.Deleted, who);
                return;
            }
            Event.CreateAndSave(e.OriginalSourcePath, creatorId, lastModifierId, NotificationType.MovedTo, who);
            Event.CreateAndSave(srcnode.Path, creatorId, lastModifierId, NotificationType.MovedFrom, who);
        }
コード例 #2
0
 protected override void OnNodeMoved(object sender, NodeOperationEventArgs e)
 {
     base.OnNodeMoved(sender, e);
     if (IsSubtreeContaining(e.OriginalSourcePath))
     {
         Invalidate();
     }
 }
コード例 #3
0
        protected override void OnNodeCopied(object sender, NodeOperationEventArgs e)
        {
            bool invalidated = OnInvalidate(sender, e.SourceNode);

            if (!invalidated)
            {
                OnInvalidate(sender, e.TargetNode);
            }
        }
コード例 #4
0
        protected override void OnNodeMoved(object sender, NodeOperationEventArgs e)
        {
            var invalidated = OnInvalidate(sender, e.OriginalSourcePath);

            if (!invalidated)
            {
                OnInvalidate(sender, e.TargetNode);
            }
        }
コード例 #5
0
ファイル: SkinManager.cs プロジェクト: vlslavik/SenseNet
        protected override void OnNodeCopied(object sender, NodeOperationEventArgs e)
        {
            base.OnNodeCopied(sender, e);

            if (e.TargetNode.Path.StartsWith(SkinObserver.SkinStartPath))
            {
                var targetPath = RepositoryPath.Combine(e.TargetNode.Path, e.SourceNode.Name);
                SkinManager.Instance.AddToMap(targetPath);
            }
        }
コード例 #6
0
 protected override void OnNodeMoved(object sender, NodeOperationEventArgs e)
 {
     RouteEvent(RepositoryEvent.Moved, sender, e.SourceNode);
 }
コード例 #7
0
        protected override void OnNodeMoved(object sender, NodeOperationEventArgs e)
        {
            // We do not have to deal with content outside of the IMS folder, because
            // moving local groups does not involve any membership change.
            if (!e.OriginalSourcePath.StartsWith(RepositoryStructure.ImsFolderPath + RepositoryPath.PathSeparator) && !e.SourceNode.Path.StartsWith(RepositoryStructure.ImsFolderPath + RepositoryPath.PathSeparator))
            {
                return;
            }

            base.OnNodeMoved(sender, e);

            var movedUsers  = new List <int>();
            var movedGroups = new List <int>();

            // if the moved content is an identity, put it into the appropriate list
            if (e.SourceNode is User)
            {
                movedUsers.Add(e.SourceNode.Id);
            }
            else if (e.SourceNode is Group || e.SourceNode is OrganizationalUnit)
            {
                movedGroups.Add(e.SourceNode.Id);
            }
            else
            {
                // If the moved content is an irrelevant container (e.g. a folder), collect relevant (first-level) child content (users, groups
                // and child orgunits even inside simple subfolders). These are already moved to the new location, but we only need their ids.
                using (new SystemAccount())
                {
                    CollectSecurityIdentityChildren(NodeHead.Get(e.SourceNode.Path), movedUsers, movedGroups);
                }
            }

            // empty collections: nothing to do
            if (movedUsers.Count == 0 && movedGroups.Count == 0)
            {
                return;
            }

            // find the original parent orgunit (if there was one)
            var parent           = Node.LoadNode(RepositoryPath.GetParentPath(e.OriginalSourcePath));
            var originalParentId = 0;
            var targetParentId   = 0;

            if (parent is OrganizationalUnit)
            {
                originalParentId = parent.Id;
            }
            else
            {
                using (new SystemAccount())
                {
                    parent = GetFirstOrgUnitParent(parent);
                    if (parent != null)
                    {
                        originalParentId = parent.Id;
                    }
                }
            }

            // find the target parent orgunit (if there is one)
            using (new SystemAccount())
            {
                parent = GetFirstOrgUnitParent(e.SourceNode);
                if (parent != null)
                {
                    targetParentId = parent.Id;
                }
            }

            // remove relevant child content from the original parent org unit (if it is different from the target)
            if (originalParentId > 0 && originalParentId != targetParentId)
            {
                SecurityHandler.RemoveMembers(originalParentId, movedUsers, movedGroups);
            }

            // add the previously collected identities to the target orgunit (if it is different from the original)
            if (targetParentId > 0 && originalParentId != targetParentId)
            {
                SecurityHandler.AddMembers(targetParentId, movedUsers, movedGroups);
            }
        }
コード例 #8
0
 protected override void OnNodeMoved(object sender, NodeOperationEventArgs e)
 {
     base.OnNodeMoved(sender, e);
     InvalidateCache(sender, e);
 }
コード例 #9
0
 protected internal override void OnNodeCopied(object sender, NodeOperationEventArgs e)
 {
     RouteEvent(RepositoryEvent.Copied, sender, e.SourceNode);
 }
コード例 #10
0
 protected override void OnNodeCopied(object sender, NodeOperationEventArgs e)
 {
     Log(e, null, e.TargetNode);
 }
コード例 #11
0
 protected override void OnNodeMoved(object sender, NodeOperationEventArgs e)
 {
     Log(e, e.OriginalSourcePath, e.TargetNode);
 }
コード例 #12
0
ファイル: ApplicationQuery.cs プロジェクト: y1027/sensenet
 protected override void OnNodeMoved(object sender, NodeOperationEventArgs e)
 {
     OnInvalidate(sender, e.SourceNode.Path);
     OnInvalidate(sender, e.TargetNode.Path);
 }
コード例 #13
0
 protected override void OnNodeMoved(object sender, NodeOperationEventArgs e)
 {
     SNScriptDependencyCache.Instance.RemovePath(e.OriginalSourcePath);
 }
コード例 #14
0
 protected internal override void OnNodeCopied(object sender, NodeOperationEventArgs e)
 {
     OnInvalidate(sender, e.TargetNode.Path);
 }
コード例 #15
0
 protected override void OnNodeCopied(object sender, NodeOperationEventArgs e)
 {
     base.OnNodeCopied(sender, e);
     StartWorkflowAutomatically(e.TargetNode, TriggerEvent.Created, null);
 }