Page MenuHomePhabricator

UserIdentity interface has no isTemp method, is this intentional? Blocks updating Minerva
Closed, DeclinedPublicBUG REPORT

Description

While trying to modify Minerva for IP masking I ran into this error.

The UserIdentity interface has isRegistered but no isTemp method. Was this intentional? If so, how do you advise we check temporary state from a UserIdentity object?

Event Timeline

@tstarling is this intentional or should UserIdentity have the isTemp method?

Jdlrobson renamed this task from UserIdentity interface has no isTemp method, is this intentional? to UserIdentity interface has no isTemp method, is this intentional? Blocks updating Minerva.Feb 24 2023, 5:46 PM

The UserIdentity interface has isRegistered but no isTemp method. Was this intentional?

I suspect it's to keep UserIdentity free from service dependencies, as a simple value object. @tstarling or @daniel could confirm.

If so, how do you advise we check temporary state from a UserIdentity object?

We have been injecting UserNameUtils and using $this->userNameUtils->isTemp( $user->getName() ).

I suspect it's to keep UserIdentity free from service dependencies, as a simple value object. @tstarling or @daniel could confirm.

Yes, that's correct.

The reason that it has an isregistered() method is that it's synonymous with "has a user ID".

If so, how do you advise we check temporary state from a UserIdentity object?

We have been injecting UserNameUtils and using $this->userNameUtils->isTemp( $user->getName() ).

That's the correct approach, yes.

The alternative would eb to inject the knowledge into the constructor of UserIdentityValue. But it's a newable object, so the cosntructor signature is considered stable.

Thanks for the clarity.

@Jdlrobson There's a discussion about adding a user_is_temp column to the user table on T333223. If this goes ahead, I suppose the would be an isTemp method on UserIdentity.

This comment was removed by Tchanders.

@Jdlrobson There's a discussion about adding a user_is_temp column to the user table on T333223. If this goes ahead, I suppose the would be an isTemp method on UserIdentity.

I disagree. If we follow the pattern we also use for pages and revisions, UserIdentity represents *just* the identity, not information about the user. We would introduce a UserRecord or AccountRecord that represents information about the user.

The problem with adding information to the "identity" object is that it then becomes non-newable. But we want it to be possible to construct these objects directly, because you should be able to look up information about a user by supplying a UserIdentity.