Sha256: 27403982bb32d2bbf4dc1c528c19c32ba347539e221564b4be8568c1fd5a65c0

Contents?: true

Size: 893 Bytes

Versions: 1

Compression:

Stored size: 893 Bytes

Contents

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

Record = {};

Record.Generic = function(kind, id) {
  this.kind = kind;
  this.id = id;
}

Record.Generic.prototype.attributes = function(callback) {
  var id = this.id;
  $.ajax({
    url: "/api/" + kind + "/" + encodeURIComponent(id),
    success: function(data) {
      callback(null, data);
    },
    error: callback
  });
}

Record.Generic.prototype.ownedResources = function(callback) {
  var id = this.id;
  var roleid = [ this.kind, this.id ].join(':')
  $.ajax({
    url: "/api/authz/" + conjurConfiguration.account + "/resources?owner=" + roleid,
    success: function(result) {
      callback(null, result);
    },
    error: callback
  });
}

Record.Generic.prototype.fetch = function(callback) {
  this.attributes(function(err, data) {
    if ( err )
      return errback(err);
    callback(data);
  });
}

Version data entries

1 entries across 1 versions & 1 rubygems

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