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

rhases-nodejs-commons

Package Overview
Dependencies
Maintainers
3
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rhases-nodejs-commons - npm Package Compare versions

Comparing version 0.2.14 to 0.2.15

10

CHANGELOG.md

@@ -5,2 +5,12 @@ # Change Log

<a name="0.2.15"></a>
## [0.2.15](https://github.com/rhases/rhases-nodejs-commons/compare/v0.2.14...v0.2.15) (2017-10-02)
### Bug Fixes
* restrição para organização:own ([8dd4841](https://github.com/rhases/rhases-nodejs-commons/commit/8dd4841))
<a name="0.2.14"></a>

@@ -7,0 +17,0 @@ ## [0.2.14](https://github.com/rhases/rhases-nodejs-commons/compare/v0.2.13...v0.2.14) (2017-10-02)

2

dist/crud/access-control-base.controller.js

@@ -36,3 +36,3 @@ "use strict";

return functions_utils_1.now(query)
.then(promise_grants_utils_1.ifGrantedForOwn(grant, base_query_builder_1.restrictByOwner(grant.ownerTypes, req.user)))
.then(promise_grants_utils_1.ifGrantedForOwn(grant, base_query_builder_1.restrictByOwner(grant.ownerTypes, user._id, user.organization.ref.code)))
.then(promise_grants_utils_1.ifDefined(exQueryBuilder))

@@ -39,0 +39,0 @@ .then(function (param) {

@@ -11,4 +11,4 @@ import { Model, Document, DocumentQuery } from 'mongoose';

export declare function execFindByIdWithQueryBuilder(model: Model<Document>, id: any): (queryBuilder: (query: DocumentQuery<any, any>) => DocumentQuery<any, any>) => Promise<any>;
export declare function restrictByOwner(ownerTypes: any, userId?: any, organizationId?: any): (query: DocumentQuery<any, any>) => DocumentQuery<any, any>;
export declare function restrictByOwner(ownerTypes: any, userId?: any, organizationCode?: any): (query: DocumentQuery<any, any>) => DocumentQuery<any, any>;
export declare function restrictByUserOwner(user: any): (query: DocumentQuery<any, any>) => DocumentQuery<any, any>;
export declare function restrictByOrganizationOwner(user: any): (query: DocumentQuery<any, any>) => DocumentQuery<any, any>;

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

exports.execFindByIdWithQueryBuilder = execFindByIdWithQueryBuilder;
function restrictByOwner(ownerTypes, userId, organizationId) {
function restrictByOwner(ownerTypes, userId, organizationCode) {
var restrictions = [];

@@ -91,3 +91,3 @@ if (ownerTypes.indexOf('user') >= 0) {

if (ownerTypes.indexOf('organization') >= 0) {
restrictions.push({ "owner.organizationId": organizationId });
restrictions.push({ "owner.organizationId": organizationCode });
}

@@ -117,5 +117,5 @@ return function (query) {

return function (query) {
return query.where("owner.organizationId").equals(user.owner.organization.ref.code);
return query.where("owner.organizationCode").equals(user.organization.ref.code);
};
}
exports.restrictByOrganizationOwner = restrictByOrganizationOwner;
{
"name": "rhases-nodejs-commons",
"version": "0.2.14",
"version": "0.2.15",
"description": "Node.js utilities",

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

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