Skip to content

Commit

Permalink
Merge pull request #41 from humhub-contrib/enh/php-cs-fixer
Browse files Browse the repository at this point in the history
Use PHP CS Fixer
  • Loading branch information
luke- authored Oct 3, 2024
2 parents bb86f6e + b470cdc commit 6cc1d0a
Show file tree
Hide file tree
Showing 13 changed files with 84 additions and 82 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/php-cs-fixer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
name: PHP CS Fixer

on: push

jobs:
fixers:
uses: humhub/actions/.github/workflows/module-php-cs-fixer.yml@main
1 change: 0 additions & 1 deletion Events.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

class Events
{

public static function onTopMenuInit($event)
{
if (Yii::$app->user->isGuest || !Yii::$app->user->can(CanAccess::class)) {
Expand Down
3 changes: 1 addition & 2 deletions Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace humhubContrib\modules\jitsiMeet;


use humhubContrib\modules\jitsiMeet\models\SettingsForm;
use yii\helpers\Url;

Expand Down Expand Up @@ -39,7 +38,7 @@ public function getConfigUrl()
public function getPermissions($contentContainer = null)
{
return [
new permissions\CanAccess()
new permissions\CanAccess(),
];
}

Expand Down
9 changes: 4 additions & 5 deletions assets/Assets.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,12 @@

class Assets extends AssetBundle
{

public $publishOptions = [
'forceCopy' => true
'forceCopy' => true,
];

public $jsOptions = [
'position' => View::POS_BEGIN
'position' => View::POS_BEGIN,
];

public function init()
Expand All @@ -32,9 +31,9 @@ private function initJitsiApiJs()
if ($module instanceof Module) {
$this->js = [
'https://' . $module->getSettingsForm()->jitsiDomain . '/external_api.js',
'humhub.jitsiMeet.js'
'humhub.jitsiMeet.js',
];
}
}

}
}
5 changes: 2 additions & 3 deletions config.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
['class' => TopMenu::class, 'event' => TopMenu::EVENT_INIT, 'callback' => ['humhubContrib\modules\jitsiMeet\Events', 'onTopMenuInit']],
],
'urlManagerRules' => [
'/conference/<name>' => 'jitsi-meet/room/open'
]
'/conference/<name>' => 'jitsi-meet/room/open',
],
];
?>
3 changes: 0 additions & 3 deletions controllers/ConfigController.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
*/
class ConfigController extends \humhub\modules\admin\components\Controller
{

public function actionIndex()
{
$form = $this->module->getSettingsForm();
Expand All @@ -22,5 +21,3 @@ public function actionIndex()
return $this->render('index', ['model' => $form]);
}
}

?>
6 changes: 3 additions & 3 deletions controllers/RoomController.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class RoomController extends Controller
protected function getAccessRules()
{
return [
['permissions' => [CanAccess::class], 'actions' => ['index']]
['permissions' => [CanAccess::class], 'actions' => ['index']],
];
}

Expand All @@ -33,7 +33,7 @@ public function actionIndex()

return $this->render('index', [
'model' => $model,
'jitsiDomain' => $this->module->getSettingsForm()->jitsiDomain
'jitsiDomain' => $this->module->getSettingsForm()->jitsiDomain,
]);
}

Expand Down Expand Up @@ -107,7 +107,7 @@ public function actionModal()

return $this->renderAjax('modal', [
'jwt' => $jwt,
'name' => $name
'name' => $name,
]);

}
Expand Down
4 changes: 4 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
Changelog
=========

1.1.10 (Unreleased)
----------------------
- Enh #41: Use PHP CS Fixer

1.1.9 (April 16, 2024)
----------------------
- Fix #38: Fix missing room prefix in JWT token
Expand Down
14 changes: 7 additions & 7 deletions models/JoinRoomForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

class JoinRoomForm extends \yii\base\Model
{

public $room;
public $newWindow;

Expand All @@ -27,10 +26,11 @@ public function attributeLabels()
];
}

