Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

klark-js-plugins

Package Overview
Dependencies
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

klark-js-plugins - npm Package Compare versions

Comparing version 1.0.9 to 1.0.10

.vscode/settings.json

2

package.json
{
"name": "klark-js-plugins",
"version": "1.0.9",
"version": "1.0.10",
"description": "Plugin modules for KlarkJS",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -25,3 +25,3 @@ 'use strict';

app.get(crudUrls.retrieve(model.modelName), [
app.get(crudUrls.retrieve(model.modelName), opts.retrieve.onMiddlewareGenerated([
krkMiddlewarePermissions.check(opts.retrieve.permissions),

@@ -32,5 +32,5 @@ krkMiddlewareParameterValidator.crud.retrieve(),

krkMiddlewareResponse.fail
]);
]));
app.get(crudUrls.retrieveAll(model.modelName), [
app.get(crudUrls.retrieveAll(model.modelName), opts.retrieveAll.onMiddlewareGenerated([
krkMiddlewarePermissions.check(opts.retrieveAll.permissions),

@@ -41,5 +41,5 @@ krkMiddlewareParameterValidator.crud.retrieveAll(model),

krkMiddlewareResponse.fail
]);
]));
app.post(crudUrls.create(model.modelName), [
app.post(crudUrls.create(model.modelName), opts.create.onMiddlewareGenerated([
krkMiddlewarePermissions.check(opts.create.permissions),

@@ -50,5 +50,5 @@ krkMiddlewareParameterValidator.crud.create(model),

krkMiddlewareResponse.fail
]);
]));
app.put(crudUrls.update(model.modelName), [
app.put(crudUrls.update(model.modelName), opts.update.onMiddlewareGenerated([
krkMiddlewarePermissions.check(opts.update.permissions),

@@ -59,5 +59,5 @@ krkMiddlewareParameterValidator.crud.update(model),

krkMiddlewareResponse.fail
]);
]));
app.delete(crudUrls.delete(model.modelName), [
app.delete(crudUrls.delete(model.modelName), opts.delete.onMiddlewareGenerated([
krkMiddlewarePermissions.check(opts.delete.permissions),

@@ -68,3 +68,3 @@ krkMiddlewareParameterValidator.crud.delete(model),

krkMiddlewareResponse.fail
]);
]));
}

@@ -105,15 +105,20 @@

retrieveAll: {
permissions: 'ADMIN'
permissions: 'ADMIN',
onMiddlewareGenerated: _.identity
},
retrieve: {
permissions: 'ADMIN'
permissions: 'ADMIN',
onMiddlewareGenerated: _.identity
},
create: {
permissions: 'ADMIN'
permissions: 'ADMIN',
onMiddlewareGenerated: _.identity
},
update: {
permissions: 'ADMIN'
permissions: 'ADMIN',
onMiddlewareGenerated: _.identity
},
delete: {
permissions: 'ADMIN'
permissions: 'ADMIN',
onMiddlewareGenerated: _.identity
}

@@ -120,0 +125,0 @@ };

@@ -10,3 +10,4 @@ 'use strict';

connect: connect,
dropDatabase: dropDatabase
dropDatabase: dropDatabase,
decorateMongoosePromises: decorateMongoosePromises
};

@@ -27,3 +28,3 @@

var deffered = q.defer();
decorateMongoosePromises();
$mongoose.connect(mongodbUrl);

@@ -30,0 +31,0 @@ var db = $mongoose.connection;

@@ -35,7 +35,4 @@ 'use strict';

})
.then(function() {
return user;
});
}
});

@@ -9,2 +9,3 @@ 'use strict';

$mongooseCreatedmodified,
krkDbMongooseConnector,
krkMiddlewarePermissionsRoles,

@@ -15,2 +16,3 @@ krkDbMongoosePluginsPassword

var USER_ACCOUNT_VALIDATION_PERIOD = 1 * 24 * 60 * 60 * 1000;
krkDbMongooseConnector.decorateMongoosePromises();

@@ -17,0 +19,0 @@ var schema = new $mongoose.Schema({

@@ -29,3 +29,8 @@ 'use strict';

model: krkModelsUser,
apiUrlPrefix: config.apiUrlPrefix
apiUrlPrefix: config.apiUrlPrefix,
retrieve: safetyReturnUser(middlewareSingleSafetyController),
retrieveAll: safetyReturnUser(middlewareRetrieveAllSafetyController),
create: safetyReturnUser(middlewareSingleSafetyController),
update: safetyReturnUser(middlewareSingleSafetyController),
delete: safetyReturnUser(middlewareSingleSafetyController)
};

@@ -85,4 +90,4 @@ krkCrudGenerator.create(app, crudOpts);

function middlewareRetrieveAllSafetyController(req, res, next) {
res.locals.data.content = _.map(res.locals.data.content, function(c) {
return c.getSafely();
res.locals.data.content = _.map(res.locals.data.content, function(user) {
return user.getSafely();
});

@@ -92,2 +97,18 @@ next();

function middlewareSingleSafetyController(req, res, next) {
if (res.locals.data) {
res.locals.data = res.locals.data.getSafely();
}
next();
}
function safetyReturnUser(middlewareCtrl) {
return {
onMiddlewareGenerated: function(middlewares) {
middlewares.splice(3, 0, middlewareCtrl);
return middlewares;
}
}
}
function middlewareUpdateController(req, res, next) {

@@ -94,0 +115,0 @@ var fulfilled = res.locals.params.fulfilledData;

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc