Skip to content
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

Merged
merged 13 commits into from
May 22, 2020
Merged

Feat/plugin auth #3215

merged 13 commits into from
May 22, 2020

Conversation

chenbin92
Copy link
Collaborator

功能: #3169

@chenbin92 chenbin92 changed the base branch from master to release-next May 18, 2020 10:02
@chenbin92 chenbin92 requested review from ClarkXia and imsobear May 19, 2020 03:00
},
auth: {
// 可选的,设置无权限时的展示组件,默认为 null
noAuthFallback: <div>没有权限</div>,
Copy link
Collaborator

Choose a reason for hiding this comment

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

ComponentType | JSXElement 写法最用统一下

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

fallback 类统一这种写法,权限和路由是一样的

// 通过 getInitialData 异步获取权限数据
getInitialData: async () => {
const role = await request('/api/role');
return { role }
Copy link
Collaborator

Choose a reason for hiding this comment

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

return { role, initialStates };

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done


// 可选
// 自定义准入权限,与 role 配置项二选一即可,同时配置优先级则高于 role 配置项
setRole: (role) => { return true; }
Copy link
Collaborator

Choose a reason for hiding this comment

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

实现 hasAuth

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

方案调整,改为 auth 配置

Home.pageConfig = {
// 可选
// 配置准入权限,若不配置则代表所有角色都可以访问
role: ['guest', 'admin'],
Copy link
Collaborator

Choose a reason for hiding this comment

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

roles

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

改为 auth 配置

@ClarkXia ClarkXia merged commit df4e677 into release-next May 22, 2020
@delete-merged-branch delete-merged-branch bot deleted the feat/plugin-auth branch May 22, 2020 05:58
@chenbin92 chenbin92 mentioned this pull request May 25, 2020
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants