Sha256: 42d2a5534d712495e981728d0006fb46f335aa976e011783612fb536303ad0b9

Contents?: true

Size: 1.83 KB

Versions: 2

Compression:

Stored size: 1.83 KB

Contents

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

    var Generic = this.Generic;

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

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

        return undefined;
    };

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

    Group.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),
            function(cb) {
                $.ajax({
                    url: '/api/authz/'
                        + conjur.app.configuration.account
                        + '/roles/group/'
                        + id
                        + '?members',
                    success: function(result) {
                        cb(null, result);
                    },
                    error: cb
                });
            },
            this.allRoles.bind(this),
            this.resource.bind(this)
        ], function(err, results) {
            if (err) {
                return custom_errback(err.status);
            }

            callback({
                group: results[0],
                owned: results[1],
                members: results[2],
                roles: results[3],
                annotations: results[4].annotations
            });

            return undefined;
        });
    };

}).bind(conjur.models.Record)
(
    conjur,
    jQuery,
    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/groupRecord.js
conjur-asset-ui-1.3.0 public/js/models/groupRecord.js