rhases-nodejs-commons
Advanced tools
Comparing version 0.2.14 to 0.2.15
@@ -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) |
@@ -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", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
61031