Make "Invite new people" always possible for Admins (#6966)

This commit is contained in:
Yuriy Bakhtin 2024-04-24 17:34:54 +02:00 committed by GitHub
parent 93db54ff0d
commit 2329da4c7d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 9 additions and 4 deletions

View File

@ -7,6 +7,7 @@ HumHub Changelog
- Fix #6913: Fix API tests
- Fix #6919: Fix saving of user profile country field value and enable a searching by country title
- Fix #6919: Migration to revert user profile country names to Iso 3166 codes
- Fix #6966: Make "Invite new people" always possible for Admins
1.15.4 (March 20, 2024)
-----------------------

View File

@ -20,6 +20,7 @@ use humhub\modules\admin\models\UserSearch;
use humhub\modules\admin\permissions\ManageGroups;
use humhub\modules\admin\permissions\ManageSettings;
use humhub\modules\admin\permissions\ManageUsers;
use humhub\modules\user\models\forms\Invite as InviteForm;
use humhub\modules\user\models\forms\Registration;
use humhub\modules\user\models\Invite;
use humhub\modules\user\models\Profile;
@ -262,11 +263,14 @@ class UserController extends Controller
return $this->redirect(['edit', 'id' => $registration->getUser()->id]);
}
$adminIsAlwaysAllowed = Yii::$app->user->isAdmin();
$invite = new InviteForm();
return $this->render('add', [
'hForm' => $registration,
'canInviteByEmail' => Yii::$app->getModule('user')->settings->get('auth.internalUsersCanInviteByEmail'),
'canInviteByLink' => Yii::$app->getModule('user')->settings->get('auth.internalUsersCanInviteByLink'),
'adminIsAlwaysAllowed' => false,
'canInviteByEmail' => $invite->canInviteByEmail($adminIsAlwaysAllowed),
'canInviteByLink' => $invite->canInviteByLink($adminIsAlwaysAllowed),
'adminIsAlwaysAllowed' => $adminIsAlwaysAllowed,
]);
}

View File

@ -49,7 +49,7 @@ use yii\bootstrap\ActiveForm;
<?php $form = ActiveForm::begin(); ?>
<?= $form->field($model, 'emails')->textarea(['rows' => '3', 'placeholder' => Yii::t('UserModule.invite', 'Email address(es)'), 'id' => 'emails'])->label(false)->hint(Yii::t('UserModule.invite', 'Separate multiple email addresses by comma.')); ?>
<a href="#" class="btn btn-primary" data-action-click="ui.modal.submit"
data-action-url="<?= Url::to(['/user/invite']) ?>" data-ui-loader>
data-action-url="<?= Url::to(['/user/invite', 'adminIsAlwaysAllowed' => $adminIsAlwaysAllowed]) ?>" data-ui-loader>
<?= Yii::t('UserModule.invite', 'Send invite') ?>
</a>
<?php ActiveForm::end(); ?>