-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #322 from cioos-siooc/development
a whole bunch of stuff
- Loading branch information
Showing
82 changed files
with
27,860 additions
and
34,714 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,15 @@ | ||
{ | ||
"presets": [[ | ||
"@babel/preset-env", { | ||
"useBuiltIns": "entry" | ||
"useBuiltIns": "entry", | ||
"loose": true | ||
}], | ||
"@babel/preset-react"], | ||
"plugins": [ | ||
"@babel/plugin-proposal-class-properties", | ||
["@babel/plugin-transform-class-properties",{"loose": true}], | ||
"@babel/plugin-proposal-export-default-from", | ||
"react-hot-loader/babel" | ||
"react-hot-loader/babel", | ||
["@babel/plugin-transform-private-methods",{"loose": true}], | ||
["@babel/plugin-transform-private-property-in-object",{"loose": true}] | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,6 +21,5 @@ | |
} | ||
], | ||
"react/prop-types": 0 | ||
}, | ||
"ignorePatterns": "*.test.js" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,4 +38,5 @@ __pycache__ | |
firebase-debug.log | ||
.Rproj.user | ||
|
||
.env | ||
yarn.lock | ||
.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* eslint no-param-reassign: ["error", { "props": false }] */ | ||
module.exports = function override(config) { | ||
const fallback = config.resolve.fallback || {}; | ||
Object.assign(fallback, { | ||
crypto: require.resolve("crypto-browserify"), | ||
stream: require.resolve("stream-browserify"), | ||
assert: false, // require.resolve("assert") can be polyfilled here if needed | ||
http: require.resolve("stream-http"), | ||
https: require.resolve("https-browserify"), | ||
os: false, // require.resolve("os-browserify") can be polyfilled here if needed | ||
url: require.resolve("url/"), | ||
zlib: false, // require.resolve("browserify-zlib") can be polyfilled here if needed | ||
querystring: require.resolve("querystring-es3"), | ||
util: require.resolve("util/"), | ||
path: require.resolve("path-browserify"), | ||
}); | ||
config.resolve.fallback = fallback; | ||
config.ignoreWarnings = [/Failed to parse source map/]; | ||
config.module.rules.push({ | ||
test: /\.(js|mjs|jsx)$/, | ||
enforce: "pre", | ||
loader: require.resolve("source-map-loader"), | ||
resolve: { | ||
fullySpecified: false, | ||
}, | ||
}); | ||
return config; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
version: "3.3" | ||
|
||
services: | ||
|
||
# ------------------------------------- | ||
# Firebase Eumulator | ||
# ------------------------------------- | ||
|
||
emulator: | ||
image: cioos/firebase-emulator:latest | ||
build: ./firebase-functions/ | ||
volumes: | ||
- ./firebase-functions/firebase.json:/app/firebase.json:rw | ||
- ./firebase-functions/firestore.rules:/app/firestore.rules | ||
- ./firebase-functions/firestore.indexes.json:/app/firestore.indexes.json | ||
- ./firebase-functions/functions:/app/functions | ||
env_file: | ||
- .env | ||
environment: | ||
FIREBASE_PROJECT: cioos-metadata-form | ||
ports: | ||
- 5002:5002 # Functions emulator | ||
- 9001:9001 # Realtime Database | ||
- 8081:8081 | ||
- 4000:4000 # UI | ||
- 4400:4400 | ||
- 4500:4500 | ||
- 9299:9299 | ||
- 9099:9099 # Authentication emulator | ||
- 9150:9150 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
FROM node:lts-alpine AS app-env | ||
|
||
# Install Python and Java and pre-cache emulator dependencies. | ||
RUN apk add --no-cache python3 py3-pip openjdk11-jre bash && \ | ||
npm install -g firebase-tools && \ | ||
firebase setup:emulators:database && \ | ||
firebase setup:emulators:firestore && \ | ||
firebase setup:emulators:pubsub && \ | ||
firebase setup:emulators:storage && \ | ||
firebase setup:emulators:ui && \ | ||
rm -rf /var/cache/apk/* | ||
|
||
WORKDIR /app | ||
|
||
ADD ./entrypoint.sh /app/entrypoint.sh | ||
RUN chmod 755 entrypoint.sh | ||
|
||
ENTRYPOINT ["./entrypoint.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,65 @@ | ||
{ | ||
"rules": { | ||
// Firebase security rules cascade, meaning that if a user is granted read or write permissions | ||
// at a higher (parent) level, those permissions cannot be revoked at a lower (child) level. | ||
// This design requires careful structuring of rules (and data) to ensure appropriate access control | ||
// throughout the database hierarchy. | ||
"$region": { | ||
// Allow read access to any authenticated user. | ||
".read": "auth.uid != null", | ||
"users": { | ||
"$userid": { | ||
// Allow write access if the authenticated user is the user specified by $userid or if the authenticated user's email is listed as a reviewer in the admin permissions for the region. | ||
".write": "(auth.uid == $userid) || root.child('admin').child($region).child('permissions').child('reviewers').val().contains(auth.email)" | ||
} | ||
"rules": { | ||
// Firebase security rules cascade, meaning that if a user is granted read or write permissions | ||
// at a higher (parent) level, those permissions cannot be revoked at a lower (child) level. | ||
// This design requires careful structuring of rules (and data) to ensure appropriate access control | ||
// throughout the database hierarchy. | ||
"$region": { | ||
// Allow read access to any authenticated user. | ||
".read": "auth.uid != null", | ||
"shares": { | ||
"$userid": { | ||
// Allow write access to any authenticated user. | ||
// This rule permits user A to share a record with user B by writing to user B's 'shares' node. | ||
".write": "auth.uid != null", | ||
} | ||
}, | ||
"admin": { // Section of the database dedicated to admin configurations. | ||
"$regionAdmin": { | ||
// Allow read access if the authenticated user's email is listed as a reviewer in the permissions for the region. | ||
".read": "root.child('admin').child($regionAdmin).child('permissions').child('reviewers').val().contains(auth.email)", | ||
"projects": { | ||
// Allow write access to projects if the authenticated user's email is listed as a reviewer in the permissions for the region. | ||
".write": "root.child('admin').child($regionAdmin).child('permissions').child('reviewers').val().contains(auth.email)", | ||
// Allow read access to any authenticated user. | ||
".read": "auth.uid != null" | ||
}, | ||
"permissions": { | ||
// Allow read access to any authenticated user. | ||
".read": "auth.uid != null", | ||
"admins": { | ||
// Allow write access for admins if the authenticated user's email is listed as an admin in the permissions for the region. | ||
".write": "root.child('admin').child($regionAdmin).child('permissions').child('admins').val().contains(auth.email)", | ||
}, | ||
"reviewers": { | ||
// Allow write access for reviewers if the authenticated user's email is listed as an admin in the permissions for the region. | ||
".write": "root.child('admin').child($regionAdmin).child('permissions').child('admins').val().contains(auth.email)", | ||
// Allow read access to any authenticated user. | ||
".read": "auth.uid != null", | ||
} | ||
}, | ||
"dataciteCredentials": { | ||
// Allow write access to DataCite credentials if the authenticated user's email is listed as an admin in the permissions for the region. | ||
".write": "root.child('admin').child($regionAdmin).child('permissions').child('admins').val().contains(auth.email)", | ||
} | ||
"users": { | ||
"$userid": { | ||
// Allow write access if the authenticated user is the user specified by $userid or if the authenticated user's email is listed as a reviewer in the admin permissions for the region. | ||
".write": "(auth.uid == $userid) || root.child('admin').child($region).child('permissions').child('reviewers').val().contains(auth.email)", | ||
"records": { | ||
"$recordid": { | ||
// Allow read access if the authenticated users's uid is listed in the 'shared with' list for the record | ||
".read": "root.child($region).child('users').child($userid).child('records').child($recordid).child('sharedWith').child(auth.uid).exists()", | ||
// Allow write access if the authenticated users's uid is listed in the 'shared with' list for the record | ||
".write": "root.child($region).child('users').child($userid).child('records').child($recordid).child('sharedWith').child(auth.uid).exists()", | ||
} | ||
}, | ||
} | ||
} | ||
}, | ||
"admin": { // Section of the database dedicated to admin configurations. | ||
"$regionAdmin": { | ||
// Allow read access if the authenticated user's email is listed as a reviewer in the permissions for the region. | ||
".read": "root.child('admin').child($regionAdmin).child('permissions').child('reviewers').val().contains(auth.email) || root.child('admin').child($regionAdmin).child('permissions').child('admins').val().contains(auth.email)", | ||
"projects": { | ||
// Allow write access to projects if the authenticated user's email is listed as a reviewer in the permissions for the region. | ||
".write": "root.child('admin').child($regionAdmin).child('permissions').child('reviewers').val().contains(auth.email)", | ||
// Allow read access to any authenticated user. | ||
".read": "auth.uid != null" | ||
}, | ||
"permissions": { | ||
// Allow read access to any authenticated user. | ||
".read": "auth.uid != null", | ||
"admins": { | ||
// Allow write access for admins if the authenticated user's email is listed as an admin in the permissions for the region. | ||
".write": "root.child('admin').child($regionAdmin).child('permissions').child('admins').val().contains(auth.email)", | ||
// Allow read access to any authenticated user. | ||
".read": "auth.uid != null" | ||
}, | ||
"reviewers": { | ||
// Allow write access for reviewers if the authenticated user's email is listed as an admin in the permissions for the region. | ||
".write": "root.child('admin').child($regionAdmin).child('permissions').child('admins').val().contains(auth.email)", | ||
// Allow read access to any authenticated user. | ||
".read": "auth.uid != null" | ||
} | ||
}, | ||
"dataciteCredentials": { | ||
// Allow write access to DataCite credentials if the authenticated user's email is listed as an admin in the permissions for the region. | ||
".write": "root.child('admin').child($regionAdmin).child('permissions').child('admins').val().contains(auth.email)", | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/bin/sh | ||
|
||
echo "Launching emulator with following firebase.json config file" | ||
cat firebase.json | ||
|
||
npm --prefix ./functions install | ||
firebase emulators:start --project=cioos-metadata-form --only=firestore,database,functions,auth |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.