Skip to content

Commit

Permalink
fix: Fix permission extend
Browse files Browse the repository at this point in the history
Signed-off-by: leoliu <leoliu@yunify.com>
  • Loading branch information
leoliu committed Jul 23, 2020
1 parent 64cd31a commit eb47d19
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 21 deletions.
40 changes: 20 additions & 20 deletions src/core/global.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,14 @@ export default class GlobalValue {
`projectRules[${cluster}][${project}]._`,
this.getActions({ cluster, module })
)
return adapter(
get(
return adapter([
...get(
globals.user,
`projectRules[${cluster}][${project}][${module}]`,
defaultActions
)
)
[]
),
...defaultActions,
])
}

if (devops) {
Expand All @@ -66,13 +67,14 @@ export default class GlobalValue {
`devopsRules[${cluster}][${devops}]._`,
[]
)
return adapter(
get(
return adapter([
...get(
globals.user,
`devopsRules[${cluster}][${devops}][${module}]`,
defaultActions
)
)
[]
),
...defaultActions,
])
}

if (workspace) {
Expand All @@ -81,20 +83,18 @@ export default class GlobalValue {
`workspaceRules[${workspace}]._`,
[]
)
return adapter(
get(
globals.user,
`workspaceRules[${workspace}][${module}]`,
defaultActions
)
)
return adapter([
...get(globals.user, `workspaceRules[${workspace}][${module}]`, []),
...defaultActions,
])
}

if (cluster) {
const defaultActions = get(globals.user, `clusterRules[${cluster}]._`, [])
return adapter(
get(globals.user, `clusterRules[${cluster}][${module}]`, defaultActions)
)
return adapter([
...get(globals.user, `clusterRules[${cluster}][${module}]`, []),
...defaultActions,
])
}

return adapter(get(globals.user, `globalRules[${module}]`, []))
Expand Down
7 changes: 6 additions & 1 deletion src/pages/projects/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ class ProjectLayout extends Component {
}

componentDidUpdate(prevProps) {
if (this.project !== prevProps.match.params.namespace) {
const { namespace, cluster } = prevProps.match.params
if (this.project !== namespace || this.cluster !== cluster) {
this.init(this.props.match.params)
}
}
Expand Down Expand Up @@ -82,6 +83,10 @@ class ProjectLayout extends Component {
return this.props.match.params.namespace
}

get cluster() {
return this.props.match.params.cluster
}

render() {
const { initializing } = this.store

Expand Down

0 comments on commit eb47d19

Please sign in to comment.