Page MenuHomePhabricator

Investigate design of UserStore or UserAccountStore
Open, LowPublic

Description

To replace the "smart record" behavior in User, we need to introduce a data access service (DAO layer) for accessing the user and actor tables.

Interface draft:

interface ActorLookup {
    public function getActor( int $actorId, int $queryFlags =  0 ): UserIdentity; // throw if actor is not known (fall back to master?)
    public function getActorByName( string $name, int $queryFlags =  0  ): ?UserIdentity; // return null if unknown
    public function getActorByUserId( int $userId, int $queryFlags =  0  ): ?UserIdentity;; // return null if unknown
}

interface UserLookup {
    public function getUser( UserIdentity $user, int $queryFlags =  0 ): ?UserAccount; // return null if $user is not registered
}

class UserStore implements ActorLookup, UserLookup {
  public function registerActor( UserIdentity $actor ): UserIdentity; // returns a UserIdentity that has an actor id (just $actor, if that already has an ID)
  public function createUser( UserIdentity $user, array $info = [] ): UserAccount; // creates a user account, throws if the name is taken or $user has an ID
  public function updateUserRecord( UserAccount $user ); // fails if user does not exist (do we need UserRecord?)
}

Related Objects

Event Timeline

Change 657900 had a related patch set uploaded (by Ppchelko; owner: Ppchelko):
[mediawiki/core@master] WIP: poking actor storage

https://gerrit.wikimedia.org/r/657900

Change 661134 had a related patch set uploaded (by Ppchelko; owner: Ppchelko):
[mediawiki/core@master] WIP: ActorStore::registerActor

https://gerrit.wikimedia.org/r/661134

Change 661544 had a related patch set uploaded (by Ppchelko; owner: Ppchelko):
[mediawiki/extensions/FileImporter@master] Mock newSelectqueryBuilder when mocking DB in tests.

https://gerrit.wikimedia.org/r/661544

Change 661134 abandoned by Ppchelko:
[mediawiki/core@master] WIP: ActorStore::registerActor

Reason:

https://gerrit.wikimedia.org/r/661134

Change 661573 had a related patch set uploaded (by Ppchelko; owner: Ppchelko):
[mediawiki/core@master] TEST PHAN! Introduce ActorStore, ActorLookup and ActorFactory.

https://gerrit.wikimedia.org/r/661573

Change 661544 merged by jenkins-bot:
[mediawiki/extensions/FileImporter@master] Mock newSelectqueryBuilder when mocking DB in tests.

https://gerrit.wikimedia.org/r/661544

Change 661573 abandoned by Ppchelko:
[mediawiki/core@master] TEST PHAN! Introduce ActorStore, ActorLookup and ActorFactory.

Reason:

https://gerrit.wikimedia.org/r/661573

Change 661745 had a related patch set uploaded (by Ppchelko; owner: Ppchelko):
[mediawiki/core@master] DNM. Test phan. Introduce ActorStore, ActorLookup and ActorFactory.

https://gerrit.wikimedia.org/r/661745

Change 661745 abandoned by Ppchelko:
[mediawiki/core@master] DNM. Test phan. Introduce ActorStore, ActorLookup and ActorFactory.

Reason:

https://gerrit.wikimedia.org/r/661745

Change 661816 had a related patch set uploaded (by Ppchelko; owner: Ppchelko):
[mediawiki/core@master] DNM: Phan debug: Introduce ActorStore, ActorLookup and ActorFactory.

https://gerrit.wikimedia.org/r/661816

Change 661816 abandoned by Ppchelko:
[mediawiki/core@master] DNM: Phan debug: Introduce ActorStore, ActorLookup and ActorFactory.

Reason:

https://gerrit.wikimedia.org/r/661816

Change 657900 merged by jenkins-bot:
[mediawiki/core@master] Introduce ActorStore, ActorLookup and ActorFactory.

https://gerrit.wikimedia.org/r/657900

daniel lowered the priority of this task from Medium to Low.Feb 10 2021, 12:19 PM
daniel renamed this task from Introduce UserStore to Investigate design of UserStore or UserAccountStore.Jun 8 2021, 12:10 PM