. */ declare(strict_types=1); namespace FireflyIII\Repositories\User; use FireflyIII\Models\InvitedUser; use FireflyIII\Models\Role; use FireflyIII\User; use Illuminate\Contracts\Auth\Authenticatable; use Illuminate\Support\Collection; /** * Interface UserRepositoryInterface. */ interface UserRepositoryInterface { /** * Returns a collection of all users. */ public function all(): Collection; /** * Gives a user a role. */ public function attachRole(User $user, string $role): bool; /** * This updates the users email address and records some things so it can be confirmed or undone later. * The user is blocked until the change is confirmed. * * @see updateEmail */ public function changeEmail(User $user, string $newEmail): bool; /** * @return mixed */ public function changePassword(User $user, string $password); public function changeStatus(User $user, bool $isBlocked, string $code): bool; /** * Returns a count of all users. */ public function count(): int; public function createRole(string $name, string $displayName, string $description): Role; public function deleteEmptyGroups(): void; public function deleteInvite(InvitedUser $invite): void; public function destroy(User $user): bool; public function find(int $userId): ?User; public function findByEmail(string $email): ?User; /** * Returns the first user in the DB. Generally only works when there is just one. */ public function first(): ?User; public function getInvitedUsers(): Collection; public function getRole(string $role): ?Role; public function getRoleByUser(User $user): ?string; public function getRolesInGroup(User $user, int $groupId): array; /** * Return basic user information. */ public function getUserData(User $user): array; public function hasRole(null|Authenticatable|User $user, string $role): bool; public function inviteUser(null|Authenticatable|User $user, string $email): InvitedUser; public function redeemCode(string $code): void; /** * Remove any role the user has. */ public function removeRole(User $user, string $role): void; /** * Set MFA code. */ public function setMFACode(User $user, ?string $code): void; public function store(array $data): User; public function unblockUser(User $user): void; /** * Update user info. */ public function update(User $user, array $data): User; /** * This updates the users email address. Same as changeEmail just without most logging. This makes sure that the * undo/confirm routine can't catch this one. The user is NOT blocked. * * @see changeEmail */ public function updateEmail(User $user, string $newEmail): bool; public function validateInviteCode(string $code): bool; }