Skip to content

Commit 8ddb88d

Browse files
committed
updated README.md
1 parent 72fdc94 commit 8ddb88d

File tree

2 files changed

+22
-13
lines changed

2 files changed

+22
-13
lines changed

README.md

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,21 @@ composer update liplum/flarum-sync-profile-core
2525

2626
## How to Use
2727

28-
For flarum administrators, if you're using an authentication extension that uses this extension, you can use the settings popup on the Flarum Admin extensions page to choose which types of attributes you'd like to sync.
28+
## For Flarum Admins
2929

30-
Please note that in order to sync Bios and Masquerade Profile Fields, you need to install and enable the [Friends of Flarum User Bios](https://github.com/FriendsOfFlarum/user-bio) and [Friends of Flarum Masquerade](https://github.com/FriendsOfFlarum/masquerade) extensions.
30+
If you're using an authentication or auth-sync extension based on this extension
31+
you can choose which types of attributes you'd like to sync on the extension settings page.
3132

32-
To use this extension in another authentication extension:
33+
Note that in order to sync Bios and Masquerade Profile Fields, you need to install and enable the corresponding extensions:
3334

34-
1. Install the extension as dev dependency: `composer require liplum/sync-profile-core`.3
35+
- [Friends of Flarum User Bios](https://github.com/FriendsOfFlarum/user-bio)
36+
- [Friends of Flarum Masquerade](https://github.com/FriendsOfFlarum/masquerade)
37+
38+
## For Extension Developers
39+
40+
To develop an authentication or auth-sync extension based on this extension, you should:
41+
42+
1. Install the extension as dev dependency: `composer require liplum/sync-profile-core`.
3543
2. Inject `ExtensionManager $extensions` in your constructor.
3644
3. Import the AuthEventSync model via `use Liplum\SyncProfile\Event\SyncProfileEvent;`
3745
4. Before logging in/registering the user, create an AuthSyncEvent. Ex:
@@ -58,20 +66,21 @@ if ($this->extensions->isEnabled('liplum-sync-profile-core')) {
5866
}
5967
```
6068

61-
- Of course, replace the generic values above with attributes from your Identity Provider's response.
62-
- Attributes should be provided in a json-encoded string (see above example). The JSON string should have the following attributes:
63-
- `avatarUrl`: A URL pointing to an image for the user's avatar. Make sure that the file type is compatible with Flarum (jpeg or png I believe).
64-
- `groups`: A comma-separated list of ids for groups that a user should belong to. Keep in mind that this will both add and remove groups, so make sure that all desired groups are included.
65-
- `bio`: A string that will be synced to the user's bio if [Friends of Flarum User Bios](https://github.com/FriendsOfFlarum/user-bio) is enabled
66-
- `fof-masquerade`: An associative array for any masquerade keys and attributes you want to sync. Make sure that the key matches the name of the profile field exactly.
69+
Replace the generic values above with attributes from your Identity Provider's response.
70+
71+
Attributes should be provided in a json-encoded string (see above example). The JSON string should have the following attributes:
72+
73+
- `nickname`: The display name of a user.
74+
- `avatarUrl`: A URL pointing to an image for the user's avatar. Make sure that the file type is compatible with Flarum (jpeg or png I believe).
75+
- `groups`: A comma-separated list of ids for groups that a user should belong to. Keep in mind that this will both add and remove groups, so make sure that all desired groups are included.
76+
- `bio`: A string that will be synced to the user's bio if [Friends of Flarum User Bios](https://github.com/FriendsOfFlarum/user-bio) is enabled
77+
- `fof-masquerade`: An associative array for any masquerade keys and attributes you want to sync. Make sure that the key matches the name of the profile field exactly.
6778

6879
### TODO
6980

7081
- Add better validation and error handling.
7182
- Add a setting to support default groups that all users should be added to, and groups that users should never be synced to.
72-
- Add an expiry setting for Auth Sync Events.
7383
- Add support for getting users via LoginProvider providers and identifiers, in addition to email.
74-
- Due to a bug in flarum core, the `LoggedIn` event isn't dispatched when logging in via an external identity provider. Until this is fixed, the UserUpdatedListener listens to `Serialize` events (except those going to masquerade). This workaround will be promptly removed when the upstream bug is fixed.
7584

7685
## Acknowledgement
7786

resources/locale/en.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ liplum-sync-profile-core:
77
help: >
88
Block users from changing their profile on Flarum.
99
Working properly with extensions like "FoF User Bio".
10-
Not working with extensions which not respect "editable" attribute on user,
10+
Not working with extensions which not respect "editable" attributes on user,
1111
like "Profile Cover", "User Badges".
1212
sync-avatar:
1313
label: Sync Avatar

0 commit comments

Comments
 (0)