conjur-asset-ui 1.4.2 → 1.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +8 -3
- data/CHANGELOG.md +10 -0
- data/Makefile +19 -0
- data/README.md +0 -3
- data/Rakefile +22 -17
- data/TODO.md +0 -23
- data/app/.csscomb.json +304 -0
- data/app/.eslintignore +3 -0
- data/app/.eslintrc +265 -0
- data/app/config/preprocessor.js +19 -0
- data/app/config/webpack.js +124 -0
- data/app/gulpfile.js +96 -0
- data/app/package.json +86 -0
- data/app/src/actions.js +550 -0
- data/app/src/app.js +83 -0
- data/app/src/clients/audit.js +34 -0
- data/app/src/clients/auth.js +24 -0
- data/app/src/clients/generic.js +52 -0
- data/app/src/clients/graph.js +7 -0
- data/app/src/clients/layer_members.js +18 -0
- data/app/src/clients/list.js +31 -0
- data/app/src/clients/members.js +20 -0
- data/app/src/clients/request.js +531 -0
- data/app/src/clients/search.js +5 -0
- data/app/src/components/app/__tests__/app-test.js +22 -0
- data/app/src/components/app/app.js +36 -0
- data/app/src/components/app/wrapper.js +17 -0
- data/app/src/components/audit/__tests__/table_header-test.js +22 -0
- data/app/src/components/audit/box.js +9 -0
- data/app/src/components/audit/constants.js +5 -0
- data/app/src/components/audit/entry.js +105 -0
- data/app/src/components/audit/fields_mixin.js +11 -0
- data/app/src/components/audit/humanize_event.js +213 -0
- data/app/src/components/audit/table.js +64 -0
- data/app/src/components/audit/table_header.js +37 -0
- data/app/src/components/audit/timestamp.js +28 -0
- data/app/src/components/auth/login.js +177 -0
- data/app/src/components/auth/login.less +71 -0
- data/app/src/components/auth/logout.js +42 -0
- data/app/src/components/auth/logout.less +21 -0
- data/app/src/components/chart/chart.js +540 -0
- data/app/src/components/chart/chart_helper_mixin.js +78 -0
- data/app/src/components/custom/list.js +3 -0
- data/app/src/components/custom/view.js +81 -0
- data/app/src/components/dashboard/activity.js +144 -0
- data/app/src/components/dashboard/dashboard.js +46 -0
- data/app/src/components/flash/flash.js +98 -0
- data/app/src/components/flash/flash.less +3 -0
- data/app/src/components/generic/__tests__/time-test.js +42 -0
- data/app/src/components/generic/annotations.js +39 -0
- data/app/src/components/generic/breadcrumbs.js +57 -0
- data/app/src/components/generic/foldable_audit_section.js +204 -0
- data/app/src/components/generic/list.js +141 -0
- data/app/src/components/generic/list_factory.js +41 -0
- data/app/src/components/generic/resource_link.js +64 -0
- data/app/src/components/generic/role_link.js +66 -0
- data/app/src/components/generic/tab_mixin.js +146 -0
- data/app/src/components/generic/time.js +32 -0
- data/app/src/components/graph/__tests__/collapse-test.js +133 -0
- data/app/src/components/graph/__tests__/edges-from-vertices-test.js +48 -0
- data/app/src/components/graph/__tests__/new-vertex-set-test.js +16 -0
- data/app/src/components/graph/__tests__/next-id-test.js +27 -0
- data/app/src/components/graph/__tests__/role-kind-from-id-test.js +24 -0
- data/app/src/components/graph/__tests__/vertices-from-edges-test.js +72 -0
- data/app/src/components/graph/graph.js +449 -0
- data/app/src/components/graph/graph.less +39 -0
- data/app/src/components/graph/helpers.js +368 -0
- data/app/src/components/group/list.js +3 -0
- data/app/src/components/group/view.js +153 -0
- data/app/src/components/host/activity.js +111 -0
- data/app/src/components/host/details.js +28 -0
- data/app/src/components/host/executors.js +77 -0
- data/app/src/components/host/host_link.js +18 -0
- data/app/src/components/host/list.js +3 -0
- data/app/src/components/host/updaters.js +77 -0
- data/app/src/components/host/view.js +145 -0
- data/app/src/components/layer/list.js +3 -0
- data/app/src/components/layer/view.js +197 -0
- data/app/src/components/navbar/__tests__/navbar-test.js +21 -0
- data/app/src/components/navbar/nav_search_form.js +40 -0
- data/app/src/components/navbar/navbar.js +96 -0
- data/app/src/components/notfound/notfound.js +35 -0
- data/app/src/components/notfound/notfound.less +21 -0
- data/app/src/components/owned_resources/owned_resources.js +84 -0
- data/app/src/components/owned_resources/owned_resources_box.js +101 -0
- data/app/src/components/permissions/permissions.js +138 -0
- data/app/src/components/permissions/permissions_table.js +101 -0
- data/app/src/components/policy/list.js +3 -0
- data/app/src/components/policy/view.js +107 -0
- data/app/src/components/refresh/refresh.js +29 -0
- data/app/src/components/refresh/refresh.less +15 -0
- data/app/src/components/search/group.js +43 -0
- data/app/src/components/search/group_heading.js +50 -0
- data/app/src/components/search/group_title.js +37 -0
- data/app/src/components/search/result_item.js +55 -0
- data/app/src/components/search/search.js +118 -0
- data/app/src/components/user/activity.js +112 -0
- data/app/src/components/user/details.js +30 -0
- data/app/src/components/user/list.js +3 -0
- data/app/src/components/user/pubkeys.js +118 -0
- data/app/src/components/user/pubkeys.less +56 -0
- data/app/src/components/user/view.js +143 -0
- data/app/src/components/variable/activity.js +101 -0
- data/app/src/components/variable/details.js +46 -0
- data/app/src/components/variable/fetchers.js +77 -0
- data/app/src/components/variable/list.js +3 -0
- data/app/src/components/variable/updaters.js +77 -0
- data/app/src/components/variable/view.js +115 -0
- data/app/src/constants.js +36 -0
- data/{public → app/src}/images/conjur-logo.svg +0 -0
- data/{public → app/src}/images/icon-client-pc.svg +0 -0
- data/{public → app/src}/images/icon-environment.png +0 -0
- data/{public → app/src}/images/icon-person.svg +0 -0
- data/{public → app/src}/images/icon-policy.png +0 -0
- data/{public → app/src}/images/icon-resource.png +0 -0
- data/{public → app/src}/images/icon-service-dots.svg +0 -0
- data/{public → app/src}/images/icon-variable.png +0 -0
- data/app/src/pages/index.html +27 -0
- data/app/src/routes.js +64 -0
- data/app/src/stores/app_store.js +35 -0
- data/app/src/stores/audit_store.js +143 -0
- data/app/src/stores/graph_store.js +51 -0
- data/app/src/stores/group_store.js +104 -0
- data/app/src/stores/host_store.js +111 -0
- data/app/src/stores/layer_store.js +115 -0
- data/app/src/stores/policy_store.js +88 -0
- data/app/src/stores/resources_store.js +115 -0
- data/app/src/stores/route_store.js +21 -0
- data/app/src/stores/search_store.js +77 -0
- data/app/src/stores/user_store.js +109 -0
- data/app/src/stores/variable_store.js +93 -0
- data/app/src/styles/bootstrap.less +54 -0
- data/{public/css → app/src/styles}/styles.less +26 -82
- data/app/src/utils.js +38 -0
- data/app/src/vendor/pace.js +2 -0
- data/conjur-asset-ui.gemspec +3 -4
- data/docker/assets-build/Dockerfile +12 -0
- data/docker/conjur-ui/Dockerfile +33 -0
- data/docker/conjur-ui/README.md +38 -0
- data/docker/conjur-ui/mime.types +90 -0
- data/docker/conjur-ui/nginx.conf +110 -0
- data/docker/conjur-ui/start.py +72 -0
- data/docker/conjur-ui/start.sh +18 -0
- data/docker/conjur-ui/test.env +8 -0
- data/lib/conjur-asset-ui-version.rb +1 -1
- data/lib/conjur/command/ui.rb +10 -2
- data/lib/conjur/webserver/home.rb +3 -3
- data/lib/conjur/webserver/login.rb +1 -1
- data/lib/conjur/webserver/server.rb +16 -4
- data/public/js/views/roleGraph.js +91 -0
- metadata +167 -105
- data/.jshintrc +0 -41
- data/bower.json +0 -98
- data/gulpfile.js +0 -139
- data/package.json +0 -47
- data/preprocessor.js +0 -7
- data/public/_client_libs.html +0 -9
- data/public/index.html.erb +0 -63
- data/public/js/init.js +0 -196
- data/public/js/lib/pace.js +0 -2
- data/public/js/lib/sorted-set.no-require.js +0 -1145
- data/public/js/lib/sorted-set.no-require.js.txt +0 -6
- data/public/js/models/groupRecord.js +0 -72
- data/public/js/models/hostRecord.js +0 -60
- data/public/js/models/layerRecord.js +0 -79
- data/public/js/models/namespace.js +0 -12
- data/public/js/models/policyList.js +0 -16
- data/public/js/models/policyRecord.js +0 -54
- data/public/js/models/record.js +0 -117
- data/public/js/models/resourceList.js +0 -87
- data/public/js/models/userList.js +0 -25
- data/public/js/models/userRecord.js +0 -75
- data/public/js/models/variableList.js +0 -27
- data/public/js/models/variableRecord.js +0 -77
- data/public/js/routers.js +0 -242
- data/public/js/views/annotations.js +0 -47
- data/public/js/views/audit.js +0 -369
- data/public/js/views/breadcrumbs.js +0 -62
- data/public/js/views/chart.js +0 -617
- data/public/js/views/dashboard.js +0 -146
- data/public/js/views/generic.js +0 -122
- data/public/js/views/group.js +0 -109
- data/public/js/views/groups.js +0 -26
- data/public/js/views/host.js +0 -200
- data/public/js/views/hosts.js +0 -26
- data/public/js/views/layer.js +0 -146
- data/public/js/views/layers.js +0 -26
- data/public/js/views/mixins/search.js +0 -22
- data/public/js/views/mixins/tabs.js +0 -154
- data/public/js/views/namespaces.js +0 -40
- data/public/js/views/navSearch.js +0 -36
- data/public/js/views/owned.js +0 -184
- data/public/js/views/permissions.js +0 -254
- data/public/js/views/policies.js +0 -26
- data/public/js/views/policy.js +0 -70
- data/public/js/views/resource.js +0 -59
- data/public/js/views/role.js +0 -63
- data/public/js/views/searchResults.js +0 -212
- data/public/js/views/sections.js +0 -226
- data/public/js/views/time.js +0 -39
- data/public/js/views/user.js +0 -297
- data/public/js/views/users.js +0 -26
- data/public/js/views/variable.js +0 -310
- data/public/js/views/variables.js +0 -26
- data/spec/javascripts/helpers/.gitkeep +0 -0
- data/spec/javascripts/support/jasmine.yml +0 -112
- data/spec/javascripts/support/jasmine_helper.rb +0 -22
- data/spec/javascripts/support/run.html.erb +0 -23
- data/spec/javascripts/views/AuditSpec.js +0 -22
- data/spec/javascripts/views/AuditSpec.ls +0 -18
@@ -1,72 +0,0 @@
|
|
1
|
-
/* global conjur, jQuery, async */
|
2
|
-
|
3
|
-
(function(conjur, $, async, errback) {
|
4
|
-
'use strict';
|
5
|
-
|
6
|
-
var Generic = this.Generic;
|
7
|
-
|
8
|
-
var Group = this.Group = function(args) {
|
9
|
-
if (!(this instanceof Group)) {
|
10
|
-
return new Group(args);
|
11
|
-
}
|
12
|
-
|
13
|
-
var superArguments = Array.prototype.slice.call(arguments);
|
14
|
-
superArguments.unshift('group');
|
15
|
-
Generic.apply(this, superArguments);
|
16
|
-
|
17
|
-
return undefined;
|
18
|
-
};
|
19
|
-
|
20
|
-
Group.prototype = Object.create(Generic.prototype);
|
21
|
-
Group.prototype.constructor = Group;
|
22
|
-
|
23
|
-
Group.prototype.fetch = function(callback, customErrback) {
|
24
|
-
var id = this.id;
|
25
|
-
|
26
|
-
if (typeof(customErrback) === 'undefined') {
|
27
|
-
customErrback = errback; // reset to default
|
28
|
-
}
|
29
|
-
|
30
|
-
async.parallel([
|
31
|
-
this.attributes.bind(this),
|
32
|
-
this.ownedResources.bind(this),
|
33
|
-
function(cb) {
|
34
|
-
$.ajax({
|
35
|
-
url: '/api/authz/' +
|
36
|
-
conjur.app.configuration.account +
|
37
|
-
'/roles/group/' +
|
38
|
-
id +
|
39
|
-
'?members',
|
40
|
-
success: function(result) {
|
41
|
-
cb(null, result);
|
42
|
-
},
|
43
|
-
error: cb
|
44
|
-
});
|
45
|
-
},
|
46
|
-
this.allRoles.bind(this),
|
47
|
-
this.resource.bind(this)
|
48
|
-
], function(err, results) {
|
49
|
-
if (err) {
|
50
|
-
return customErrback(err.status);
|
51
|
-
}
|
52
|
-
|
53
|
-
callback({
|
54
|
-
group: results[0],
|
55
|
-
owned: results[1],
|
56
|
-
members: results[2],
|
57
|
-
roles: results[3],
|
58
|
-
annotations: results[4].annotations,
|
59
|
-
owner: results[4].owner
|
60
|
-
});
|
61
|
-
|
62
|
-
return undefined;
|
63
|
-
});
|
64
|
-
};
|
65
|
-
|
66
|
-
}).bind(conjur.models.Record)
|
67
|
-
(
|
68
|
-
conjur,
|
69
|
-
jQuery,
|
70
|
-
async,
|
71
|
-
conjur.utils.errback
|
72
|
-
);
|
@@ -1,60 +0,0 @@
|
|
1
|
-
/* global conjur, async */
|
2
|
-
|
3
|
-
(function(conjur, async, errback) {
|
4
|
-
'use strict';
|
5
|
-
|
6
|
-
var Generic = this.Generic;
|
7
|
-
|
8
|
-
var Host = this.Host = function(args) {
|
9
|
-
if (!(this instanceof Host)) {
|
10
|
-
return new Host(args);
|
11
|
-
}
|
12
|
-
|
13
|
-
var superArguments = Array.prototype.slice.call(arguments);
|
14
|
-
superArguments.unshift('host');
|
15
|
-
Generic.apply(this, superArguments);
|
16
|
-
|
17
|
-
return undefined;
|
18
|
-
};
|
19
|
-
|
20
|
-
Host.prototype = Object.create(Generic.prototype);
|
21
|
-
Host.prototype.constructor = Host;
|
22
|
-
|
23
|
-
Host.prototype.fetch = function(callback, customErrback) {
|
24
|
-
var self = this;
|
25
|
-
|
26
|
-
if (typeof(customErrback) === 'undefined') {
|
27
|
-
customErrback = errback; // reset to default
|
28
|
-
}
|
29
|
-
|
30
|
-
async.parallel([
|
31
|
-
this.attributes.bind(this),
|
32
|
-
this.ownedResources.bind(this),
|
33
|
-
this.allRoles.bind(this),
|
34
|
-
this.resource.bind(this),
|
35
|
-
this.auditRole.bind(this),
|
36
|
-
this.auditResource.bind(this)
|
37
|
-
], function(err, results) {
|
38
|
-
if (err) {
|
39
|
-
return customErrback(err.status);
|
40
|
-
}
|
41
|
-
|
42
|
-
callback({
|
43
|
-
host: results[0],
|
44
|
-
owned: results[1],
|
45
|
-
roles: results[2],
|
46
|
-
annotations: results[3].annotations,
|
47
|
-
owner: results[3].owner,
|
48
|
-
audit: self.mergeAudit(results[4], results[5])
|
49
|
-
});
|
50
|
-
|
51
|
-
return undefined;
|
52
|
-
});
|
53
|
-
};
|
54
|
-
|
55
|
-
}).bind(conjur.models.Record)
|
56
|
-
(
|
57
|
-
conjur,
|
58
|
-
async,
|
59
|
-
conjur.utils.errback
|
60
|
-
);
|
@@ -1,79 +0,0 @@
|
|
1
|
-
/* global conjur, jQuery, _, async */
|
2
|
-
|
3
|
-
(function(conjur, $, _, async, errback) {
|
4
|
-
'use strict';
|
5
|
-
|
6
|
-
var Generic = this.Generic;
|
7
|
-
|
8
|
-
var Layer = this.Layer = function(args) {
|
9
|
-
if (!(this instanceof Layer)) {
|
10
|
-
return new Layer(args);
|
11
|
-
}
|
12
|
-
|
13
|
-
var superArguments = Array.prototype.slice.call(arguments);
|
14
|
-
superArguments.unshift('layer');
|
15
|
-
Generic.apply(this, superArguments);
|
16
|
-
|
17
|
-
return undefined;
|
18
|
-
};
|
19
|
-
|
20
|
-
Layer.prototype = Object.create(Generic.prototype);
|
21
|
-
Layer.prototype.constructor = Layer;
|
22
|
-
|
23
|
-
Layer.prototype.fetch = function(callback, customErrback) {
|
24
|
-
var id = this.id;
|
25
|
-
|
26
|
-
if (typeof(customErrback) === 'undefined') {
|
27
|
-
customErrback = errback; // reset to default
|
28
|
-
}
|
29
|
-
|
30
|
-
function members(role) {
|
31
|
-
return function(cb) {
|
32
|
-
$.ajax({
|
33
|
-
url: '/api/authz/' +
|
34
|
-
conjur.app.configuration.account +
|
35
|
-
'/roles/' +
|
36
|
-
role +
|
37
|
-
'?members',
|
38
|
-
success: function(result) {
|
39
|
-
cb(null, result);
|
40
|
-
},
|
41
|
-
error: cb
|
42
|
-
});
|
43
|
-
};
|
44
|
-
}
|
45
|
-
|
46
|
-
async.parallel([
|
47
|
-
this.attributes.bind(this),
|
48
|
-
this.ownedResources.bind(this),
|
49
|
-
members('@/layer/' + id + '/use_host'),
|
50
|
-
members('@/layer/' + id + '/admin_host'),
|
51
|
-
this.allRoles.bind(this),
|
52
|
-
this.resource.bind(this)
|
53
|
-
], function(err, results) {
|
54
|
-
if (err) {
|
55
|
-
return customErrback(err.status);
|
56
|
-
}
|
57
|
-
|
58
|
-
callback({
|
59
|
-
layer: results[0],
|
60
|
-
owned: results[1],
|
61
|
-
users: _.pluck(results[2], 'member'),
|
62
|
-
admins: _.pluck(results[3], 'member'),
|
63
|
-
roles: results[4],
|
64
|
-
annotations: results[5].annotations,
|
65
|
-
owner: results[5].owner
|
66
|
-
});
|
67
|
-
|
68
|
-
return undefined;
|
69
|
-
});
|
70
|
-
};
|
71
|
-
|
72
|
-
}).bind(conjur.models.Record)
|
73
|
-
(
|
74
|
-
conjur,
|
75
|
-
jQuery,
|
76
|
-
_,
|
77
|
-
async,
|
78
|
-
conjur.utils.errback
|
79
|
-
);
|
@@ -1,16 +0,0 @@
|
|
1
|
-
/* global conjur */
|
2
|
-
|
3
|
-
(function(conjur) {
|
4
|
-
'use strict';
|
5
|
-
|
6
|
-
conjur.models.PolicyList = function() {
|
7
|
-
var options = {
|
8
|
-
namespaceSelector: function() {
|
9
|
-
return null;
|
10
|
-
}
|
11
|
-
};
|
12
|
-
|
13
|
-
return conjur.models.ResourceList('policy', options);
|
14
|
-
};
|
15
|
-
|
16
|
-
})(conjur);
|
@@ -1,54 +0,0 @@
|
|
1
|
-
/* global conjur, async */
|
2
|
-
|
3
|
-
(function(conjur, async, errback) {
|
4
|
-
'use strict';
|
5
|
-
|
6
|
-
var Generic = this.Generic;
|
7
|
-
|
8
|
-
var Policy = this.Policy = function(args) {
|
9
|
-
if (!(this instanceof Policy)) {
|
10
|
-
return new Policy(args);
|
11
|
-
}
|
12
|
-
|
13
|
-
var superArguments = Array.prototype.slice.call(arguments);
|
14
|
-
superArguments.unshift('policy');
|
15
|
-
Generic.apply(this, superArguments);
|
16
|
-
|
17
|
-
return undefined;
|
18
|
-
};
|
19
|
-
|
20
|
-
Policy.prototype = Object.create(Generic.prototype);
|
21
|
-
Policy.prototype.constructor = Policy;
|
22
|
-
|
23
|
-
Policy.prototype.fetch = function(callback, customErrback) {
|
24
|
-
if (typeof(customErrback) === 'undefined') {
|
25
|
-
customErrback = errback; // reset to default
|
26
|
-
}
|
27
|
-
|
28
|
-
async.parallel([
|
29
|
-
this.resource.bind(this),
|
30
|
-
this.ownedResources.bind(this),
|
31
|
-
this.allRoles.bind(this)
|
32
|
-
], function(err, results) {
|
33
|
-
if (err) {
|
34
|
-
return customErrback(err.status);
|
35
|
-
}
|
36
|
-
|
37
|
-
callback({
|
38
|
-
policy: results[0],
|
39
|
-
owned: results[1],
|
40
|
-
roles: results[2],
|
41
|
-
annotations: results[0].annotations,
|
42
|
-
owner: results[0].owner
|
43
|
-
});
|
44
|
-
|
45
|
-
return undefined;
|
46
|
-
});
|
47
|
-
};
|
48
|
-
|
49
|
-
}).bind(conjur.models.Record)
|
50
|
-
(
|
51
|
-
conjur,
|
52
|
-
async,
|
53
|
-
conjur.utils.errback
|
54
|
-
);
|
data/public/js/models/record.js
DELETED
@@ -1,117 +0,0 @@
|
|
1
|
-
/* global conjur, jQuery, _ */
|
2
|
-
|
3
|
-
(function(conjur, $, errback, _) {
|
4
|
-
'use strict';
|
5
|
-
|
6
|
-
var Generic = this.Generic = function(kind, id) {
|
7
|
-
this.kind = kind;
|
8
|
-
this.id = id;
|
9
|
-
};
|
10
|
-
|
11
|
-
function ajax(url, callback, err) {
|
12
|
-
$.ajax({
|
13
|
-
url: url,
|
14
|
-
success: function(data) {
|
15
|
-
callback(null, data);
|
16
|
-
},
|
17
|
-
error: err || callback
|
18
|
-
});
|
19
|
-
}
|
20
|
-
|
21
|
-
Generic.prototype.attributes = function(callback) {
|
22
|
-
var id = this.id;
|
23
|
-
|
24
|
-
ajax('/api/'+
|
25
|
-
conjur.utils.pluralize(this.kind) +
|
26
|
-
'/' +
|
27
|
-
window.encodeURIComponent(id),
|
28
|
-
callback);
|
29
|
-
};
|
30
|
-
|
31
|
-
Generic.prototype.auditRole = function(callback) {
|
32
|
-
var id = this.id;
|
33
|
-
|
34
|
-
ajax('/api/audit/roles/' +
|
35
|
-
window.encodeURIComponent(conjur.app.configuration.account +
|
36
|
-
':' + this.kind + ':' + id),
|
37
|
-
callback,
|
38
|
-
function() {
|
39
|
-
return callback(null, []);
|
40
|
-
});
|
41
|
-
};
|
42
|
-
|
43
|
-
Generic.prototype.auditResource = function(callback) {
|
44
|
-
var id = this.id;
|
45
|
-
|
46
|
-
ajax('/api/audit/resources/' +
|
47
|
-
window.encodeURIComponent(conjur.app.configuration.account +
|
48
|
-
':' + this.kind + ':' + id),
|
49
|
-
callback,
|
50
|
-
function() {
|
51
|
-
return callback(null, []);
|
52
|
-
});
|
53
|
-
};
|
54
|
-
|
55
|
-
Generic.prototype.mergeAudit = function(d1, d2) {
|
56
|
-
return _.uniq(d1.concat(d2), function(item, key, a) {
|
57
|
-
return item.id;
|
58
|
-
});
|
59
|
-
};
|
60
|
-
|
61
|
-
Generic.prototype.resource = function(callback) {
|
62
|
-
ajax('/api/authz/' +
|
63
|
-
conjur.app.configuration.account +
|
64
|
-
'/resources/' +
|
65
|
-
this.kind +
|
66
|
-
'/' +
|
67
|
-
window.encodeURIComponent(this.id),
|
68
|
-
callback);
|
69
|
-
};
|
70
|
-
|
71
|
-
Generic.prototype.ownedResources = function(callback) {
|
72
|
-
var roleid = [this.kind, this.id].join(':');
|
73
|
-
|
74
|
-
ajax('/api/authz/' +
|
75
|
-
conjur.app.configuration.account +
|
76
|
-
'/resources?owner=' +
|
77
|
-
roleid,
|
78
|
-
function(err, result) {
|
79
|
-
if (typeof result.filter === 'function') {
|
80
|
-
result = result.filter(function(item) {
|
81
|
-
// assets of 'secret' kind are internal
|
82
|
-
return item.id.split(':')[1] !== 'secret';
|
83
|
-
});
|
84
|
-
}
|
85
|
-
|
86
|
-
callback(err, result);
|
87
|
-
});
|
88
|
-
};
|
89
|
-
|
90
|
-
Generic.prototype.allRoles = function(callback) {
|
91
|
-
ajax('/api/authz/' +
|
92
|
-
conjur.app.configuration.account +
|
93
|
-
'/roles/' +
|
94
|
-
window.encodeURIComponent(this.kind) +
|
95
|
-
'/' +
|
96
|
-
window.encodeURIComponent(this.id) +
|
97
|
-
'?all',
|
98
|
-
callback);
|
99
|
-
};
|
100
|
-
|
101
|
-
Generic.prototype.fetch = function(callback) {
|
102
|
-
this.attributes(function(err, data) {
|
103
|
-
if (err) {
|
104
|
-
return errback(err);
|
105
|
-
}
|
106
|
-
|
107
|
-
return callback(data);
|
108
|
-
});
|
109
|
-
};
|
110
|
-
|
111
|
-
}).bind(conjur.models.Record)
|
112
|
-
(
|
113
|
-
conjur,
|
114
|
-
jQuery,
|
115
|
-
conjur.utils.errback,
|
116
|
-
_
|
117
|
-
);
|
@@ -1,87 +0,0 @@
|
|
1
|
-
/* global conjur, jQuery, _ */
|
2
|
-
|
3
|
-
(function(conjur, $, _) {
|
4
|
-
'use strict';
|
5
|
-
|
6
|
-
this.ResourceList = function(kind, options) {
|
7
|
-
var List = function() {
|
8
|
-
this._members = null;
|
9
|
-
this.namespaces = null;
|
10
|
-
this.options = options || {};
|
11
|
-
|
12
|
-
if (!this.options.idSelector) {
|
13
|
-
this.options.idSelector = function(member) {
|
14
|
-
var idTokens = member.id.split(':');
|
15
|
-
|
16
|
-
return idTokens[idTokens.length-1];
|
17
|
-
};
|
18
|
-
}
|
19
|
-
|
20
|
-
if (!this.options.namespaceSelector) {
|
21
|
-
this.options.namespaceSelector = function(member) {
|
22
|
-
return member.identifier.split('/')[0];
|
23
|
-
};
|
24
|
-
}
|
25
|
-
};
|
26
|
-
|
27
|
-
List.prototype.members = function(namespace) {
|
28
|
-
var result;
|
29
|
-
|
30
|
-
if (namespace === '') {
|
31
|
-
result = _.clone(this._members);
|
32
|
-
} else {
|
33
|
-
result = this._members.filter(function(o) {
|
34
|
-
return this.options.namespaceSelector(o) === namespace;
|
35
|
-
}.bind(this));
|
36
|
-
}
|
37
|
-
|
38
|
-
return result.sort(function(a, b) {
|
39
|
-
return a.identifier.localeCompare(b.identifier);
|
40
|
-
});
|
41
|
-
};
|
42
|
-
|
43
|
-
List.prototype.fetch = function(callback) {
|
44
|
-
if (this._members) {
|
45
|
-
return callback(this);
|
46
|
-
}
|
47
|
-
|
48
|
-
var self = this;
|
49
|
-
|
50
|
-
$.ajax({
|
51
|
-
url: '/api/authz/' +
|
52
|
-
window.encodeURIComponent(conjur.app.configuration.account) +
|
53
|
-
'/resources/' +
|
54
|
-
window.encodeURIComponent(kind),
|
55
|
-
success: function(data) {
|
56
|
-
var filter = this.options.filter;
|
57
|
-
|
58
|
-
if (filter) {
|
59
|
-
data = _.filter(data, filter);
|
60
|
-
}
|
61
|
-
|
62
|
-
self._members = data;
|
63
|
-
|
64
|
-
self._members.forEach(function(member) {
|
65
|
-
member.identifier = this.options.idSelector(member);
|
66
|
-
}.bind(this));
|
67
|
-
|
68
|
-
self.namespaces = _.unique(
|
69
|
-
self._members.map(this.options.namespaceSelector)
|
70
|
-
).sort();
|
71
|
-
|
72
|
-
callback(self);
|
73
|
-
}.bind(this)
|
74
|
-
});
|
75
|
-
|
76
|
-
return undefined;
|
77
|
-
};
|
78
|
-
|
79
|
-
return new List();
|
80
|
-
};
|
81
|
-
|
82
|
-
}).bind(conjur.models)
|
83
|
-
(
|
84
|
-
conjur,
|
85
|
-
jQuery,
|
86
|
-
_
|
87
|
-
);
|