Permisions updates.

This commit is contained in:
Patrick Fic
2021-03-09 12:45:20 -08:00
parent e11295d57c
commit 7a772ff2ee
11 changed files with 6030 additions and 160 deletions

View File

@@ -7,23 +7,23 @@ exports.processSignUp = functions.auth.user().onCreate((user) => {
// Check if user meets role criteria:
// Your custom logic here: to decide what roles and other `x-hasura-*` should the user get
let customClaims;
if (user.email && user.email.indexOf("@thinkimex.com") !== -1) {
customClaims = {
"https://hasura.io/jwt/claims": {
"x-hasura-default-role": "admin",
"x-hasura-allowed-roles": ["user", "admin"],
"x-hasura-user-id": user.uid,
},
};
} else {
customClaims = {
"https://hasura.io/jwt/claims": {
"x-hasura-default-role": "user",
"x-hasura-allowed-roles": ["user"],
"x-hasura-user-id": user.uid,
},
};
}
// if (user.email && user.email.indexOf("@thinkimex.com") !== -1) {
// customClaims = {
// "https://hasura.io/jwt/claims": {
// "x-hasura-default-role": "admin",
// "x-hasura-allowed-roles": ["user", "admin"],
// "x-hasura-user-id": user.uid,
// },
// };
// } else {
customClaims = {
"https://hasura.io/jwt/claims": {
"x-hasura-default-role": "user",
"x-hasura-allowed-roles": ["user"],
"x-hasura-user-id": user.uid,
},
};
//}
//Removed for now - outbound connections are not free on firebase.
// fetch(GRAPHQL_ENDPOINT, {