Sha256: ef736ca9451873fd4ba139eb60ae70254b459f2bc9a616b42f7bcb930d734136

Contents?: true

Size: 1.32 KB

Versions: 2

Compression:

Stored size: 1.32 KB

Contents

(function(conjur, async, errback) {
    'use strict';

    var Generic = this.Generic;

    var Policy = this.Policy = function(args) {
        if (!(this instanceof Policy)) {
            return new Policy(args);
        }

        var superArguments = Array.prototype.slice.call(arguments);
        superArguments.unshift('policy');
        Generic.apply(this, superArguments);

        return undefined;
    };

    Policy.prototype = Object.create(Generic.prototype);
    Policy.prototype.constructor = Policy;

    Policy.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.resource.bind(this),
            this.ownedResources.bind(this),
            this.allRoles.bind(this)
        ], function(err, results) {
            if (err) {
                return custom_errback(err.status);
            }

            callback({
                policy: results[0],
                owned: results[1],
                roles: results[2],
                annotations: results[0].annotations
            });

            return undefined;
        });
    };

}).bind(conjur.models.Record)
(
    conjur,
    async,
    conjur.utils.errback
);

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
conjur-asset-ui-1.3.2 public/js/models/policyRecord.js
conjur-asset-ui-1.3.0 public/js/models/policyRecord.js