diff --git a/.gitignore b/.gitignore
index 2f90a7a2..f8db459a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,3 @@
/data
-**/grappa_pgdata
\ No newline at end of file
+**/grappa_pgdata
+.env
diff --git a/frontend/src/containers/Thesis/ThesisList.js b/frontend/src/containers/Thesis/ThesisList.js
index ed454b2b..da526197 100755
--- a/frontend/src/containers/Thesis/ThesisList.js
+++ b/frontend/src/containers/Thesis/ThesisList.js
@@ -5,6 +5,7 @@ import { thesisType, agreementType, attachmentType, councilmeetingType } from '.
import LoadingIndicator from '../LoadingIndicator/index'
// import { makeGetFormatTheses } from '../../selectors/thesisList'
import ThesisListRow from './components/ThesisListRow'
+import { eThesisRoles, printedForMeetingRoles } from '../../util/constants'
export class ThesisList extends Component {
constructor(props) {
@@ -131,7 +132,7 @@ export class ThesisList extends Component {
}
render() {
- const { canSeeEthesis } = this.props
+ const { canSeeEthesis, canSeePrintedForMeeting } = this.props
return (
@@ -162,7 +163,7 @@ export class ThesisList extends Component {
Scheduled council meeting |
Checked by author |
No pending graders |
- Printed for meeting this.setState({ showInfo: true })} /> |
+ {canSeePrintedForMeeting ? Printed for meeting this.setState({ showInfo: true })} /> | : null}
{canSeeEthesis ? Published in E-Thesis | : null}
@@ -210,7 +211,14 @@ const mapStateToProps = state => ({
// theses: state.theses,
agreements: state.agreements,
attachments: state.attachments,
- canSeeEthesis: ((state.user || {}).roles || []).find(role => role.role === 'manager' || role.role === 'print_person' || role.role === 'resp_professor')
+ canSeePrintedForMeeting: Boolean(
+ ((state.user || {}).roles || [])
+ .find(role => printedForMeetingRoles.includes(role.role)
+ )),
+ canSeeEthesis: Boolean(
+ ((state.user || {}).roles || [])
+ .find(role => eThesisRoles.includes(role.role))
+ )
})
export default connect(mapStateToProps)(ThesisList)
diff --git a/frontend/src/containers/Thesis/components/ThesisListRow.js b/frontend/src/containers/Thesis/components/ThesisListRow.js
index a41f7a57..f0f77ea0 100644
--- a/frontend/src/containers/Thesis/components/ThesisListRow.js
+++ b/frontend/src/containers/Thesis/components/ThesisListRow.js
@@ -6,6 +6,7 @@ import { Link } from 'react-router-dom'
import { thesisType, councilmeetingType } from '../../../util/types'
import { formatDisplayDate } from '../../../util/common'
import InEthesisIcon from './InEthesisIcon'
+import { eThesisRoles, printedForMeetingRoles } from '../../../util/constants'
const renderStatusIcons = field =>
(field ? : )
@@ -23,7 +24,7 @@ const getAuthorName = (thesis) => {
// This is a pretty basic check and could be improved.
const checkGraders = graders => graders.filter(grader => grader.roleRequestId).length < 1
-const ThesisListRow = ({ councilmeeting, thesis, showButtons, selectable, toggleThesis, selectedThesesIds, canSeeEthesis }) => {
+const ThesisListRow = ({ councilmeeting, thesis, showButtons, selectable, toggleThesis, selectedThesesIds, canSeeEthesis, canSeePrintedForMeeting }) => {
const authorName = getAuthorName(thesis)
return (
@@ -43,7 +44,7 @@ const ThesisListRow = ({ councilmeeting, thesis, showButtons, selectable, toggle
{councilmeeting ? formatDisplayDate(councilmeeting.date) : null} |
{renderStatusIcons(!authorName.some(author => author.includes('@')))} |
{renderStatusIcons(checkGraders(thesis.graders))} |
- {renderStatusIcons(thesis.printDone)} |
+ {canSeePrintedForMeeting ? {renderStatusIcons(thesis.printDone)} | : null}
{canSeeEthesis ? | : null}
)
@@ -59,7 +60,11 @@ ThesisListRow.propTypes = {
}
const mapStateToProps = state => ({
- canSeeEthesis: ((state.user || {}).roles || []).find(role => role.role === 'manager' || role.role === 'print_person' || role.role === 'resp_professor')
+ canSeePrintedForMeeting: Boolean(
+ ((state.user || {}).roles || [])
+ .find(role => printedForMeetingRoles.includes(role.role)
+ )),
+ canSeeEthesis: ((state.user || {}).roles || []).find(role => eThesisRoles.includes(role.role))
})
export default connect(mapStateToProps)(ThesisListRow)
diff --git a/frontend/src/util/constants.js b/frontend/src/util/constants.js
index a89264ca..491e89fe 100644
--- a/frontend/src/util/constants.js
+++ b/frontend/src/util/constants.js
@@ -1,2 +1,12 @@
-export const TOKEN_NAME = 'token'
-export const DEV_USER = 'devUser'
+export const TOKEN_NAME = "token"
+export const DEV_USER = "devUser"
+
+export const printedForMeetingRoles = [
+ "admin",
+ "manager",
+ "print_person",
+ "resp_professor",
+ "grader",
+ "supervisor",
+]
+export const eThesisRoles = ["manager", "print_person", "resp_professor"]