This repository has been archived by the owner on Nov 21, 2020. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
247 changed files
with
8,991 additions
and
4,291 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,5 +1,6 @@ | ||
.git | ||
.gitignore | ||
*.md | ||
scripts | ||
*.yml | ||
initialData | ||
scripts | ||
.snyk |
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 |
---|---|---|
@@ -1,66 +1,66 @@ | ||
NODE_ENV=development | ||
PORT=3300 | ||
|
||
# MongoDB | ||
MONGO_URL=mongodb://localhost/erxes | ||
TEST_MONGO_URL=mongodb://localhost/test | ||
|
||
# Set this variables as True if you are using replication set | ||
# in MONGO_URL which means Collection.watch method works as | ||
# expected and can send notification | ||
USE_REPLICATION=false | ||
|
||
TEST_MONGO_URL=mongodb://localhost/test | ||
|
||
# Redis | ||
REDIS_HOST=localhost | ||
REDIS_PORT=6379 | ||
REDIS_PASSWORD= | ||
|
||
# erxes-api | ||
HTTPS=false | ||
|
||
MAIN_APP_DOMAIN=http://localhost:3000 | ||
|
||
# Using this config to upload file directly from widgets in cors origins | ||
WIDGETS_DOMAIN=http://localhost:3200 | ||
|
||
DOMAIN=http://localhost:3300 | ||
MAX_IMPORT_SIZE=600 | ||
NODE_ENV=development | ||
PORT=3300 | ||
|
||
COMPANY_EMAIL_FROM=[email protected] | ||
|
||
DEFAULT_EMAIL_SERVICE=sendgrid | ||
MAIL_SERVICE=sendgrid | ||
MAIL_PORT='' | ||
MAIL_USER='' | ||
MAIL_PASS='' | ||
MAIL_HOST='' | ||
|
||
TWITTER_CONSUMER_KEY='' | ||
TWITTER_CONSUMER_SECRET='' | ||
TWITTER_REDIRECT_URL='' | ||
|
||
# Aws S3 | ||
AWS_ACCESS_KEY_ID='' | ||
AWS_SECRET_ACCESS_KEY='' | ||
AWS_BUCKET='' | ||
AWS_PREFIX='' | ||
|
||
# Aws SES | ||
AWS_SES_ACCESS_KEY_ID='' | ||
AWS_SES_SECRET_ACCESS_KEY='' | ||
AWS_SES_CONFIG_SET='' | ||
|
||
AWS_REGION='' | ||
AWS_ENDPOINT='' | ||
|
||
FACEBOOK_APP_ID='' | ||
FACEBOOK_APP_SECRET='' | ||
FACEBOOK_PERMISSIONS='manage_pages, pages_show_list, pages_messaging, publish_pages, pages_messaging_phone_number, pages_messaging_subscriptions' | ||
|
||
MAX_IMPORT_SIZE=600 | ||
|
||
# Gmail | ||
GOOGLE_CLIENT_ID='' | ||
GOOGLE_CLIENT_SECRET='' | ||
GOOGLE_REDIRECT_URI='' | ||
GOOGLE_APPLICATION_CREDENTIALS='' | ||
GOOGLE_TOPIC='' | ||
GOOGLE_SUPSCRIPTION_NAME='' | ||
GOOGLE_SUBSCRIPTION_NAME='' | ||
GOOGLE_PROJECT_ID='' | ||
|
||
GMAIL_REDIRECT_URL = http://localhost:3300/ | ||
|
||
ERXES_PATH='' | ||
|
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 |
---|---|---|
|
@@ -10,4 +10,4 @@ dump.rdb | |
*.un~ | ||
*.swp | ||
*.swo | ||
.migrate | ||
.migrate |
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,5 @@ | ||
{ | ||
"printWidth": 120, | ||
"singleQuote": true, | ||
"trailingComma": "all" | ||
} |
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,5 @@ | ||
FROM erxes/runner | ||
WORKDIR /erxes-api | ||
COPY yarn.lock package.json ./ | ||
RUN yarn install | ||
CMD ["yarn", "dev"] |
This file was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{"options":{},"indexes":[{"v":2,"key":{"_id":1},"name":"_id_","ns":"erxes.activity_logs"}]} | ||
{"options":{},"indexes":[{"v":2,"key":{"_id":1},"name":"_id_","ns":"erxes.activity_logs"}],"uuid":"475cbddb84ce4a8b90d3cfad816f01db"} |
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 +1 @@ | ||
{"options":{},"indexes":[{"v":2,"key":{"_id":1},"name":"_id_","ns":"erxes.brands"}]} | ||
{"options":{},"indexes":[{"v":2,"key":{"_id":1},"name":"_id_","ns":"erxes.brands"}],"uuid":"f2489825947d47918b5c80dafc344e48"} |
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 +1 @@ | ||
{"options":{},"indexes":[{"v":2,"key":{"_id":1},"name":"_id_","ns":"erxes.channels"}]} | ||
{"options":{},"indexes":[{"v":2,"key":{"_id":1},"name":"_id_","ns":"erxes.channels"}],"uuid":"c791f01cfe5f40e3991a47f391861e6a"} |
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 +1 @@ | ||
{"options":{},"indexes":[{"v":2,"key":{"_id":1},"name":"_id_","ns":"erxes.companies"}]} | ||
{"options":{},"indexes":[{"v":2,"key":{"_id":1},"name":"_id_","ns":"erxes.companies"}],"uuid":"21e6f9d86b414f539bbde07758f6add2"} |
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 +1 @@ | ||
{"options":{},"indexes":[{"v":2,"key":{"_id":1},"name":"_id_","ns":"erxes.configs"}]} | ||
{"options":{},"indexes":[{"v":2,"key":{"_id":1},"name":"_id_","ns":"erxes.configs"}],"uuid":"5f2010fddb0b43c3a9cd5065b4e1dfe4"} |
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 +1 @@ | ||
{"options":{},"indexes":[{"v":2,"key":{"_id":1},"name":"_id_","ns":"erxes.conversation_messages"}]} | ||
{"options":{},"indexes":[{"v":2,"key":{"_id":1},"name":"_id_","ns":"erxes.conversation_messages"},{"v":2,"key":{"conversationId":1},"name":"conversationId_1","ns":"erxes.conversation_messages","background":true},{"v":2,"key":{"createdAt":1},"name":"createdAt_1","ns":"erxes.conversation_messages","background":true}],"uuid":"7810722d091640058f889b497ecbc306"} |
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 +1 @@ | ||
{"options":{},"indexes":[{"v":2,"key":{"_id":1},"name":"_id_","ns":"erxes.conversations"}]} | ||
{"options":{},"indexes":[{"v":2,"key":{"_id":1},"name":"_id_","ns":"erxes.conversations"},{"v":2,"key":{"createdAt":1},"name":"createdAt_1","ns":"erxes.conversations","background":true}],"uuid":"873a980e2ce040d8b357dfb880c90a96"} |
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 +1 @@ | ||
{"options":{},"indexes":[{"v":2,"key":{"_id":1},"name":"_id_","ns":"erxes.customers"}]} | ||
{"options":{},"indexes":[{"v":2,"key":{"_id":1},"name":"_id_","ns":"erxes.customers"}],"uuid":"d0a7475bf3a041919474eab4418ad40f"} |
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 +1 @@ | ||
{"options":{},"indexes":[{"v":2,"key":{"_id":1},"name":"_id_","ns":"erxes.deal_boards"}]} | ||
{"options":{},"indexes":[{"v":2,"key":{"_id":1},"name":"_id_","ns":"erxes.deal_boards"}],"uuid":"3c54e2fe8ebe43229f138ab0ec4d99fa"} |
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 +1 @@ | ||
{"options":{},"indexes":[{"v":2,"key":{"_id":1},"name":"_id_","ns":"erxes.deal_pipelines"}]} | ||
{"options":{},"indexes":[{"v":2,"key":{"_id":1},"name":"_id_","ns":"erxes.deal_pipelines"}],"uuid":"69cf853096134ea9ae6dc334fb5fe962"} |
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 +1 @@ | ||
{"options":{},"indexes":[{"v":2,"key":{"_id":1},"name":"_id_","ns":"erxes.deal_stages"}]} | ||
{"options":{},"indexes":[{"v":2,"key":{"_id":1},"name":"_id_","ns":"erxes.deal_stages"}],"uuid":"2bf45d537f5c4470aa301624fa9d1eae"} |
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 +1 @@ | ||
{"options":{},"indexes":[{"v":2,"key":{"_id":1},"name":"_id_","ns":"erxes.deals"}]} | ||
{"options":{},"indexes":[{"v":2,"key":{"_id":1},"name":"_id_","ns":"erxes.deals"}],"uuid":"21ee5a02d35a4dab9bc9d710a68adb38"} |
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 +1 @@ | ||
{"options":{},"indexes":[{"v":2,"key":{"_id":1},"name":"_id_","ns":"erxes.email_templates"}]} | ||
{"options":{},"indexes":[{"v":2,"key":{"_id":1},"name":"_id_","ns":"erxes.email_templates"}],"uuid":"8c3a4f0bddad459986221fd8fede82dd"} |
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 +1 @@ | ||
{"options":{},"indexes":[{"v":2,"key":{"_id":1},"name":"_id_","ns":"erxes.engage_messages"}]} | ||
{"options":{},"indexes":[{"v":2,"key":{"_id":1},"name":"_id_","ns":"erxes.engage_messages"}],"uuid":"6d9f9dc037294135a32f282fedcfffce"} |
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 +1 @@ | ||
{"options":{},"indexes":[{"v":2,"key":{"_id":1},"name":"_id_","ns":"erxes.fields"}]} | ||
{"options":{},"indexes":[{"v":2,"key":{"_id":1},"name":"_id_","ns":"erxes.fields"}],"uuid":"ad91f4aa9e8446df97087fb789a2cff4"} |
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 +1 @@ | ||
{"options":{},"indexes":[{"v":2,"key":{"_id":1},"name":"_id_","ns":"erxes.forms"}]} | ||
{"options":{},"indexes":[{"v":2,"key":{"_id":1},"name":"_id_","ns":"erxes.forms"}],"uuid":"826e52fceb964791bcce7951896572cb"} |
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 +1 @@ | ||
{"options":{},"indexes":[{"v":2,"key":{"_id":1},"name":"_id_","ns":"erxes.integrations"}]} | ||
{"options":{},"indexes":[{"v":2,"key":{"_id":1},"name":"_id_","ns":"erxes.integrations"}],"uuid":"ccec122f943f4d4489c2a114014f8231"} |
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 +1 @@ | ||
{"options":{},"indexes":[{"v":2,"key":{"_id":1},"name":"_id_","ns":"erxes.internal_notes"}]} | ||
{"options":{},"indexes":[{"v":2,"key":{"_id":1},"name":"_id_","ns":"erxes.internal_notes"}],"uuid":"76a399333a644d6b88d791b7f8b960e4"} |
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 +1 @@ | ||
{"options":{},"indexes":[{"v":2,"key":{"_id":1},"name":"_id_","ns":"erxes.knowledgebase_articles"}]} | ||
{"options":{},"indexes":[{"v":2,"key":{"_id":1},"name":"_id_","ns":"erxes.knowledgebase_articles"}],"uuid":"0665ecf554904625a12158f7fdab02d5"} |
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 +1 @@ | ||
{"options":{},"indexes":[{"v":2,"key":{"_id":1},"name":"_id_","ns":"erxes.knowledgebase_categories"}]} | ||
{"options":{},"indexes":[{"v":2,"key":{"_id":1},"name":"_id_","ns":"erxes.knowledgebase_categories"}],"uuid":"2577052f5c794711943a68baa5500818"} |
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 +1 @@ | ||
{"options":{},"indexes":[{"v":2,"key":{"_id":1},"name":"_id_","ns":"erxes.knowledgebase_topics"}]} | ||
{"options":{},"indexes":[{"v":2,"key":{"_id":1},"name":"_id_","ns":"erxes.knowledgebase_topics"}],"uuid":"426a2e6a6560474db3f9588d587788a7"} |
Binary file not shown.
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 @@ | ||
{"options":{},"indexes":[{"v":2,"key":{"_id":1},"name":"_id_","ns":"erxes.permissions"}],"uuid":"eac83e42ddfe49e995638ae9bd3e68e0"} |
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 +1 @@ | ||
{"options":{},"indexes":[{"v":2,"key":{"_id":1},"name":"_id_","ns":"erxes.products"}]} | ||
{"options":{},"indexes":[{"v":2,"key":{"_id":1},"name":"_id_","ns":"erxes.products"}],"uuid":"7f80bf5ae8684c2bb2d66fd70d465137"} |
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 +1 @@ | ||
{"options":{},"indexes":[{"v":2,"key":{"_id":1},"name":"_id_","ns":"erxes.response_templates"}]} | ||
{"options":{},"indexes":[{"v":2,"key":{"_id":1},"name":"_id_","ns":"erxes.response_templates"}],"uuid":"8f3c68dbd321479da147a5882af9f186"} |
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 +1 @@ | ||
{"options":{},"indexes":[{"v":2,"key":{"_id":1},"name":"_id_","ns":"erxes.segments"}]} | ||
{"options":{},"indexes":[{"v":2,"key":{"_id":1},"name":"_id_","ns":"erxes.segments"}],"uuid":"df6562c4c46b40d4848251ab9ae6f693"} |
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 +1 @@ | ||
{"options":{},"indexes":[{"v":2,"key":{"_id":1},"name":"_id_","ns":"erxes.tags"}]} | ||
{"options":{},"indexes":[{"v":2,"key":{"_id":1},"name":"_id_","ns":"erxes.tags"}],"uuid":"4dcf8eb86254449db489394e0599011e"} |
Binary file not shown.
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 @@ | ||
{"options":{},"indexes":[{"v":2,"key":{"_id":1},"name":"_id_","ns":"erxes.user_groups"},{"v":2,"unique":true,"key":{"name":1},"name":"name_1","ns":"erxes.user_groups","background":true}],"uuid":"137452c8f8b1458e8403ff286292e2f1"} |
Binary file not shown.
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 +1 @@ | ||
{"options":{},"indexes":[{"v":2,"key":{"_id":1},"name":"_id_","ns":"erxes.users"},{"v":2,"unique":true,"key":{"email":1},"name":"email_1","ns":"erxes.users","background":true}]} | ||
{"options":{},"indexes":[{"v":2,"key":{"_id":1},"name":"_id_","ns":"erxes.users"},{"v":2,"unique":true,"key":{"email":1},"name":"email_1","background":true,"ns":"erxes.users"}],"uuid":"e560ab63d85b40babba073d6257a26c0"} |
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,47 @@ | ||
import * as dotenv from 'dotenv'; | ||
import * as mongoose from 'mongoose'; | ||
import { moduleObjects } from '../src/data/permissions/actions/permission'; | ||
import { Permissions, Users, UsersGroups } from '../src/db/models'; | ||
|
||
dotenv.config(); | ||
|
||
/** | ||
* Updating existing user's user group and permissions | ||
* | ||
*/ | ||
module.exports.up = next => { | ||
const { MONGO_URL = '' } = process.env; | ||
|
||
mongoose.connect( | ||
MONGO_URL, | ||
{ useNewUrlParser: true, useCreateIndex: true }, | ||
async () => { | ||
const userGroup = await UsersGroups.create({ name: 'Admin', description: 'Admin permission' }); | ||
const moduleKeys = Object.keys(moduleObjects); | ||
const groupId = userGroup._id; | ||
|
||
await Users.updateMany({ isActive: { $exists: false } }, { $set: { isActive: true } }); | ||
await Users.updateMany({}, { $set: { groupIds: [groupId] } }); | ||
|
||
// Creating permissions according to user groups | ||
for (const key of moduleKeys) { | ||
const module = moduleObjects[key]; | ||
const moduleName = module.name; | ||
|
||
for (const action of module.actions) { | ||
const { use = [], name } = action; | ||
const doc = { module: moduleName, allowed: true, action: name, groupId }; | ||
|
||
if (use.length > 0) { | ||
await Permissions.create({ ...doc, requiredActions: use }); | ||
break; | ||
} | ||
|
||
await Permissions.create(doc); | ||
} | ||
} | ||
|
||
next(); | ||
}, | ||
); | ||
}; |
Oops, something went wrong.