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

[full-ci] Add account creation time #40588

Merged
merged 16 commits into from
Jan 26, 2023
Merged

Conversation

pako81
Copy link

@pako81 pako81 commented Jan 20, 2023

Description

Add account creation time

Related Issue

Motivation and Context

Add account creation time in the oc_accounts table so that this info can be displayed over the Users page. Also extended the users provisioning API and the user:list occ command to display this info.

How Has This Been Tested?

Manually:

Test 1 :

  • create an user over the WebUI and check that the Creation Time column correctly displays this info

image

Test 2 :

  • create an LDAP user and run the user:sync command and check that the Creation Time column correctly displays this info

Test 3 :

-Share with a guest user (create the user) and check that the Creation Time column correctly displays this info

Test 4 :

  • Use the user:add occ command to create a new user and check that the Creation Time column correctly displays this info

Test 5 :

  • Create the user by mean of the users provisioning API and check that this info is correctly displayed:
<?xml version="1.0"?>
<ocs>
 <meta>
  <status>ok</status>
  <statuscode>100</statuscode>
  <message/>
 </meta>
 <data>
  <enabled>true</enabled>
  <quota>
   <definition>default</definition>
  </quota>
  <email/>
  <displayname>user14</displayname>
  <home>/var/www/html/owncloud10110/data/user14</home>
  <two_factor_auth_enabled>false</two_factor_auth_enabled>
  <last_login>0</last_login>
  <creation_time>1674161957</creation_time>
  <language>en</language>
 </data>
</ocs>

Test 6 :

  • Use the user:list occ command to show user's attributes and check that this info is correctly displayed:
- user14:
    - uid: user14
    - displayName: user14
    - email
    - quota: default
    - enabled: true
    - lastLogin: 0
    - creationTime: 1674161957
    - home: /var/www/html/owncloud10110/data/user14
    - backend: Database
    - cloudId: user14@xxx.xxx.xx.xx/owncloud
    - searchTerms:

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 Jan 20, 2023
@pako81 pako81 self-assigned this Jan 20, 2023
Copy link
Member

@DeepDiver1975 DeepDiver1975 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indent looks off in some places

lib/public/IUser.php Outdated Show resolved Hide resolved
@DeepDiver1975 DeepDiver1975 force-pushed the add_account_creation_time branch from 3c7f24c to ae2f786 Compare January 23, 2023 08:23
@ownclouders
Copy link
Contributor

ownclouders commented Jan 23, 2023

💥 Acceptance tests pipeline webUIFfSmoke-3-1-firefox-mariadb10.2-php7.4 failed. The build has been cancelled.

https://drone.owncloud.com/owncloud/core/37736/158

@DeepDiver1975
Copy link
Member

Screenshot from 2023-01-24 11-50-14

@phil-davis
Copy link
Contributor

