This project is read-only.

Deleting users leave behind their parts?

Topics: Core
Feb 24, 2012 at 2:02 PM

I'm working on a migration plan for porting all our users to orchard, and noticed that when I delete a user, it doesn't delete the UserPart.

How can I solve this? On our site deleted would mean 'deleted' and not just 'hidden'.

Feb 24, 2012 at 3:18 PM

Does it cause any problems?

When an item is deleted, it's flagged as deleted but remains in the database. For all functional purposes it no longer exists.

Feb 24, 2012 at 5:19 PM

Well, how can I change this?

I can agree that this shouldn't be deleted instantly, but at least offer a way to 'purge' these obsolete data out of the database.

I mean, why retain (potential) PRIVATE information indefinitely?

I wouldn't want my private information sticking around on someones database when I requested my account to be deleted. Would you?

Feb 25, 2012 at 2:37 AM

You can write scripts that wipe out deleted records. As anything in Orchard, features get implemented when somebody needs them badly enough to spend the time to write them.

Feb 25, 2012 at 11:32 AM

How can I find out if a record is marked deleted?

Feb 25, 2012 at 1:50 PM

Actually in most systems there is a strong argument to keep audit history around indefinitely, from both security and legal points of view, unless someone specifically requests that you wipe their data (for instance under the data protection act) - and even then it's better to remove personal details but leave the user record in place, because other records in the database may have a foreign key (or less tightly coupled relationship) with that object. So yes, while I agree proper deletion should be possible (and technically it is, you can manually purge records in SQL!), I can also see why nobody even raised this point before... e.g. how do you see who created or edited that particular page two years later if you've deleted all record of the existence of a user?

Personally, I accept the fact that once I've submitted my details to a website those details will probably stick around for ever! I don't think I've ever even asked for an account to be deleted.

Anyway, for your purposes I think the deleted flag will be on the ContentItemRecord table and/or ContentItemVersionRecord.

Feb 27, 2012 at 9:20 AM
Edited Feb 27, 2012 at 3:27 PM

How would I excluded deleted parts when querying using the content manager? Or does that automaticly exclude deleted parts?

edit: Same question about when accessing through IRepository<> queries.

Feb 28, 2012 at 5:16 AM

It does exclude deleted items. You can also specify explicitly when querying which versions you want.

Feb 28, 2012 at 1:37 PM

IRepository<> is nothing to do with content management, it's basically raw table access. When you delete a record from an IRepository it is actually deleted.

Feb 28, 2012 at 1:39 PM

I figured as much, but thanks for the confirmation.

Got an example on how I can query the 'raw' table of a part, excluding all 'deleted' entries?

Feb 28, 2012 at 4:06 PM

Why do you need to ... can't you just use a normal content manager query?

Feb 28, 2012 at 4:08 PM
randompete wrote:

Why do you need to ... can't you just use a normal content manager query?

In need to 'link' non-part records to my user data, so I need to know when a certain entry is linked to a deleted user.

Feb 28, 2012 at 5:12 PM

Presumably it stores a user id ... so can't you just look that user up in content manager and check whether it's deleted? ... Also you can handle the Removed content event in a handler, and do something appropriate with your joined table at that time ... better to handle it proactively.

Mar 26, 2012 at 4:09 PM

Well I need to query for a UserPart using HQL, where I need to match the property of a custom part that I attached to the user : any clue how I would do that, while ignoring deleted UserParts?

So in short : how do I ignore deleted parts when querying using HQL : I have no idea how they are linked together :s