Skip to content

Commit 71f025e

Browse files
committed
v0.9.3
* fix(app): add createdBy editing of roles and environments (will be removed when projects are created with correct roles by default)
1 parent f24623c commit 71f025e

File tree

7 files changed

+22
-9
lines changed

7 files changed

+22
-9
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "fireadmin",
3-
"version": "0.9.2",
3+
"version": "0.9.3",
44
"description": "Application for Managing Firebase Applications. Includes support for multiple environments and data migrations.",
55
"scripts": {
66
"clean": "rimraf build",

src/routes/Projects/routes/Project/routes/Actions/components/ActionsPage/ActionsPage.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ function ActionsPage({ projectId }) {
5555
const templateName = selectedTemplate?.name
5656
? `Template: ${selectedTemplate.name}`
5757
: 'Template'
58-
// TODO: Disable run action button if form is not fully filled out
58+
5959
return (
6060
<div className={classes.container}>
6161
<Typography className={classes.pageHeader}>Actions</Typography>

src/routes/Projects/routes/Project/routes/Actions/components/ActionsPage/useActionsPage.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {
55
useFirestore,
66
useFirestoreCollectionData
77
} from 'reactfire'
8+
import * as Sentry from '@sentry/browser'
89
import {
910
ACTION_RUNNER_REQUESTS_PATH,
1011
PROJECTS_COLLECTION
@@ -141,7 +142,8 @@ export default function useActionRunner({
141142
} catch (err) {
142143
console.error('Error starting action request: ', err.message) // eslint-disable-line no-console
143144
showError('Error starting action request')
144-
triggerAnalyticsEvent('actionRunError', {
145+
Sentry.captureException(err)
146+
triggerAnalyticsEvent('action-run-error', {
145147
err,
146148
message: err.message,
147149
projectId,

src/routes/Projects/routes/Project/routes/Environments/components/EditEnvironmentDialog/EditEnvironmentDialog.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@ function EditEnvironmentDialog({
3535
const projectRef = firestore.doc(`${PROJECTS_COLLECTION}/${projectId}`)
3636
const project = useFirestoreDocData(projectRef)
3737
const userHasPermission = createPermissionGetter(project, user?.uid)
38-
const hasUpdatePermission = userHasPermission('update.environments')
38+
// TODO: Remove checking of ownership once update role is setup by default on project
39+
const hasUpdatePermission =
40+
user?.uid === project.createdBy || userHasPermission('update.environments')
3941

4042
// Form
4143
const {

src/routes/Projects/routes/Project/routes/Permissions/components/PermissionsTable/PermissionsTable.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@ import { triggerAnalyticsEvent } from 'utils/analytics'
1313
import useNotifications from 'modules/notification/useNotifications'
1414
import PermissionsTableRow from '../PermissionsTableRow'
1515
import DeleteMemberModal from '../DeleteMemberModal'
16-
import { PROJECTS_COLLECTION } from 'constants/firebasePaths'
16+
import {
17+
PROJECTS_COLLECTION,
18+
DISPLAY_NAMES_PATH
19+
} from 'constants/firebasePaths'
1720
import styles from './PermissionsTable.styles'
1821

1922
const useStyles = makeStyles(styles)
@@ -29,7 +32,7 @@ function PermissionsTable({ projectId }) {
2932
changeSelectedMemberId(selectedId)
3033
}
3134
const database = useDatabase()
32-
const displayNamesRef = database.ref('displayNames')
35+
const displayNamesRef = database.ref(DISPLAY_NAMES_PATH)
3336
const displayNames = useDatabaseObjectData(displayNamesRef)
3437

3538
const firestore = useFirestore()

src/routes/Projects/routes/Project/routes/Permissions/components/PermissionsTableRow/PermissionsTableRow.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import { makeStyles } from '@material-ui/core/styles'
2424
import { triggerAnalyticsEvent, createProjectEvent } from 'utils/analytics'
2525
import useNotifications from 'modules/notification/useNotifications'
2626
import styles from './PermissionsTableRow.styles'
27+
import { PROJECTS_COLLECTION } from 'constants/firebasePaths'
2728

2829
const useStyles = makeStyles(styles)
2930

@@ -54,7 +55,7 @@ function PermissionsTableRow({
5455
const { showSuccess } = useNotifications()
5556
const user = useUser()
5657

57-
const projectRef = firestore.doc(`projects/${projectId}`)
58+
const projectRef = firestore.doc(`${PROJECTS_COLLECTION}/${projectId}`)
5859
const project = useFirestoreDocData(projectRef)
5960
const roleOptions = map(project.roles, ({ name }, value) => ({ value, name }))
6061

src/routes/Projects/routes/Project/routes/Permissions/components/RolesTable/RolesTable.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import NewRoleCard from '../NewRoleCard'
1414
import NoRolesFound from './NoRolesFound'
1515
import styles from './RolesTable.styles'
1616
import { createPermissionGetter } from 'utils/data'
17+
import { PROJECTS_COLLECTION } from 'constants/firebasePaths'
1718

1819
const useStyles = makeStyles(styles)
1920

@@ -24,7 +25,7 @@ function RolesTable({ projectId }) {
2425
const { FieldValue } = useFirestore
2526
const user = useUser()
2627
const { showError, showSuccess } = useNotifications()
27-
const projectRef = firestore.doc(`projects/${projectId}`)
28+
const projectRef = firestore.doc(`${PROJECTS_COLLECTION}/${projectId}`)
2829
const project = useFirestoreDocData(projectRef)
2930
const openNewRole = () => changeRoleOpen(true)
3031
const closeNewRole = () => changeRoleOpen(false)
@@ -97,7 +98,11 @@ function RolesTable({ projectId }) {
9798
projectId={projectId}
9899
currentRoles={project.roles}
99100
roleOptions={roleOptions}
100-
updateRolesDisabled={!userHasPermission('update.roles')}
101+
updateRolesDisabled={
102+
// TODO: Remove checking of ownership once update role is setup by default on project
103+
project.createdBy !== user?.uid &&
104+
!userHasPermission('update.roles')
105+
}
101106
initialValues={permissions}
102107
/>
103108
))

0 commit comments

Comments
 (0)