When you assign and remove a role from a user.
The user gets removed from {domain_editor}

I think the reason can be found in domain_user , case 'update'.
If edit['domain_user'] is empty, it doesn't mean that no domain is assigned.
I solved this by wrapping the code in case 'update':

case 'update':
if( isset($edit['domain_user'])){
  ..
}
break;

this seems to solve the issue, but I haven't verified it thoroughly.
Can someone confirm this bug?
if not I have done something funky with the code =)

Comments

agentrickard’s picture

From which form are you assigning the role?

agentrickard’s picture

Status: Active » Postponed (maintainer needs more info)
jolos’s picture

Sorry for the not so fast reaction.

I'm doing this from admin/user/user.

Some more clarification on what I'm doing:

(1) I disable my custom modules
(2) I select a user
(3) I ensure this user is assigned to a domain.
(4) in admin/user/user I assign a role to the user
(5) the role gets assigned
(6) I check the domains of the user, and I see that the only domain assigned to the user is the primary domain.

agentrickard’s picture

Status: Postponed (maintainer needs more info) » Active

And you're entering that formed from the primary domain?

We probably are not accounting for how the batch form interacts with hook_user.

jolos’s picture

I was doing this from the primary domain. When I assign the role on a secondary domain the problem doesn't occur.

agentrickard’s picture

Status: Active » Fixed
StatusFileSize
new801 bytes

Nice catch. We should have seen this earlier.

Committed to HEAD.

agentrickard’s picture

StatusFileSize
new2.25 KB

Here is a D5 patch, which also catches a similar error in Domain User.

agentrickard’s picture

StatusFileSize
new2.24 KB

Revised version of the D6 patch.

Status: Fixed » Closed (fixed)

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