public/js/models/userRecord.js in conjur-asset-ui-1.3.1 vs public/js/models/userRecord.js in conjur-asset-ui-1.3.2

- old
+ new

@@ -1,7 +1,5 @@ -/* global conjur, jQuery, async */ - (function(conjur, $, async, errback) { 'use strict'; var Generic = this.Generic; @@ -18,11 +16,11 @@ }; User.prototype = Object.create(Generic.prototype); User.prototype.constructor = User; - User.prototype.publicKeys = function(callback) { + User.prototype.publicKeys = function(callback, custom_errback) { $.ajax({ url: '/api/pubkeys/' + window.encodeURIComponent(this.id), success: function(data) { callback(null, data.split('\n').filter(function(d) { return d.trim().length > 0; @@ -30,23 +28,26 @@ }, error: callback }); }; - User.prototype.fetch = function(callback, customErrback) { - if (typeof(customErrback) === 'undefined') { - customErrback = errback; // reset to default + User.prototype.fetch = function(callback, custom_errback) { + var self = this, + id = this.id; + + if (typeof(custom_errback) === 'undefined') { + custom_errback = errback; // reset to default } async.parallel([ this.attributes.bind(this), this.ownedResources.bind(this), this.allRoles.bind(this), this.resource.bind(this), this.publicKeys.bind(this) ], function(err, results) { if (err) { - return customErrback(err.status); + return custom_errback(err.status); } callback({ user: results[0], owned: results[1],