Example #1
0
        /// <summary>
        /// The <c>DeleteUser</c> function deletes a user created by psdShare.
        /// It also removes all entries in his folder and all occurrences of
        /// the specified user in the KeeShare-groups. So after deleting a
        /// user all information about what you shared with that user are
        /// lost.
        /// </summary>
        /// <param name="root">rootNode of the user we want to delete</param>
        protected void DeleteUser(PwEntry root)
        {
            //userspecific group should exist so we have to try to delete it
            PwGroup theUsersGroup = m_database.GetUserHomeFor(root, false);

            if (null != theUsersGroup)
            {
                theUsersGroup.DeleteFrom(m_database.GetUsersGroup(), m_database);
            }
            //find all occurrences of the user in the entire tree an remove them
            //that automatically includes all shares
            RemoveBrokenProxies();
        }
Example #2
0
        private Changes RemoveDeletedSharingNodes(PwEntry userNode, PwGroup userHome, PwGroup usersGroup)
        {
            PwGroup recycleBin = m_database.RootGroup.FindGroup(m_database.RecycleBinUuid, false);

            Debug.Assert(userNode.IsInsideParent(recycleBin));
            //we delete the user completely
            userNode.DeleteFrom(userNode.ParentGroup, m_database);

            RemoveBrokenProxies();

            //if only the rootNode was moved to trash, we have to delete the users Home too!
            if (null != userHome)
            {
                userHome.DeleteFrom(usersGroup, m_database);
            }
            return(Changes.GroupDeleted | Changes.EntryDeleted);
        }