Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
A
admin-fe
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Pleroma
admin-fe
Commits
9fbb0281
Commit
9fbb0281
authored
6 years ago
by
Pan
Browse files
Options
Downloads
Patches
Plain Diff
perf[permission]: add the verification of roles
parent
9b5f0160
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/permission.js
+3
-3
3 additions, 3 deletions
src/permission.js
src/store/modules/user.js
+7
-1
7 additions, 1 deletion
src/store/modules/user.js
with
10 additions
and
4 deletions
src/permission.js
+
3
−
3
View file @
9fbb0281
...
@@ -31,10 +31,10 @@ router.beforeEach((to, from, next) => {
...
@@ -31,10 +31,10 @@ router.beforeEach((to, from, next) => {
router
.
addRoutes
(
store
.
getters
.
addRouters
)
// 动态添加可访问路由表
router
.
addRoutes
(
store
.
getters
.
addRouters
)
// 动态添加可访问路由表
next
({
...
to
,
replace
:
true
})
// hack方法 确保addRoutes已完成 ,set the replace: true so the navigation will not leave a history record
next
({
...
to
,
replace
:
true
})
// hack方法 确保addRoutes已完成 ,set the replace: true so the navigation will not leave a history record
})
})
}).
catch
(()
=>
{
}).
catch
((
err
)
=>
{
store
.
dispatch
(
'
FedLogOut
'
).
then
(()
=>
{
store
.
dispatch
(
'
FedLogOut
'
).
then
(()
=>
{
Message
.
error
(
'
Verification failed, please login again
'
)
Message
.
error
(
err
||
'
Verification failed, please login again
'
)
next
({
path
:
'
/
login
'
})
next
({
path
:
'
/
'
})
})
})
})
})
}
else
{
}
else
{
...
...
This diff is collapsed.
Click to expand it.
src/store/modules/user.js
+
7
−
1
View file @
9fbb0281
...
@@ -67,7 +67,13 @@ const user = {
...
@@ -67,7 +67,13 @@ const user = {
reject
(
'
error
'
)
reject
(
'
error
'
)
}
}
const
data
=
response
.
data
const
data
=
response
.
data
commit
(
'
SET_ROLES
'
,
data
.
roles
)
if
(
data
.
roles
&&
data
.
roles
.
length
>
0
)
{
// 验证返回的roles是否是一个非空数组
commit
(
'
SET_ROLES
'
,
data
.
roles
)
}
else
{
reject
(
'
getInfo: roles must be a non-null array !
'
)
}
commit
(
'
SET_NAME
'
,
data
.
name
)
commit
(
'
SET_NAME
'
,
data
.
name
)
commit
(
'
SET_AVATAR
'
,
data
.
avatar
)
commit
(
'
SET_AVATAR
'
,
data
.
avatar
)
commit
(
'
SET_INTRODUCTION
'
,
data
.
introduction
)
commit
(
'
SET_INTRODUCTION
'
,
data
.
introduction
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment