Skip to content

Commit

Permalink
changed error bubbling & fatal$:false override
Browse files Browse the repository at this point in the history
  • Loading branch information
nherment committed Apr 14, 2015
1 parent f127e80 commit 98c4926
Showing 1 changed file with 6 additions and 19 deletions.
25 changes: 6 additions & 19 deletions lib/ACLMicroservicesBuilder.js
Expand Up @@ -14,8 +14,8 @@ function debug() {

function ACLMicroservicesBuilder(seneca) {
this._ACLProcedureResolver = undefined
this._seneca = seneca
this._allowedProperties = {};
this._seneca = seneca.delegate({fatal$: false})
this._allowedProperties = {}

var self = this

Expand Down Expand Up @@ -50,7 +50,7 @@ function ACLMicroservicesBuilder(seneca) {
this._executeListPermissionsWrapper = function(args, callback) {

if(args.perm$) {
debug(JSON.stringify(args))

self._executeListPermissions(args, callback)

} else {
Expand All @@ -76,7 +76,7 @@ function ACLMicroservicesBuilder(seneca) {

ACLMicroservicesBuilder.prototype.register = function(accessControls, properties) {
this._ACLProcedureResolver = AccessControlProcedure.generateActionsMapping(accessControls)
this._allowedProperties = properties;
this._allowedProperties = properties
}

ACLMicroservicesBuilder.prototype.augmentSeneca = function(seneca) {
Expand Down Expand Up @@ -404,13 +404,11 @@ function error(seneca, authDecision) {
}
}
var err = new Error(message)
err.code = ACL_ERROR_CODE
err.summary = authDecision.summary
err.details = authDecision
err.code = ACL_ERROR_CODE
err.status = 403
err.critical = false
err.httpstatus = 403
err.seneca = seneca
err.toString = selfErrorString
return err
}

Expand All @@ -429,17 +427,6 @@ function removeEntityFields(allowedFields, entity) {
return entity
}

function selfErrorString() {
var jsonReadyError = {
summary: this.summary,
message: this.message,
status: this.status,
code: this.code,
reason: this.reason
};
return JSON.stringify(jsonReadyError);
}

function extractRoles(args) {
return args.perm$.roles
}
Expand Down

0 comments on commit 98c4926

Please sign in to comment.