Skip to content

Add row for guest users to command occ user:report#38742

Merged
AlexAndBear merged 2 commits intomasterfrom
enterprise/issues/3467
May 21, 2021
Merged

Add row for guest users to command occ user:report#38742
AlexAndBear merged 2 commits intomasterfrom
enterprise/issues/3467

Conversation

@AlexAndBear
Copy link
Copy Markdown

@AlexAndBear AlexAndBear commented May 18, 2021

Description

Enhancement: Command occ user:report shows additional row for guests

With this improvement, a new row will be rendered for guest user count on the
occ user:report command.

Related Issue

Motivation and Context

How Has This Been Tested?

  • test environment:
  • test case 1:
  • test case 2:
  • ...

Screenshots (if appropriate):

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, see TEMPLATE

@AlexAndBear AlexAndBear requested review from jvillafanez and mrow4a May 18, 2021 07:46
@AlexAndBear AlexAndBear force-pushed the enterprise/issues/3467 branch from 5d63328 to b65f995 Compare May 18, 2021 07:51
@owncloud owncloud deleted a comment from update-docs bot May 18, 2021
@AlexAndBear
Copy link
Copy Markdown
Author

@jvillafanez not quite sure if we need to introduce \OC::$server->getUserTypeHelper

@jvillafanez
Copy link
Copy Markdown
Member

Double-check the following scenario:

  1. Using the "guests" app, create some guests
  2. Check occ user:report for guests
  3. Disable the "guests" app
  4. Recheck occ user:report

I think the guests will be counted as normal users in step 4. It doesn't seem right.

Honestly, I don't know how much knowledge core has about guests, nor what is the exact relationship with the guests app. It seems that we're adding responsibilities into core that wasn't designed for.
We might need to redesign this part to clarify responsibilities and relationships among components.

@AlexAndBear
Copy link
Copy Markdown
Author

@jvillafanez We can easily overcome this issue by adjusting the UserTypeHelper::isGuestUser, it pre-checks if the app is enabled and if not, it returns false.

I introduced this helper and feel confident with removing the check

@AlexAndBear
Copy link
Copy Markdown
Author

@jvillafanez changed check to find out if a user is guest user, now your provided example give correct results

* @return bool
*/
public function isGuestUser($uid) {
$guestsAppEnabled = $this->appManager->isEnabledForUser('guests');
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@VicDeo any expected side effect for this removal? I don't remember if there was a reason for this check. Removing it looks fine to me.

Copy link
Copy Markdown
Member

@VicDeo VicDeo May 20, 2021

Choose a reason for hiding this comment

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

@jvillafanez well... my initial logic was like this: if the guests app is disabled the instance has no guests at all. Because the guests capability is provided by the respective app
In this context 'guest' is a user managed by the guests app.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Yes, that was my idea too. Technically, it makes sense.
We should properly implement something in core to provide different user types

@jvillafanez
Copy link
Copy Markdown
Member

I'd wait a bit for confirmation on #38742 (comment) . The rest is mostly style things easy to fix.

@mmattel
Copy link
Copy Markdown
Contributor

mmattel commented May 18, 2021

doc relevant, pls file an issue in docs close to merging.
pls add an example output which eases our documentation effort 😄

@AlexAndBear AlexAndBear force-pushed the enterprise/issues/3467 branch from 9bc9015 to 8f3b6df Compare May 18, 2021 12:52
@AlexAndBear
Copy link
Copy Markdown
Author

@mmattel can you link the relevant paragraph?

@mmattel
Copy link
Copy Markdown
Contributor

mmattel commented May 18, 2021

@sonarqubecloud
Copy link
Copy Markdown

Kudos, SonarCloud Quality Gate passed!

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

No Coverage information No Coverage information
No Duplication information No Duplication information

@AlexAndBear
Copy link
Copy Markdown
Author

@VicDeo your opinion is highly required 🚀

Copy link
Copy Markdown
Member

@jvillafanez jvillafanez left a comment

Choose a reason for hiding this comment

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

Good to go for the short term

@AlexAndBear AlexAndBear merged commit 300971c into master May 21, 2021
@delete-merged-branch delete-merged-branch bot deleted the enterprise/issues/3467 branch May 21, 2021 07:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants