one more issue for you, Soren.

if the user was deleted, it's impossible to delete its role applications.

Comments

Soren Jones’s picture

Vitalie,

Thank you!

Soren Jones’s picture

Assigned: Unassigned » Soren Jones
Status: Active » Needs review

I don't have much time now. This should take care of the problem in the future. It doesn't deal with the orphans, now. If you have access to your database, you can delete them by hand. I'll try to get around to an orphan function later this week.

Thanks, again!

Soren Jones’s picture

Status: Needs review » Active

Fixed in 5 and 6 -dev. But I'm leaving this as active as a reminder to myself until there's also a fix for orphaned applications.

drewish’s picture

Status: Active » Needs review
StatusFileSize
new1.11 KB

this should do the trick for D6. you might want to bump the update number down to 5000 something so you can also commit it to the D5 branch and avoid having it run multiple times... thought it wouldn't really matter.

vv7’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Soren Jones’s picture

Status: Closed (fixed) » Active

Since I haven't thought of anything better and it was a waste not to use this in the first place...applying to the next release.

Soren Jones’s picture

Version: » 7.x-1.x-dev
Assigned: Soren Jones » Unassigned
Category: bug » task

This was fixed in 6 in commit #108507 and in 5 in commit #108516. The issue is that there isn't currently a way to identify and delete orphaned applications. As the bug has been fixed, I'm changing this to a task. We shouldn't ever run into this problem again, but a) we should have a test for it and b) we should check for orphaned applications and delete them.

jnicola’s picture

Category: Task » Feature request
Priority: Normal » Minor
Issue summary: View changes
Status: Active » Needs work

Hmmm...

Makes sense that this could be a bug.

Two possible ways of handling:
1- Check user is active on view rendering of application. If they don't exist, delete application
2- Create a cron job that reviews all applications for the user being active and not blocked. If they're deleted and/or blocked, delete application.

jnicola’s picture

Oh I just got a better idea...

I can jump on hook_entity_delete() and simply find all applications for a deleted user, and delete the applications.

This would be a nice and easy task for somebody. It would also be beneficial to break the deleting application part out into it's own function for possible usage elsewhere in the module.

jnicola’s picture

Assigned: Unassigned » jnicola
alexvn30’s picture

thanks, again
more..

jnicola’s picture

Version: 7.x-1.x-dev » 7.x-2.x-dev
Status: Needs work » Needs review
StatusFileSize
new906 bytes

Okay! I fixed this as I wrote above... but it needs testing!

First off, I pushed the hook_entity_delete aspect straight to the dev branch. Makes total sense to have this in there! A user gets deleted, delete their role applications as well! This functionality works, and is ultra straight forward!

Secondly, I recognize this leaves users who have the problem listed above without help... so I wrote an update script that should find all orphaned applications and delete them... SHOULD being the operative term. I am also rusty at writing SQL so it's definitely not the best query ever.

I've attached a patch. Give it a go, and let me know if it works!