Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix: implement admin permissions#429

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
vincentchalamon wants to merge3 commits into4.0
base:4.0
Choose a base branch
Loading
fromfix/admin-permissions

Conversation

@vincentchalamon
Copy link
Contributor

@vincentchalamonvincentchalamon commentedJul 12, 2024
edited
Loading

Fixes#427

constAdminWithOIDC=()=>{
// Can't use next-auth/middleware because of https://github.com/nextauthjs/next-auth/discussions/7488
const{data:session, status}=useSession();
const{ permissions}=usePermissions();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

usePermissions can only be called by children of react-admin's<Admin> component (otherwise there is no AuthProviderContext and QueryClientContext available). That's why you have an error.

The proper fix would be to call theusePermissions inBookList and other admin-only components, and redirect to a/forbidden CustomRoute if the permissions don't match.

@vincentchalamonvincentchalamon changed the base branch frommain to3.3September 15, 2024 18:06
@vincentchalamonvincentchalamon changed the base branch from3.3 to4.0September 19, 2024 09:41
@vincentchalamonvincentchalamon marked this pull request as ready for reviewOctober 1, 2024 13:01
@vincentchalamonvincentchalamon marked this pull request as draftOctober 1, 2024 13:02
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

1 more reviewer

@fzaninottofzaninottofzaninotto left review comments

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Admin authentication problems

3 participants

@vincentchalamon@fzaninotto

[8]ページ先頭

©2009-2025 Movatter.jp