Skip to content

Commit

Permalink
Merge pull request #5493 from marmelab/update-auth-provider-doc
Browse files Browse the repository at this point in the history
[Doc] Improve Auth Provider chapter
  • Loading branch information
djhi committed Nov 6, 2020
2 parents 578ea5a + fcc8c2a commit 3e44ce5
Show file tree
Hide file tree
Showing 7 changed files with 742 additions and 436 deletions.
4 changes: 2 additions & 2 deletions docs/Admin.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ const App = () => (
);
```

The [Authentication documentation](./Authentication.md) explains how to implement these functions in detail.
The [Auth Provider documentation](./Authentication.md) explains how to implement these functions in detail.

## `i18nProvider`

Expand Down Expand Up @@ -585,7 +585,7 @@ You might want to dynamically define the resources when the app starts. To do so

### Using a Function As `<Admin>` Child

The `<Admin>` component accepts a function as its child and this function can return a Promise. If you also defined an `authProvider`, the child function will receive the result of a call to `authProvider.getPermissions()` (you can read more about this in the [Authorization](./Authorization.md) chapter).
The `<Admin>` component accepts a function as its child and this function can return a Promise. If you also defined an `authProvider`, the child function will receive the result of a call to `authProvider.getPermissions()` (you can read more about this in the [Auth Provider](./Authentication.md#authorization) chapter).

For instance, getting the resource from an API might look like:

Expand Down
891 changes: 729 additions & 162 deletions docs/Authentication.md

Large diffs are not rendered by default.

257 changes: 0 additions & 257 deletions docs/Authorization.md

This file was deleted.

6 changes: 1 addition & 5 deletions docs/Ecosystem.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,7 @@ See the [Translation](./Translation.md#available-locales) page.

## Authentication Providers

- **[AWS Amplify](https://docs.amplify.aws)**: [MrHertal/react-admin-amplify](https://github.com/MrHertal/react-admin-amplify)
- **[AWS Cognito](https://docs.aws.amazon.com/cognito/latest/developerguide/setting-up-the-javascript-sdk.html)**: [thedistance/ra-cognito](https://github.com/thedistance/ra-cognito)
- **[Firebase Auth (Google, Facebook, Github etc)](https://firebase.google.com/docs/auth/web/firebaseui)**: [benwinding/react-admin-firebase](https://github.com/benwinding/react-admin-firebase#auth-provider)

## Authorization Management
See the [Auth Provider](./Authentication.md#available-providers) page. Here is a list of additional packages:

- **[Access Control List (ACL) for Resources](https://github.com/marmelab/ra-auth-acl)**: [marmelab/ra-auth-acl](https://github.com/marmelab/ra-auth-acl)

Expand Down
11 changes: 6 additions & 5 deletions docs/Reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,13 +148,14 @@ title: "Reference"
* [`useDeleteMany`](./Actions.md#usedeletemany)
* [`useEditController`](./CreateEdit.md#useeditcontroller)
* `useFilterState`
* [`useGetIdentity`](./Authentication.md#usegetidentity-hook)
* [`useGetList`](./Actions.md#usegetlist)
* [`useGetMany`](./Actions.md#usegetmany)
* [`useGetManyReference`](./Actions.md#usegetmanyreference)
* `useGetMatching`
* `useGetMatchingReferences`
* [`useGetOne`](./Actions.md#usegetone)
* `useGetPermissions`
* [`useGetPermissions`](./Authentication.md#usegetpermissions-hook)
* [`useHasLock`](https://marmelab.com/ra-enterprise/modules/ra-realtime#locks-on-content)<img class="icon" src="./img/premium.svg" />
* [`useHasLocks`](https://marmelab.com/ra-enterprise/modules/ra-realtime#locks-on-content)<img class="icon" src="./img/premium.svg" />
* `useInput`
Expand All @@ -163,14 +164,14 @@ title: "Reference"
* `useLoading`
* [`useLocale`](./Translation.md#uselocale-getting-the-current-locale)
* [`useLock`](https://marmelab.com/ra-enterprise/modules/ra-realtime#locks-on-content)<img class="icon" src="./img/premium.svg" />
* [`useLogin`](./Authentication.md#customizing-the-login-and-logout-components)
* [`useLogout`](./Authentication.md#customizing-the-login-and-logout-components)
* [`useLogin`](./Authentication.md#uselogin-hook)
* [`useLogout`](./Authentication.md#uselogout-hook)
* `useLogoutIfAccessDenied`
* [`useMediaQuery`](./Theming.md#usemediaquery-hook)
* [`useMutation`](./Actions.md#usemutation-hook)
* [`useNotify`](./Actions.md#handling-side-effects-in-usedataprovider)
* `usePaginationState`
* [`usePermissions`](./Authorization.md#usepermissions-hook)
* [`usePermissions`](./Authentication.md#usepermissions-hook)
* [`usePreferences`](https://marmelab.com/ra-enterprise/modules/ra-preferences#usepreferences-reading-and-writing-user-preferences)<img class="icon" src="./img/premium.svg" />
* [`useQuery`](./Actions.md#usequery-hook)
* [`useQueryWithStore`](./Actions.md#usequerywithstore-hook)
Expand All @@ -197,6 +198,6 @@ title: "Reference"
* `useVersion`
* [`withDataProvider`](./Actions.md#legacy-components-query-mutation-and-withdataprovider)
* [`withTranslate`](./Translation.md#withtranslate-hoc)
* [`<WithPermissions>`](./Authorization.md#usepermissions-hook)
* [`<WithPermissions>`](./Authentication.md#usepermissions-hook)

</div>
2 changes: 1 addition & 1 deletion docs/UnitTesting.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ it('should send the user to another url', () => {

## Testing Permissions

As explained on the [Authorization page](./Authorization.md), it's possible to manage permissions via the authentication provider in order to filter page and fields the users can see.
As explained on the [Auth Provider chapter](./Authentication.md#authorization), it's possible to manage permissions via the `authProvider` in order to filter page and fields the users can see.

In order to avoid regressions and make the design explicit to your co-workers, it's better to unit test which fields are supposed to be displayed or hidden for each permission.

Expand Down
7 changes: 3 additions & 4 deletions docs/navigation.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@
<li {% if page.path contains 'Tutorial.md' %} class="active" {% endif %}><a href="./Tutorial.html">Tutorial</a></li>

<ul><div>App Configuration</div>
<li {% if page.path contains 'DataProviders.md' %} class="active" {% endif %}><a href="./DataProviders.html">Data Providers</a></li>
<li {% if page.path contains 'Admin.md' %} class="active" {% endif %}><a href="./Admin.html"><code>&lt;Admin&gt;</code></a></li>
<li {% if page.path contains 'Resource.md' %} class="active" {% endif %}><a href="./Resource.html"><code>&lt;Resource&gt;</code></a></li>
<li {% if page.path contains 'Authentication.md' %} class="active" {% endif %}><a href="./Authentication.html">Authentication</a></li>
<li {% if page.path contains 'Authorization.md' %} class="active" {% endif %}><a href="./Authorization.html">Authorization</a></li>
<li {% if page.path contains 'DataProviders.md' %} class="active" {% endif %}><a href="./DataProviders.html">Data Providers</a></li>
<li {% if page.path contains 'Authentication.md' %} class="active" {% endif %}><a href="./Authentication.html">Auth Providers</a></li>
<li {% if page.path contains 'Translation.md' %} class="active" {% endif %}><a href="./Translation.html">Translation & i18n</a></li>
<li {% if page.path contains 'Resource.md' %} class="active" {% endif %}><a href="./Resource.html"><code>&lt;Resource&gt;</code></a></li>
</ul>

<ul><div>View Configuration</div>
Expand Down

0 comments on commit 3e44ce5

Please sign in to comment.