Skip to content

Commit

Permalink
Improved Invitation (#5473)
Browse files Browse the repository at this point in the history
  • Loading branch information
yurabakhtin committed Dec 16, 2021
1 parent 8958bd5 commit 46004a8
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 23 deletions.
36 changes: 18 additions & 18 deletions .github/workflows/php-test.yml
Expand Up @@ -47,20 +47,20 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1

- name: Setup cache environment
id: cache-env
uses: shivammathur/cache-extensions@v1
with:
php-version: ${{ matrix.php-version }}
extensions: ${{ env.extensions }}
key: ${{ env.key }}

- name: Cache extensions
uses: actions/cache@v1
with:
path: ${{ steps.cache-env.outputs.dir }}
key: ${{ steps.cache-env.outputs.key }}
restore-keys: ${{ steps.cache-env.outputs.key }}
# - name: Setup cache environment
# id: cache-env
# uses: shivammathur/cache-extensions@v1
# with:
# php-version: ${{ matrix.php-version }}
# extensions: ${{ env.extensions }}
# key: ${{ env.key }}

# - name: Cache extensions
# uses: actions/cache@v1
# with:
# path: ${{ steps.cache-env.outputs.dir }}
# key: ${{ steps.cache-env.outputs.key }}
# restore-keys: ${{ steps.cache-env.outputs.key }}

- name: Install PHP with extensions
uses: shivammathur/setup-php@v2
Expand All @@ -87,10 +87,10 @@ jobs:
- name: Install dependencies with composer
run: composer update --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi

- name: Verify MySQL connection from host
run: |
sudo apt-get update && sudo apt-get install -y mysql-client
mysql --host 127.0.0.1 --port ${{ job.services.mysql.ports['3306'] }} -uroot -proot -e "SHOW DATABASES"
# - name: Verify MySQL connection from host
# run: |
# sudo apt-get update && sudo apt-get install -y mysql-client-8.0 mysql-common
# mysql --host 127.0.0.1 --port ${{ job.services.mysql.ports['3306'] }} -uroot -proot -e "SHOW DATABASES"

- name: Install npm dependencies
run: npm install
Expand Down
12 changes: 7 additions & 5 deletions protected/humhub/modules/space/controllers/CreateController.php
Expand Up @@ -8,16 +8,14 @@

namespace humhub\modules\space\controllers;

use Colors\RandomColor;
use humhub\components\Controller;
use humhub\components\behaviors\AccessControl;
use humhub\models\Setting;
use humhub\modules\content\components\ContentContainerModule;
use humhub\modules\content\components\ContentContainerModuleManager;
use humhub\modules\space\models\forms\InviteForm;
use humhub\modules\space\models\Space;
use humhub\modules\space\permissions\CreatePrivateSpace;
use humhub\modules\space\permissions\CreatePublicSpace;
use humhub\modules\space\models\forms\InviteForm;
use Colors\RandomColor;
use humhub\modules\space\permissions\InviteUsers;
use humhub\modules\user\helpers\AuthHelper;
use Yii;
use yii\base\Exception;
Expand Down Expand Up @@ -159,6 +157,10 @@ public function actionInvite($space = null, $spaceId = null)
throw new HttpException(404);
}

if (!$space->can(InviteUsers::class)) {
throw new HttpException(400, 'You are not allowed to invite users to the space!');
}

$model = new InviteForm(['space' => $space]);

if ($model->load(Yii::$app->request->post()) && $model->save()) {
Expand Down

0 comments on commit 46004a8

Please sign in to comment.