Sha256: cc35b42f492d360ca2c3dd9257e066390226bfac682c030ecdabf1e100305eec

Contents?: true

Size: 1.04 KB

Versions: 1

Compression:

Stored size: 1.04 KB

Contents

if (typeof $ === "undefined") { throw new Error("jQuery is required") }

Record.Variable = function(args) {
  var superArguments = Array.prototype.slice.call(arguments);
  superArguments.unshift("variable");
  Record.Generic.apply(this, superArguments);
}

Record.Variable.prototype = Object.create(Record.Generic.prototype);
Record.Variable.prototype.constructor = Record.Variable;

Record.Variable.prototype.fetch = function(callback) {
  var self = this;
  var id = this.id;

  function members(privilege) {
    return function(cb) {
      $.ajax({
        url: "/api/authz/" + conjurConfiguration.account + "/roles/allowed_to/" + privilege + "/variable/" + id,
        success: function(result) {
          cb(null, result);
        },
        error: cb
      });
    }
  } 

  async.parallel([
      this.attributes.bind(this),
      members("execute"),
      members("update")
    ],
    function(err, results) {
      if ( err ) 
        return errback(err);
      
      callback({variable: results[0], fetchers: results[1], updaters: results[2]});
  });
}

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
conjur-asset-ui-api-1.2.0 public/js/models/variableRecord.js