mirror of
https://github.com/roleypoly/roleypoly-v1.git
synced 2025-04-25 12:19:10 +00:00
fix(UI): fix edit roles permissions leakage
This commit is contained in:
parent
ae0a89e3ff
commit
1debaaa3df
2 changed files with 10 additions and 2 deletions
|
@ -2,7 +2,7 @@ import React, { Component } from 'react'
|
||||||
import { Set } from 'immutable'
|
import { Set } from 'immutable'
|
||||||
import { connect } from 'react-redux'
|
import { connect } from 'react-redux'
|
||||||
import { DropTarget } from 'react-dnd'
|
import { DropTarget } from 'react-dnd'
|
||||||
import { Link, Prompt } from 'react-router-dom'
|
import { Link, Prompt, Redirect } from 'react-router-dom'
|
||||||
import { Scrollbars } from 'react-custom-scrollbars'
|
import { Scrollbars } from 'react-custom-scrollbars'
|
||||||
import * as Actions from './actions'
|
import * as Actions from './actions'
|
||||||
import * as PickerActions from '../role-picker/actions'
|
import * as PickerActions from '../role-picker/actions'
|
||||||
|
@ -112,6 +112,11 @@ class RoleEditor extends Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
render () {
|
render () {
|
||||||
|
const { server } = this.props
|
||||||
|
if (server.getIn(['server', 'perms', 'canManageRoles']) !== true) {
|
||||||
|
return <Redirect to={`/s/${server.get('id')}`} />
|
||||||
|
}
|
||||||
|
|
||||||
const vm = this.props.editor.get('viewMap')
|
const vm = this.props.editor.get('viewMap')
|
||||||
return <div className="inner role-editor">
|
return <div className="inner role-editor">
|
||||||
<Prompt when={this.hasChanged} message="Are you sure you want to leave? You have unsaved changes that will be lost." />
|
<Prompt when={this.hasChanged} message="Are you sure you want to leave? You have unsaved changes that will be lost." />
|
||||||
|
|
|
@ -117,7 +117,10 @@ class RolePicker extends Component {
|
||||||
<section>
|
<section>
|
||||||
<div className="role-picker__header">
|
<div className="role-picker__header">
|
||||||
<h3>Roles</h3>
|
<h3>Roles</h3>
|
||||||
<Link to={`/s/${server.get('id')}/edit`} uk-tooltip='' title='Edit Categories' uk-icon="icon: file-edit"></Link>
|
{ server.getIn(['perms', 'canManageRoles']) === true
|
||||||
|
? <Link to={`/s/${server.get('id')}/edit`} uk-tooltip='' title='Edit Categories' uk-icon="icon: file-edit"></Link>
|
||||||
|
: null
|
||||||
|
}
|
||||||
<div className="role-picker__spacer"></div>
|
<div className="role-picker__spacer"></div>
|
||||||
<div className={`role-picker__actions ${(!this.rolesHaveChanged) ? 'hidden' : ''}`}>
|
<div className={`role-picker__actions ${(!this.rolesHaveChanged) ? 'hidden' : ''}`}>
|
||||||
<button disabled={!this.rolesHaveChanged} onClick={() => dispatch(Actions.resetSelected)} className="uk-button rp-button secondary">
|
<button disabled={!this.rolesHaveChanged} onClick={() => dispatch(Actions.resetSelected)} className="uk-button rp-button secondary">
|
||||||
|
|
Loading…
Add table
Reference in a new issue