Skip to content

Commit

Permalink
Fix error when saving an app with no scopes (Fixes #37)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mosnar committed Aug 13, 2022
1 parent e1070bb commit f870d12
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
### Changed
- Now requires Craft 4 & PHP 8.0.2

## Fixed
- Fixed saving an app with no scopes producing an error

### Removed
- Removed route `oauthclient/authorize/refresh/` use `oauth/authorize/refresh/` instead
- Removed route `oauthclient/authorize/` use `oauth/authorize/` instead
Expand Down
4 changes: 3 additions & 1 deletion src/controllers/AppsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,9 @@ public function actionSave(): ?\yii\web\Response
$appService = Plugin::getInstance()->apps;

$scopes = $request->getBodyParam('scopes');
$scopes = implode(',', ArrayHelper::getColumn($scopes, 'scope'));
if (is_array($scopes)) {
$scopes = implode(',', ArrayHelper::getColumn($scopes, 'scope'));
}

$config = [
'id' => $request->getBodyParam('id'),
Expand Down
2 changes: 1 addition & 1 deletion src/models/App.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class App extends Model
public ?int $id = null;
public ?\DateTime $dateCreated = null;
public ?\DateTime $dateUpdated = null;
public $scopes;
public string $scopes = '';
public ?int $userId = null;
public ?string $provider = null;
public ?string $name = null;
Expand Down

0 comments on commit f870d12

Please sign in to comment.