/**
* WIP!
*/
public function getJwt() {
/**
* WIP!
*/
public function getJwt()
{
$key = "my_jitsi_app_secret2";
$payload = [
"iss" => "my_web_client",
Expand All @@ -44,10 +44,10 @@ public function getJwt() {
'email' => '[email protected]',
// 'id' => 'asd'
],
]
],
];

$jwt = JWT::encode($payload, $key, 'HS256');

}
}
}
5 changes: 2 additions & 3 deletions models/SettingsForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

class SettingsForm extends Model
{

public $jitsiDomain;
public $menuTitle;
public $roomPrefix;
Expand All @@ -25,11 +24,11 @@ public function rules()
['jitsiDomain', 'string'],
[['menuTitle', 'jitsiAppID', 'jitsiAppSecret', 'roomPrefix'], 'string'],
['enableJwt', 'boolean'],
[['jitsiAppID', 'jitsiAppSecret'], 'required', 'when' => function($model) {
[['jitsiAppID', 'jitsiAppSecret'], 'required', 'when' => function ($model) {
return $model->enableJwt;
}, 'whenClient' => "function (attribute, value) {
return $('#settingsform-enablejwt').is(':checked');
}"]
}"],
];
}

Expand Down
2 changes: 1 addition & 1 deletion module.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"conference",
"jitsi"
],
"version": "1.1.9",
"version": "1.1.10",
"humhub": {
"minVersion": "1.7"
},
Expand Down
105 changes: 52 additions & 53 deletions permissions/CanAccess.php
Original file line number Diff line number Diff line change
@@ -1,53 +1,52 @@
<?php
/**
* @link https://www.humhub.org/
* @copyright Copyright (c) HumHub GmbH & Co. KG
* @license https://www.humhub.com/licences
*/

namespace humhubContrib\modules\jitsiMeet\permissions;

use humhub\libs\BasePermission;
use humhub\modules\user\models\Group;
use Yii;

class CanAccess extends BasePermission
{

/**
* @inheritdoc
*/
public $defaultAllowedGroups = [];

/**
* @inheritdoc
*/
protected $fixedGroups = [];

/**
* @inheritdoc
*/
protected $defaultState = self::STATE_ALLOW;

/**
* @inheritdoc
*/
protected $moduleId = 'jitsi-meet';

/**
* @inheritdoc
*/
public function getTitle()
{
return Yii::t('JitsiMeetModule.base', 'Can access Jitsi Meet');
}

/**
* @inheritdoc
*/
public function getDescription()
{
return Yii::t('JitsiMeetModule.base', 'Can access Jitsi Meet from main navigation.');
}

}
<?php
/**
* @link https://www.humhub.org/
* @copyright Copyright (c) HumHub GmbH & Co. KG
* @license https://www.humhub.com/licences
*/

namespace humhubContrib\modules\jitsiMeet\permissions;

use humhub\libs\BasePermission;
use humhub\modules\user\models\Group;
use Yii;

class CanAccess extends BasePermission
{
/**
* @inheritdoc
*/
public $defaultAllowedGroups = [];

/**
* @inheritdoc
*/
protected $fixedGroups = [];

/**
* @inheritdoc
*/
protected $defaultState = self::STATE_ALLOW;

/**
* @inheritdoc
*/
protected $moduleId = 'jitsi-meet';

/**
* @inheritdoc
*/
public function getTitle()
{
return Yii::t('JitsiMeetModule.base', 'Can access Jitsi Meet');
}

/**
* @inheritdoc
*/
public function getDescription()
{
return Yii::t('JitsiMeetModule.base', 'Can access Jitsi Meet from main navigation.');
}

}
2 changes: 1 addition & 1 deletion widgets/RoomWidget.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public function getData()
'roomPrefix' => $module->getSettingsForm()->roomPrefix,
'jitsiDomain' => $module->getSettingsForm()->jitsiDomain,
'usermail' => $email,
'userdisplayname' => $name
'userdisplayname' => $name,
];
}

Expand Down

0 comments on commit 6cc1d0a

Please sign in to comment.