Skip to content
Snippets Groups Projects
Commit 12200454 authored by Yannis Barlas's avatar Yannis Barlas
Browse files

Merged in admin-fixes (pull request #23)

Admin fixes
parents 3c2206f8 f8814ea6
No related branches found
No related tags found
No related merge requests found
......@@ -104,7 +104,10 @@ export class BookBuilder extends React.Component {
}
_isProductionEditor () {
return _.includes(this._getRoles(), 'production-editor')
const userRoles = this._getRoles()
const accepted = ['production-editor', 'admin']
const pass = _.some(accepted, (role) => _.includes(userRoles, role))
return pass
}
render () {
......
......@@ -57,6 +57,7 @@ export class ProgressItem extends React.Component {
canChange () {
const { type, roles, chapter } = this.props
console.log('can change', includes(roles, 'admin'))
if (includes(roles, 'admin') || includes(roles, 'production-editor')) return true
const isActive = (chapter.progress[type] === 1)
......@@ -84,7 +85,11 @@ export class ProgressItem extends React.Component {
}, 3000)
}
if (includes(roles, 'production-editor')) {
// TODO -- refactor
if (
includes(roles, 'production-editor') ||
includes(roles, 'admin')
) {
return this.changeProgressState()
}
......
......@@ -74,9 +74,12 @@ export class SimpleEditorWrapper extends React.Component {
// // this._checkRights()
// }
// TODO -- refactor
_checkRights () {
const { fragment, user } = this.props
if (user.admin) return this.setState({ canEdit: true })
if ((fragment.progress['review'] === 1 && user.teams[0].teamType.name === 'Author') ||
(fragment.progress['edit'] === 1 && user.teams[0].teamType.name === 'Copy Editor')) {
this.setState({ canEdit: true })
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment