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

fix: user:list -a command now correctly displays user's creation time #41125

Merged
merged 2 commits into from Nov 28, 2023

Conversation

pako81
Copy link
Contributor

@pako81 pako81 commented Nov 27, 2023

Description

The user:list -a occ command now correctly displays user's creation time.

Motivation and Context

User's creation time was not correctly returned when using the -a key.

How Has This Been Tested?

Manually. Before:

sudo -u www-data php occ user:list -a creationTime
  - admin: /var/www/html/owncloud10133/data/admin
  - user1: /var/www/html/owncloud10133/data/user1
  - user2: /var/www/html/owncloud10133/data/user2
  - user3: /var/www/html/owncloud10133/data/user3

After:

sudo -u www-data php occ user:list -a creationTime
  - admin: 1700847050
  - user1: 1700847086
  - user2: 1701083934
  - user3: 1701083990

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Database schema changes (next release will require increase of minor version instead of patch)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Technical debt
  • Tests only (no source changes)

Checklist:

  • Code changes
  • Unit tests added
  • Acceptance tests added
  • Documentation ticket raised
  • Changelog item

@pako81 pako81 added this to the development milestone Nov 27, 2023
@pako81 pako81 self-assigned this Nov 27, 2023
@pako81 pako81 changed the title fix: user:list now correctly displays user's creation time fix: user:list -a command now correctly displays user's creation time Nov 27, 2023
Copy link

sonarcloud bot commented Nov 27, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

0.0% 0.0% Coverage
0.0% 0.0% Duplication

@jvillafanez
Copy link
Member

Side note: we should probably show the date with a standard format.

@pako81
Copy link
Contributor Author

pako81 commented Nov 28, 2023

Side note: we should probably show the date with a standard format.

Should we not rather stay consistent with the lastLogin attribute which is also reported in timestamp format?

Another possibility would be to also convert lastLogin but in this case we need to consider the case where it is set to 0 (user has not performed the first login yet) which otherwise would be converted to January 1, 1970 when using the formatDateTime method.

@phil-davis
Copy link
Contributor

$ php occ user:list -s
...
  - harry:
    - uid: harry
    - displayName: harry
    - email: harrydavis@example.com
    - quota: default
    - enabled: true
    - lastLogin: 1689843012
    - creationTime: 0
    - home: /home/phil/git/owncloud/core/data/harry
    - backend: Database
    - cloudId: harry@localhost
    - searchTerms:
...
  - user1:
    - uid: user1
    - displayName: user1
    - email
    - quota: default
    - enabled: true
    - lastLogin: 1679373156
    - creationTime: 1679372958
    - home: /home/phil/git/owncloud/core/data/user1
    - backend: Database
    - cloudId: user1@localhost
    - searchTerms:

creationTime is already reported in the full listing as a Unix timestamp number. I have some older users that have a zero creation time (that is from the past before this attribute was recorded). So adjusting the output format of login time and creation time is a separate issue - if someone thinks that there is a requirement/need for that.

@phil-davis phil-davis merged commit b12eb6f into master Nov 28, 2023
3 checks passed
@delete-merged-branch delete-merged-branch bot deleted the fix_userlist_creationTime branch November 28, 2023 23:48
@owncloud owncloud deleted a comment from update-docs bot Nov 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants