-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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
@@ -56,7 +72,8 @@ protected function execute(InputInterface $input, OutputInterface $output): int | |||
'groups' => $groups, | |||
'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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Checked user:info first_seen
and looks good 👍
Can we also show this in user:list --info
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added.
Tested, thanks 🙏
/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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
8f05db4
to
7dc2bf9
Compare
/compile / |
4f20a9b
to
c5d3aa1
Compare
/compile / |
e79ace7
to
60b2e22
Compare
…er:info output Signed-off-by: Côme Chilliet <[email protected]>
Signed-off-by: Côme Chilliet <[email protected]>
Signed-off-by: Côme Chilliet <[email protected]>
…urrent date Signed-off-by: Côme Chilliet <[email protected]>
Signed-off-by: Christopher Ng <[email protected]>
Also format unknown and never in a better way. Signed-off-by: Côme Chilliet <[email protected]>
Co-authored-by: Joas Schilling <[email protected]> Signed-off-by: Côme Chilliet <[email protected]>
Signed-off-by: Côme Chilliet <[email protected]>
Signed-off-by: Côme Chilliet <[email protected]>
Signed-off-by: Côme Chilliet <[email protected]>
60b2e22
to
de8c450
Compare
/compile / |
Signed-off-by: nextcloud-command <[email protected]>
* | ||
* @since 31.0.0 | ||
*/ | ||
public function getFirstLogin(): int; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This and the above/below change will break all 3rdparty user backends?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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