Skip to content
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

occ: Improve user:lastseen timestamp #44641

Closed
nooblag opened this issue Apr 3, 2024 · 0 comments · Fixed by #44666
Closed

occ: Improve user:lastseen timestamp #44641

nooblag opened this issue Apr 3, 2024 · 0 comments · Fixed by #44666
Labels
0. Needs triage Pending check for reproducibility or if it fits our roadmap enhancement feature: occ feature: users and groups

Comments

@nooblag
Copy link
Contributor

nooblag commented Apr 3, 2024

Is your feature request related to a problem? Please describe.
Regarding the improvements to occ in #39669 that were recently merged, the times returned always seem to be in UTC. This is a proposal to improve the date/time formatting to either:

A) leave all times in hardcoded UTC and make that explicit (by adding UTC to the end of the time), or
B) show the times from the PHP timezone set in php.ini (and display that timezone information after the date/time).

Also, at the moment, the output of user:info timestamp is: 2024-04-03T00:40:22+00:00 which is different to user:lastseen's format of 2024-04-03 22:29.

There is also a bug in user:info if login has never been seen, which I'll describe at the end of this post.

Describe the solution you'd like
Personally, I'd like option B, to show the times from the PHP timezone set in php.ini and display that timezone information after the date/time, and unify for each output.

For example, something like:

$ sudo -u www-data php /var/www/nextcloud/occ user:lastseen test
test's last login: 2024-04-03 22:29:36 AEDT
$ sudo -u www-data php /var/www/nextcloud/occ user:info test
  - user_id: test
  - display_name: test
  - email: test@test.local
  - cloud_id: test@test.local
  - enabled: true
  - groups:
    - admin
  - quota: none
  - storage:
    - free: 2198323200
    - used: 38251355
    - total: 2236574555
    - relative: 1.71
    - quota: -3
  - last_seen: 2024-04-03 22:29:36 AEDT
  - user_directory: /var/www/nextcloud/data/test
  - backend: Database

Describe alternatives you've considered
The other alternative could be to leave the times displayed always in UTC, but to just make that explicit:

For example:

$ sudo -u www-data php /var/www/nextcloud/occ user:lastseen test
test's last login: 2024-04-03 11:29:36 UTC

or similar...

$ sudo -u www-data php /var/www/nextcloud/occ user:info test
  - user_id: test
  - display_name: test
  - email: test@test.local
  - cloud_id: test@test.local
  - enabled: true
  - groups:
    - admin
  - quota: none
  - storage:
    - free: 2198323200
    - used: 38251355
    - total: 2236574555
    - relative: 1.71
    - quota: -3
  - last_seen: 2024-04-03 11:29:36 UTC
  - user_directory: /var/www/nextcloud/data/test
  - backend: Database

There is also a bug in user:info if login has never been seen. It appears to show a Unix epoch time, instead of perhaps something like 'never', which we could also make consistent with user:lastseen output, for instance:

$ sudo -u www-data php /var/www/nextcloud/occ user:info bob
  - user_id: bob
  - display_name: Bob
  - email: bob@example.com
  - cloud_id: bob@test.local
  - enabled: true
  - groups:
    - Everyone
  - quota: 2 GB
  - storage:
    - free: 2146980495
    - used: 503153
    - total: 2147483648
    - relative: 0.02
    - quota: 2147483648
  - last_seen: 1970-01-01T00:00:00+00:00
  - user_directory: /var/www/nextcloud/data/bob
  - backend: Database
@nooblag nooblag added 0. Needs triage Pending check for reproducibility or if it fits our roadmap enhancement labels Apr 3, 2024
@nooblag nooblag changed the title occ: Improve and make consistent user:lastseen and user:info timestamps occ: Improve user:lastseen timestamp Aug 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0. Needs triage Pending check for reproducibility or if it fits our roadmap enhancement feature: occ feature: users and groups
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants