mirror of
https://github.com/humhub/humhub.git
synced 2025-01-17 06:08:21 +01:00
Allow to add a space as default for new users from "Invite members" modal window (#7280)
This commit is contained in:
parent
e10bd87a12
commit
f80a75f0ff
@ -1,6 +1,10 @@
|
|||||||
HumHub Changelog
|
HumHub Changelog
|
||||||
================
|
================
|
||||||
|
|
||||||
|
1.17.0-beta.2 (Unreleased)
|
||||||
|
--------------------------------
|
||||||
|
- Enh #7280: Allow to add a space as default for new users from "Invite members" modal window
|
||||||
|
|
||||||
1.17.0-beta.1 (October 28, 2024)
|
1.17.0-beta.1 (October 28, 2024)
|
||||||
--------------------------------
|
--------------------------------
|
||||||
- Enh #7070: Add GitHub action for PHP CS Fixer
|
- Enh #7070: Add GitHub action for PHP CS Fixer
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
namespace humhub\modules\space\models\forms;
|
namespace humhub\modules\space\models\forms;
|
||||||
|
|
||||||
use humhub\libs\UUID;
|
|
||||||
use humhub\modules\admin\permissions\ManageUsers;
|
use humhub\modules\admin\permissions\ManageUsers;
|
||||||
use humhub\modules\space\jobs\AddUsersToSpaceJob;
|
use humhub\modules\space\jobs\AddUsersToSpaceJob;
|
||||||
use humhub\modules\space\models\Membership;
|
use humhub\modules\space\models\Membership;
|
||||||
@ -64,12 +63,22 @@ class InviteForm extends Model
|
|||||||
*/
|
*/
|
||||||
public $withoutInvite = false;
|
public $withoutInvite = false;
|
||||||
public $allRegisteredUsers = false;
|
public $allRegisteredUsers = false;
|
||||||
|
public $addDefaultSpace = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parsed list of E-Mails of field inviteEmails
|
* Parsed list of E-Mails of field inviteEmails
|
||||||
*/
|
*/
|
||||||
protected $_inviteEmails = [];
|
protected $_inviteEmails = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public function init()
|
||||||
|
{
|
||||||
|
parent::init();
|
||||||
|
$this->addDefaultSpace = $this->space->auto_add_new_members;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Declares the validation rules.
|
* Declares the validation rules.
|
||||||
* The rules state that username and password are required,
|
* The rules state that username and password are required,
|
||||||
@ -78,7 +87,7 @@ class InviteForm extends Model
|
|||||||
public function rules()
|
public function rules()
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
[['withoutInvite', 'allRegisteredUsers'], 'boolean'],
|
[['withoutInvite', 'allRegisteredUsers', 'addDefaultSpace'], 'boolean'],
|
||||||
['invite', 'checkInvite'],
|
['invite', 'checkInvite'],
|
||||||
['inviteEmails', 'checkInviteExternal'],
|
['inviteEmails', 'checkInviteExternal'],
|
||||||
];
|
];
|
||||||
@ -92,6 +101,9 @@ class InviteForm extends Model
|
|||||||
return [
|
return [
|
||||||
'invite' => Yii::t('SpaceModule.base', 'Invites'),
|
'invite' => Yii::t('SpaceModule.base', 'Invites'),
|
||||||
'inviteEmails' => Yii::t('SpaceModule.base', 'New user by e-mail (comma separated)'),
|
'inviteEmails' => Yii::t('SpaceModule.base', 'New user by e-mail (comma separated)'),
|
||||||
|
'allRegisteredUsers' => Yii::t('SpaceModule.base', 'Select all registered users'),
|
||||||
|
'withoutInvite' => Yii::t('SpaceModule.base', 'Add users without invitation'),
|
||||||
|
'addDefaultSpace' => Yii::t('SpaceModule.base', 'Add as Default Space for new users'),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -115,6 +127,9 @@ class InviteForm extends Model
|
|||||||
|
|
||||||
$this->inviteExternalByEmail();
|
$this->inviteExternalByEmail();
|
||||||
|
|
||||||
|
$this->space->auto_add_new_members = $this->addDefaultSpace ? 1 : null;
|
||||||
|
$this->space->save();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,14 +7,12 @@
|
|||||||
/* @var $submitAction string */
|
/* @var $submitAction string */
|
||||||
/* @var $model InviteForm */
|
/* @var $model InviteForm */
|
||||||
/* @var $attribute string */
|
/* @var $attribute string */
|
||||||
|
|
||||||
/* @var $searchUrl string */
|
/* @var $searchUrl string */
|
||||||
|
|
||||||
use humhub\modules\space\models\forms\InviteForm;
|
use humhub\modules\space\models\forms\InviteForm;
|
||||||
use humhub\modules\ui\view\components\View;
|
use humhub\modules\ui\view\components\View;
|
||||||
use humhub\modules\user\widgets\UserPickerField;
|
use humhub\modules\user\widgets\UserPickerField;
|
||||||
use humhub\widgets\Button;
|
use humhub\widgets\Button;
|
||||||
use humhub\widgets\ModalButton;
|
|
||||||
use humhub\widgets\ModalDialog;
|
use humhub\widgets\ModalDialog;
|
||||||
use yii\bootstrap\ActiveForm;
|
use yii\bootstrap\ActiveForm;
|
||||||
use humhub\libs\Html;
|
use humhub\libs\Html;
|
||||||
@ -79,26 +77,16 @@ $form = ActiveForm::begin([
|
|||||||
<?= $form->field($model, 'invite')
|
<?= $form->field($model, 'invite')
|
||||||
->widget(UserPickerField::class, ['disabledItems' => [Yii::$app->user->guid], 'url' => $searchUrl, 'focus' => true, 'id' => 'space-invite-user-picker']); ?>
|
->widget(UserPickerField::class, ['disabledItems' => [Yii::$app->user->guid], 'url' => $searchUrl, 'focus' => true, 'id' => 'space-invite-user-picker']); ?>
|
||||||
|
|
||||||
|
<br/>
|
||||||
|
<?= $form->field($model, 'allRegisteredUsers')->checkbox() ?>
|
||||||
|
|
||||||
<?php if ($canAddWithoutInvite) : ?>
|
<?php if ($canAddWithoutInvite) : ?>
|
||||||
<br/>
|
<br/>
|
||||||
<?= $form
|
<?= $form->field($model, 'withoutInvite')->checkbox() ?>
|
||||||
->field($model, 'withoutInvite')
|
|
||||||
->label(Yii::t(
|
|
||||||
'SpaceModule.base',
|
|
||||||
'Add users without invitation'
|
|
||||||
))
|
|
||||||
->checkbox() ?>
|
|
||||||
<br/>
|
|
||||||
|
|
||||||
<?= $form
|
|
||||||
->field($model, 'allRegisteredUsers')
|
|
||||||
->label(Yii::t(
|
|
||||||
'SpaceModule.base',
|
|
||||||
'Select all registered users'
|
|
||||||
))
|
|
||||||
->checkbox() ?>
|
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<br/>
|
||||||
|
<?= $form->field($model, 'addDefaultSpace')->checkbox() ?>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php if ($canInviteByEmail) : ?>
|
<?php if ($canInviteByEmail) : ?>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user