On the UI, for existing users, the UI shows Creation Time "never". Maybe it would be better to have a special-case text in that case (when Creation Time" is Unix timestamp 0), and say "unknown".

@phil-davis phil-davis changed the title Add account creation time [full-ci] Add account creation time Jan 25, 2023
@DeepDiver1975
Copy link
Member

On the UI, for existing users, the UI shows Creation Time "never". Maybe it would be better to have a special-case text in that case (when Creation Time" is Unix timestamp 0), and say "unknown".

@pako81

@owncloud owncloud deleted a comment from update-docs bot Jan 25, 2023
@phil-davis
Copy link
Contributor

Locally, I had to make sure that the migration ran, so that the accounts table change happened. I pushed a commit to do the smallest version bump in this PR. I also put full-ci in the PR title, so that I can see all the test results.

Locally the reported failing scenario runs for me - I will dig more after CI finishes.

@pako81
Copy link
Author

pako81 commented Jan 25, 2023

On the UI, for existing users, the UI shows Creation Time "never". Maybe it would be better to have a special-case text in that case (when Creation Time" is Unix timestamp 0), and say "unknown".

Should be addressed now.

@phil-davis
Copy link
Contributor

Should be addressed now.

works for me.

@phil-davis
Copy link
Contributor

https://drone.owncloud.com/owncloud/core/37752/158/17

runsh: Total unexpected failed scenarios throughout the test run:
webUIAddUsers/addUsers.feature:115
webUIAddUsers/addUsers.feature:116
Failed step: And the administrator resends the invitation email for user "guiusr1" using the webUI
        (1366.300048828125, 175.31666564941406) is out of bounds of viewport width (1360) and height (899)

@phil-davis
Copy link
Contributor

https://drone.owncloud.com/owncloud/core/37752/119/17
The scenario passes in the normal pipeline running chrome.
But fails in the pipeline that runs all the smoke-tests on Firefox.

In tests/acceptance/run.sh there is special code that tries to set the browser window big enough:

	if [ "${BROWSER}" == "firefox" ]
	then
		# Set the screen resolution so that hopefully draggable elements will be visible
		# FF gives problems if the destination element is not visible
		EXTRA_CAPABILITIES='"screenResolution":"1920x1080",'

		# This selenium version works for Firefox after V47
		# We no longer need to support testing of Firefox V47 or earlier
		EXTRA_CAPABILITIES='"seleniumVersion":"3.4.0",'${EXTRA_CAPABILITIES}
	fi

The problem is that the UI testing framework (Behat+Mink+selenium) does not successfully auto-scroll elements into view during test execution. When a UI is wide, it is easy to have elements that are off the right-hand side of the displayed area, and so are not clickable. The User Management page is wide, (lots of columns) and gets wider with this change. The failing scenario trys to click the "Resend invitation email" button, and that is way off on the right-hand edge. I am running Firefox, and I can do it manually, but I have to scroll the window all the way to the right.

IMO it is not worth trying to run this scenario on Firefox and not worth trying to adjust the screen size etc. I will skip it on Firefox.

@phil-davis
Copy link
Contributor

I added a couple of acceptance tests that check that creation time is returned in the provisioning API, as is visible on the webUI.

They pass locally for me. I expect that CI will pass.

Copy link
Contributor

@phil-davis phil-davis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, works locally.
Needs a developer review. The code looks OK to me, but it would be good to have another review.

@@ -102,6 +102,14 @@ public function updateLastLoginTimestamp() {
return true;
}

/**
* Reset user creation time (return 0)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indentation is wrong here

*
* @return void
*/
public function setCreationTime() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this method be implemented? I mean, I could get an user instance and update the creation time, but I don't think we should allow that.

* @return void
* @since 10.12.0
*/
public function setCreationTime();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As said, I don't think this method should be public.
The creation time is handled by the account class, and the user has a dependency on the account in order to get the creation time, but it doesn't imply the user should be allowed to set the creation time.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mechanisms like the user sync command needs this?

But I guess you are right - this field should be set internally on creation of an account.

I'll take care.

THX @jvillafanez

@phil-davis phil-davis mentioned this pull request Jan 26, 2023
11 tasks
@DeepDiver1975 DeepDiver1975 force-pushed the add_account_creation_time branch from cc48aa1 to 7be755d Compare January 26, 2023 10:23
@sonarqubecloud
Copy link

SonarCloud Quality Gate failed.    Quality Gate failed

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

20.0% 20.0% Coverage
10.4% 10.4% Duplication

@DeepDiver1975 DeepDiver1975 merged commit 705290a into master Jan 26, 2023
@delete-merged-branch delete-merged-branch bot deleted the add_account_creation_time branch January 26, 2023 11:45
@phil-davis
Copy link
Contributor

phil-davis commented Jan 30, 2023

Note: unit tests for issue owncloud/configreport#184 PR owncloud/configreport#185 had to be adjusted to include mention of this new account data item.

@jnweiger
Copy link
Contributor

jnweiger commented Mar 3, 2023

Confirmed in 10.12.0-rc.2

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.

6 participants