-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat/plugin auth #3215
Feat/plugin auth #3215
Conversation
c428b74
to
68ec03a
Compare
examples/basic-auth/src/app.tsx
Outdated
}, | ||
auth: { | ||
// 可选的,设置无权限时的展示组件,默认为 null | ||
noAuthFallback: <div>没有权限</div>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ComponentType | JSXElement 写法最用统一下
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fallback 类统一这种写法,权限和路由是一样的
docs/guide/advance/auth.md
Outdated
// 通过 getInitialData 异步获取权限数据 | ||
getInitialData: async () => { | ||
const role = await request('/api/role'); | ||
return { role } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return { role, initialStates };
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
docs/guide/advance/auth.md
Outdated
|
||
// 可选 | ||
// 自定义准入权限,与 role 配置项二选一即可,同时配置优先级则高于 role 配置项 | ||
setRole: (role) => { return true; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
实现 hasAuth
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
方案调整,改为 auth 配置
docs/guide/advance/auth.md
Outdated
Home.pageConfig = { | ||
// 可选 | ||
// 配置准入权限,若不配置则代表所有角色都可以访问 | ||
role: ['guest', 'admin'], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
roles
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
改为 auth 配置
功能: #3169