rhases-nodejs-commons
Advanced tools
Comparing version 0.2.19 to 0.2.20
@@ -5,2 +5,7 @@ # Change Log | ||
<a name="0.2.20"></a> | ||
## [0.2.20](https://github.com/rhases/rhases-nodejs-commons/compare/v0.2.19...v0.2.20) (2017-10-04) | ||
<a name="0.2.19"></a> | ||
@@ -7,0 +12,0 @@ ## [0.2.19](https://github.com/rhases/rhases-nodejs-commons/compare/v0.2.18...v0.2.19) (2017-10-03) |
@@ -12,3 +12,3 @@ import { Promise } from 'q'; | ||
findById(req: any, res: Response, exQueryBuilder?: (DocumentQuery) => DocumentQuery<any, any>): void; | ||
restrictedQueryBuilderFactory(grant: any, user: any, exQueryBuilder: any): () => (query: any) => any; | ||
restrictedQueryBuilderFactory(grant: any, user: any, exQueryBuilder?: any): () => (query: any) => any; | ||
update(req: any, res: Response): void; | ||
@@ -15,0 +15,0 @@ patch(req: any, res: Response): void; |
@@ -51,4 +51,5 @@ "use strict"; | ||
var restrictedQueryBuilder = function (query) { | ||
var organizationCode = user.organization && user.organization.ref ? user.organization.ref.code : undefined; | ||
return functions_utils_1.now(query) | ||
.then(promise_grants_utils_1.ifGrantedForOwn(grant, base_query_builder_1.restrictByOwner(grant.ownerTypes, user._id, user.organization && user.organization.ref.code))) | ||
.then(promise_grants_utils_1.ifGrantedForOwn(grant, base_query_builder_1.restrictByOwner(grant.ownerTypes, user._id, organizationCode))) | ||
.then(promise_grants_utils_1.ifDefined(exQueryBuilder)) | ||
@@ -64,3 +65,4 @@ .value(); | ||
return Q.when() | ||
.then(self.findBydId(req.params.id, req.user, grant)) | ||
.then(self.restrictedQueryBuilderFactory(grant, user)) | ||
.then(base_query_builder_1.execFindByIdWithQueryBuilder(self.model, req.params.id)) | ||
.then(controller_utils_1.handleEntityNotFound(res)) | ||
@@ -74,3 +76,4 @@ .then(entity_utils_1.applyUpdate(req.body)); | ||
return Q.when() | ||
.then(self.findBydId(req.params.id, req.user, grant)) | ||
.then(self.restrictedQueryBuilderFactory(grant, user)) | ||
.then(base_query_builder_1.execFindByIdWithQueryBuilder(self.model, req.params.id)) | ||
.then(controller_utils_1.handleEntityNotFound(res)) | ||
@@ -84,3 +87,4 @@ .then(entity_utils_1.applyPatch(req.body)); | ||
return Q.when() | ||
.then(self.findBydId(req.params.id, user, grant)) | ||
.then(self.restrictedQueryBuilderFactory(grant, user)) | ||
.then(base_query_builder_1.execFindByIdWithQueryBuilder(self.model, req.params.id)) | ||
.then(controller_utils_1.handleEntityNotFound(res)) | ||
@@ -87,0 +91,0 @@ .then(entity_utils_1.removeEntity()) |
import { CrudAccessControl } from './access-control.authorization'; | ||
import { Promise } from 'q'; | ||
export declare function crudAccessControlWithOrgRolesFactory(resource: any, grants: any): Promise<CrudAccessControl>; |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ import { AccessControl, Permission } from 'accesscontrol'; |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ "use strict"; |
export declare function checkAuthorization(op: any, req: any): (entity: any) => any; | ||
export declare function restrictByUser(req: any): (query: any) => any; |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ import { Request, Response } from 'express'; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ export * from './logger'; |
@@ -0,0 +0,0 @@ "use strict"; |
declare const l: any; | ||
export default l; |
@@ -0,0 +0,0 @@ "use strict"; |
export declare function OwnerSchemaFactory(): any; |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ /** |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ /** |
@@ -0,0 +0,0 @@ 'use strict'; |
declare var assert: any; |
@@ -0,0 +0,0 @@ var assert = require('assert'); |
@@ -0,0 +0,0 @@ import { Model, Document, DocumentQuery } from 'mongoose'; |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ import { Response } from 'express'; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ import { Model, Document } from 'mongoose'; |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ export declare function concatFunctions(firstFnc: any, secondFnc: any): any; |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ import { Grant } from '../crud/access-control.authorization'; |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ "use strict"; |
{ | ||
"name": "rhases-nodejs-commons", | ||
"version": "0.2.19", | ||
"version": "0.2.20", | ||
"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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
6
63667
44
1450