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

Allow subscription to indicate that a userlimit is reached #23278

Merged
merged 2 commits into from
Dec 2, 2020

Conversation

MorrisJobke
Copy link
Member

@MorrisJobke MorrisJobke commented Oct 8, 2020

No description provided.

Copy link
Member

@rullzer rullzer left a comment

Choose a reason for hiding this comment

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

Nice stuff!

@skjnldsv skjnldsv added the 2. developing Work in progress label Oct 31, 2020
@MorrisJobke MorrisJobke force-pushed the enh/noid/user-limits branch 2 times, most recently from 24d9915 to 21da73a Compare December 2, 2020 08:45
@MorrisJobke MorrisJobke marked this pull request as ready for review December 2, 2020 08:45
@MorrisJobke MorrisJobke added 3. to review Waiting for reviews and removed 2. developing Work in progress labels Dec 2, 2020
@MorrisJobke
Copy link
Member Author

/backport to stable20

@MorrisJobke
Copy link
Member Author

Ready for review 🚀

Copy link
Member

@rullzer rullzer left a comment

Choose a reason for hiding this comment

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

Looks good! Didn't test in depth but a quick smoke test showed it OK. And the test seems sane!

Copy link
Member

@ChristophWurst ChristophWurst left a comment

Choose a reason for hiding this comment

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

Looks good!

Comment on lines 301 to +307
public function createUser($uid, $password) {
// DI injection is not used here as IRegistry needs the user manager itself for user count and thus it would create a cyclic dependency
if (\OC::$server->get(IRegistry::class)->delegateIsHardUserLimitReached()) {
$l = \OC::$server->getL10N('lib');
throw new HintException($l->t('The user limit has been reached and the user was not created.'));
}

Copy link
Member

Choose a reason for hiding this comment

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

heads up, this will not catch users provisioned by other backends

Copy link
Member

Choose a reason for hiding this comment

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

Yes we know
will come in follup PRs

Copy link
Member

@jospoortvliet jospoortvliet left a comment

Choose a reason for hiding this comment

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

Looks good, just these changes would be nice 👍

@@ -73,6 +74,13 @@ public function prepare(INotification $notification, string $languageCode): INot
return $notification;
}

if ($notification->getSubject() === 'user_limit_reached') {
$notification->setParsedSubject($l->t('The user limit of this instance is reached.'));
$notification->setParsedMessage($l->t('Add a subscription key to increase the user limit of this instance. For more information have a look at the Enterprise subscription page.'));
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
$notification->setParsedMessage($l->t('Add a subscription key to increase the user limit of this instance. For more information have a look at the Enterprise subscription page.'));
$notification->setParsedMessage($l->t('Enter your subscription key to increase the user limit. For more information about Nextcloud Enterprise see our website.'));

Copy link
Member Author

Choose a reason for hiding this comment

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

Added to #24516

if ($notification->getSubject() === 'user_limit_reached') {
$notification->setParsedSubject($l->t('The user limit of this instance is reached.'));
$notification->setParsedMessage($l->t('Add a subscription key to increase the user limit of this instance. For more information have a look at the Enterprise subscription page.'));
$notification->setLink('https://nextcloud.com/enterprise/order/');
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
$notification->setLink('https://nextcloud.com/enterprise/order/');
$notification->setLink('https://nextcloud.com/enterprise/');

Copy link
Member Author

Choose a reason for hiding this comment

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

Added to #24516

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review Waiting for reviews enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants