feat: Add first login timestamp of each user to oc_preferences and user:info output#49377
feat: Add first login timestamp of each user to oc_preferences and user:info output#49377
Conversation
eb486cc to
fd366a6
Compare
I now store -1 for users which have already logged in before upgrade to 31, and show that as "unknown" in user:info output. |
fd366a6 to
f8c42b7
Compare
core/Command/User/Info.php
Outdated
| 'quota' => $user->getQuota(), | ||
| 'storage' => $this->getStorageInfo($user), | ||
| 'last_seen' => date(\DateTimeInterface::ATOM, $user->getLastLogin()), // ISO-8601 | ||
| 'first_seen' => $firstSeen, |
There was a problem hiding this comment.
Checked user:info first_seen and looks good 👍
Can we also show this in user:list --info?
There was a problem hiding this comment.
Added.
But I’m remembering now that last time a PR tried to show never for last_seen @nickvergessen objected that this was a breaking change.
So not sure what is the best way ahead here. It is not appropriate to show fake timestamp for never/unknown, on the other hand scripts need to be aware of it.
Maybe we simply note this as a breaking change and still merge the change?
|
/compile / |
159276f to
f102154
Compare
f00a83d to
99ba7d3
Compare
6a68788 to
8f05db4
Compare
|
|
||
| /** | ||
| * updates the timestamp of the most recent login of this user | ||
| * Returns the timestamp of the user's first login, 0 if the user did never login, or -1 if the data is unknown (first login was on an older version) |
There was a problem hiding this comment.
nit: int|null|false could make the three possible outcomes more explicit, and prevent someone from using the magic numbers for any kind of calculations.
|
/compile / |
4f20a9b to
c5d3aa1
Compare
|
/compile / |
e79ace7 to
60b2e22
Compare
…er:info output Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
…urrent date Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Signed-off-by: Christopher Ng <chrng8@gmail.com>
Also format unknown and never in a better way. Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Co-authored-by: Joas Schilling <213943+nickvergessen@users.noreply.github.com> Signed-off-by: Côme Chilliet <91878298+come-nc@users.noreply.github.com>
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
60b2e22 to
de8c450
Compare
|
/compile / |
Signed-off-by: nextcloud-command <nextcloud-command@users.noreply.github.com>
| * | ||
| * @since 31.0.0 | ||
| */ | ||
| public function getFirstLogin(): int; |
There was a problem hiding this comment.
This and the above/below change will break all 3rdparty user backends?
There was a problem hiding this comment.
Same as getPasswordHash/setPasswordHash below did for 30.
But actually no, most apps do not implement IUser.
I see those:
- lib/private/Remote/User.php:class User implements IUser {
- lib/private/User/LazyUser.php:class LazyUser implements IUser {
- lib/private/User/User.php:class User implements IUser {
- apps/notifications/lib/FakeUser.php:class FakeUser implements IUser {
- apps-extra/groupfolders/tests/stubs/oc_user_user.php:class User implements IUser {
- apps-extra/guests/tests/stub.php: class User implements IUser {
So only notifications implements it.
There was a problem hiding this comment.
Right, I mixed it up with the backends, I thought each backend implements their own IUser, but seems to not be the case.
|
@Pytal one comment about the UI, could we remove the seconds count? |


See #22640
Close #48649
Summary
Add First login information in the user settings, as is done for last login
Checklist