-
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: moderation of linked accounts (#73)
* feat: moderation of linked accounts * Apply fixes from StyleCI * chore: export components --------- Co-authored-by: StyleCI Bot <[email protected]>
- Loading branch information
1 parent
ddd029f
commit 186b537
Showing
16 changed files
with
173 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,20 @@ | ||
import app from 'flarum/admin/app'; | ||
|
||
import AuthSettingsPage from './components/AuthSettingsPage'; | ||
import ConfigureWithOAuthPage from './components/ConfigureWithOAuthPage'; | ||
import ConfigureWithOAuthButton from './components/ConfigureWithOAuthButton'; | ||
|
||
app.initializers.add('fof/oauth', () => { | ||
app.extensionData.for('fof-oauth').registerPage(AuthSettingsPage); | ||
app.extensionData | ||
.for('fof-oauth') | ||
.registerPage(AuthSettingsPage) | ||
.registerPermission( | ||
{ | ||
icon: 'fas fa-sign-in-alt', | ||
label: app.translator.trans('fof-oauth.admin.permissions.moderate_user_providers'), | ||
permission: 'moderateUserProviders', | ||
}, | ||
'moderate' | ||
); | ||
}); | ||
|
||
export { AuthSettingsPage, ConfigureWithOAuthPage, ConfigureWithOAuthButton }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import LinkStatus from './LinkStatus'; | ||
import LinkedAccounts from './LinkedAccounts'; | ||
import ProviderInfo from './ProviderInfo'; | ||
|
||
export const components = { | ||
ProviderInfo, | ||
LinkStatus, | ||
LinkedAccounts, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of fof/oauth. | ||
* | ||
* Copyright (c) FriendsOfFlarum. | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace FoF\OAuth\Api; | ||
|
||
use Flarum\Api\Serializer\ForumSerializer; | ||
|
||
class AddForumAttributes | ||
{ | ||
public function __invoke(ForumSerializer $serializer, $model, array $attributes): array | ||
{ | ||
if ($serializer->getActor()->isGuest()) { | ||
$attributes['fof-oauth'] = resolve('fof-oauth.providers.forum'); | ||
} else { | ||
$attributes['fofOauthModerate'] = $serializer->getActor()->can('moderateUserProviders'); | ||
} | ||
|
||
return $attributes; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.