-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice stuff!
24d9915
to
21da73a
Compare
/backport to stable20 |
0f4bace
to
e0e032f
Compare
Signed-off-by: Morris Jobke <[email protected]>
Signed-off-by: Morris Jobke <[email protected]>
e0e032f
to
c0a05c0
Compare
Ready for review 🚀 |
There was a problem hiding this 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!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
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.')); | ||
} | ||
|
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this 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.')); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$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.')); |
There was a problem hiding this comment.
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/'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$notification->setLink('https://nextcloud.com/enterprise/order/'); | |
$notification->setLink('https://nextcloud.com/enterprise/'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added to #24516
No description provided.