Skip to content

Commit

Permalink
Merge pull request #125 from razee-io/75_org_admin_key
Browse files Browse the repository at this point in the history
remove orgAdminKey from get/post resutls
  • Loading branch information
dalehille authored Jan 14, 2020
2 parents 49c5296 + ff908fb commit e06a7a1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
7 changes: 2 additions & 5 deletions app/routes/v2/orgs.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,22 +41,20 @@ const createOrg = async(req, res) => {
return res.status(400).send( 'This org already exists' );
}

const orgAdminKey = req.orgAdminKey; // this was set in verifyAdminOrgKey()
const orgApiKey = `orgApiKey-${uuid()}`;
try {
const insertedOrg = await Orgs.insertOne({
'_id': uuid(),
'name': orgName,
'orgKeys' : [ orgApiKey ],
'orgAdminKey': orgAdminKey,
'created': new Date(),
'updated': new Date()
});

if(insertedOrg.result.ok) {
return res.status(200).send( insertedOrg.ops[0] );
} else {
req.log.error(insertedOrg);
req.log.error(insertedOrg.result, `Could not create ${orgName} into the Orgs collection`);
return res.status(500).send( 'Could not create the org' );
}
} catch (error) {
Expand All @@ -69,7 +67,7 @@ const getOrgs = async(req, res) => {
try {
const Orgs = req.db.collection('orgs');

let orgsQuery = { orgAdminKey: req.orgAdminKey };
let orgsQuery = {};
if(req.query && req.query.name) {
let orgsToSearch = [];
if(_.isArray(req.query.name)) {
Expand Down Expand Up @@ -119,7 +117,6 @@ const updateOrg = async(req, res) => {
}
};


const deleteOrg = async(req, res) => {
const existingOrgId = req.params.id;
try {
Expand Down
3 changes: 0 additions & 3 deletions app/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -588,9 +588,6 @@
"type": "string"
}
},
"orgAdminKey": {
"type": "string"
},
"created": {
"type": "string"
},
Expand Down

0 comments on commit e06a7a1

Please sign in to comment.