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
data/public/js/views/owned.js
DELETED
@@ -1,184 +0,0 @@
|
|
1
|
-
/** @jsx React.DOM */
|
2
|
-
/* global conjur, React, _ */
|
3
|
-
|
4
|
-
(function(conjur, React, _) {
|
5
|
-
'use strict';
|
6
|
-
|
7
|
-
var knownTypes = ['user', 'group', 'layer', 'host', 'variable', 'policy'];
|
8
|
-
|
9
|
-
var OwnedResourcesBox = this.OwnedResourcesBox = React.createClass({
|
10
|
-
getInitialState: function() {
|
11
|
-
return {
|
12
|
-
filter: ''
|
13
|
-
};
|
14
|
-
},
|
15
|
-
|
16
|
-
handleChange: function(e) {
|
17
|
-
e.preventDefault();
|
18
|
-
|
19
|
-
this.setState({filter: e.target.value});
|
20
|
-
},
|
21
|
-
|
22
|
-
render: function() {
|
23
|
-
var filters = [];
|
24
|
-
|
25
|
-
if (!this.props.resources) {
|
26
|
-
return (
|
27
|
-
<span>None</span>
|
28
|
-
);
|
29
|
-
}
|
30
|
-
|
31
|
-
var items = this.props.resources
|
32
|
-
.sort(function(a, b) {
|
33
|
-
// TODO: sort by kind with custom weights, by id, by creation date
|
34
|
-
// automatically gives sort by kind, id
|
35
|
-
return a.id.toLowerCase().localeCompare(b.id.toLowerCase());
|
36
|
-
}).map(function(resource) {
|
37
|
-
var kind = resource.id.split(':')[1];
|
38
|
-
|
39
|
-
filters.push(kind);
|
40
|
-
|
41
|
-
if ((this.state.filter === '') ||
|
42
|
-
(this.state.filter !== 'other' && this.state.filter === kind) ||
|
43
|
-
(this.state.filter === 'other' &&
|
44
|
-
_.intersection([kind], knownTypes).length === 0)) {
|
45
|
-
|
46
|
-
var ResourceLink = conjur.views.ResourceLink;
|
47
|
-
|
48
|
-
return (
|
49
|
-
<li className="list-group-item list-group-item-noborder">
|
50
|
-
<ResourceLink data={resource} />
|
51
|
-
</li>
|
52
|
-
);
|
53
|
-
}
|
54
|
-
|
55
|
-
return '';
|
56
|
-
}.bind(this));
|
57
|
-
|
58
|
-
var toggleButton = '';
|
59
|
-
|
60
|
-
if (!this.props.tabview) {
|
61
|
-
toggleButton = (
|
62
|
-
<div className="hide-all">
|
63
|
-
<a onClick={this.props.handler}>Hide all «</a>
|
64
|
-
</div>
|
65
|
-
);
|
66
|
-
}
|
67
|
-
|
68
|
-
var filterSelect = '';
|
69
|
-
|
70
|
-
if (this.props.resources.length > 9 || this.state.filter !== '') {
|
71
|
-
// TODO: sort, when done with previous TODO
|
72
|
-
filterSelect = _.intersection(_.uniq(filters, true), knownTypes).map(function(f) {
|
73
|
-
return (
|
74
|
-
<option value={f}>{_.str.capitalize(conjur.utils.pluralize(f))}</option>
|
75
|
-
);
|
76
|
-
});
|
77
|
-
|
78
|
-
filterSelect = (
|
79
|
-
<div className="form-group row">
|
80
|
-
<div className="col-xs-3">
|
81
|
-
<select className="form-control" type="select" ref="filter"
|
82
|
-
value={this.state.filter} onChange={this.handleChange}>
|
83
|
-
<option value="">Show all</option>
|
84
|
-
{filterSelect}
|
85
|
-
<option value="other">Other</option>
|
86
|
-
</select>
|
87
|
-
</div>
|
88
|
-
</div>
|
89
|
-
);
|
90
|
-
}
|
91
|
-
|
92
|
-
return (
|
93
|
-
<div className="owned">
|
94
|
-
{toggleButton}
|
95
|
-
{filterSelect}
|
96
|
-
<ul className="list-group">{items}</ul>
|
97
|
-
</div>
|
98
|
-
);
|
99
|
-
}
|
100
|
-
});
|
101
|
-
|
102
|
-
var OwnedResourcesSummary = React.createClass({
|
103
|
-
render: function() {
|
104
|
-
var expand = '';
|
105
|
-
|
106
|
-
if (this.props.length > 0) {
|
107
|
-
expand = (
|
108
|
-
<span>
|
109
|
-
<br/>
|
110
|
-
<span>
|
111
|
-
<a onClick={this.props.handler}>Show all »</a>
|
112
|
-
</span>
|
113
|
-
</span>
|
114
|
-
);
|
115
|
-
}
|
116
|
-
|
117
|
-
var message = '';
|
118
|
-
|
119
|
-
if (this.props.length === 0) {
|
120
|
-
message = 'none';
|
121
|
-
} else {
|
122
|
-
message = '' + this.props.length + ' things';
|
123
|
-
}
|
124
|
-
|
125
|
-
return (
|
126
|
-
<div>
|
127
|
-
<span>
|
128
|
-
{message}
|
129
|
-
</span>
|
130
|
-
{expand}
|
131
|
-
</div>
|
132
|
-
);
|
133
|
-
}
|
134
|
-
});
|
135
|
-
|
136
|
-
this.OwnedResources = React.createClass({
|
137
|
-
getInitialState: function() {
|
138
|
-
return {
|
139
|
-
expanded: false
|
140
|
-
};
|
141
|
-
},
|
142
|
-
|
143
|
-
toggle: function(e) {
|
144
|
-
e.preventDefault();
|
145
|
-
|
146
|
-
this.setState({expanded: !this.state.expanded});
|
147
|
-
},
|
148
|
-
|
149
|
-
render: function() {
|
150
|
-
var content = null;
|
151
|
-
|
152
|
-
if (this.state.expanded || this.props.tabview) {
|
153
|
-
content = (
|
154
|
-
<OwnedResourcesBox resources={this.props.owned}
|
155
|
-
handler={this.toggle}
|
156
|
-
tabview={this.props.tabview} />
|
157
|
-
);
|
158
|
-
|
159
|
-
} else {
|
160
|
-
content = (
|
161
|
-
<OwnedResourcesSummary length={this.props.owned.length}
|
162
|
-
handler={this.toggle} />
|
163
|
-
);
|
164
|
-
}
|
165
|
-
|
166
|
-
var ownedheader = this.props.tabview ? '': (<h3>Owned assets</h3>);
|
167
|
-
|
168
|
-
return (
|
169
|
-
<section className="owned row">
|
170
|
-
{ownedheader}
|
171
|
-
<div id="ownedDetails" className="col-xs-6">
|
172
|
-
{content}
|
173
|
-
</div>
|
174
|
-
</section>
|
175
|
-
);
|
176
|
-
}
|
177
|
-
});
|
178
|
-
|
179
|
-
}).bind(conjur.views)
|
180
|
-
(
|
181
|
-
conjur,
|
182
|
-
React,
|
183
|
-
_
|
184
|
-
);
|
@@ -1,254 +0,0 @@
|
|
1
|
-
/** @jsx React.DOM */
|
2
|
-
/* global conjur, React, jQuery, _ */
|
3
|
-
|
4
|
-
(function(conjur, React, $, _) {
|
5
|
-
'use strict';
|
6
|
-
|
7
|
-
var ResourceLink = conjur.views.ResourceLink,
|
8
|
-
RoleLink = conjur.views.RoleLink;
|
9
|
-
|
10
|
-
var PermissionsTable = this.PermissionsTable = React.createClass({
|
11
|
-
render: function() {
|
12
|
-
var rows = [];
|
13
|
-
|
14
|
-
var resources = _.sortBy(this.props.resources, function(r) {
|
15
|
-
return r.id; // this way it will be sorting by (kind, id)
|
16
|
-
});
|
17
|
-
|
18
|
-
resources.forEach(function(r) {
|
19
|
-
var rowspan = r.permissions.length + 1,
|
20
|
-
parts = r.id.split(':'),
|
21
|
-
kind = parts[1]; // ignore env?
|
22
|
-
|
23
|
-
var cells = [
|
24
|
-
(<td rowSpan={rowspan}> <ResourceLink id={r.id}/> </td>),
|
25
|
-
(<td rowSpan={rowspan}> {kind} </td>)
|
26
|
-
];
|
27
|
-
|
28
|
-
if (rowspan === 1) {
|
29
|
-
cells.push(<td colSpan="3"> full permissions </td>);
|
30
|
-
}
|
31
|
-
|
32
|
-
rows.push(
|
33
|
-
(<tr key={r.id}>{cells}</tr>)
|
34
|
-
);
|
35
|
-
|
36
|
-
if (rowspan > 1) {
|
37
|
-
rows.push(r.permissions.map(function(p) {
|
38
|
-
return (
|
39
|
-
<PermissionRow data={p} />
|
40
|
-
);
|
41
|
-
}));
|
42
|
-
}
|
43
|
-
|
44
|
-
});
|
45
|
-
|
46
|
-
rows = _.flatten(rows);
|
47
|
-
|
48
|
-
var showhidelink = (
|
49
|
-
<div>
|
50
|
-
<a onClick={this.props.hideHandler}>Hide all «</a>
|
51
|
-
</div>
|
52
|
-
);
|
53
|
-
|
54
|
-
if (this.props.tabview) {
|
55
|
-
showhidelink = '';
|
56
|
-
}
|
57
|
-
|
58
|
-
if (rows.length === 0) {
|
59
|
-
return (
|
60
|
-
<span>None</span>
|
61
|
-
);
|
62
|
-
}
|
63
|
-
|
64
|
-
return (
|
65
|
-
<div>
|
66
|
-
{showhidelink}
|
67
|
-
<table>
|
68
|
-
<thead>
|
69
|
-
<tr>
|
70
|
-
<th> Resource </th>
|
71
|
-
<th> Kind </th>
|
72
|
-
<th> Privilege </th>
|
73
|
-
<th> Can Grant? </th>
|
74
|
-
<th> Granted By </th>
|
75
|
-
</tr>
|
76
|
-
</thead>
|
77
|
-
<tbody>
|
78
|
-
{rows}
|
79
|
-
</tbody>
|
80
|
-
</table>
|
81
|
-
</div>
|
82
|
-
);
|
83
|
-
}
|
84
|
-
});
|
85
|
-
|
86
|
-
|
87
|
-
// Renders a permission as a tr
|
88
|
-
var PermissionRow = React.createClass({
|
89
|
-
render: function() {
|
90
|
-
var p = this.props.data;
|
91
|
-
|
92
|
-
return (
|
93
|
-
<tr>
|
94
|
-
<td>{p.privilege}</td>
|
95
|
-
<td>{p.grant_option ? 'yes' : 'no'}</td>
|
96
|
-
<td><RoleLink id={p.grantor}/></td>
|
97
|
-
</tr>
|
98
|
-
);
|
99
|
-
}
|
100
|
-
});
|
101
|
-
|
102
|
-
var PermissionsSummary = React.createClass({
|
103
|
-
render: function() {
|
104
|
-
var expand = '';
|
105
|
-
|
106
|
-
if (this.props.length > 0) {
|
107
|
-
expand = (
|
108
|
-
<span>
|
109
|
-
<br/>
|
110
|
-
<span>
|
111
|
-
<a onClick={this.props.expandHandler}>Show all »</a>
|
112
|
-
</span>
|
113
|
-
</span>
|
114
|
-
);
|
115
|
-
}
|
116
|
-
|
117
|
-
return (
|
118
|
-
<div>
|
119
|
-
<span>
|
120
|
-
{this.props.length} permissions
|
121
|
-
</span>
|
122
|
-
{expand}
|
123
|
-
</div>
|
124
|
-
);
|
125
|
-
}
|
126
|
-
});
|
127
|
-
|
128
|
-
this.Permissions = React.createClass({
|
129
|
-
getInitialState: function() {
|
130
|
-
return {resources: null, loaded: false, expand: false};
|
131
|
-
},
|
132
|
-
|
133
|
-
expand: function() {
|
134
|
-
this.setState({expand: true});
|
135
|
-
},
|
136
|
-
|
137
|
-
collapse: function() {
|
138
|
-
this.setState({expand: false});
|
139
|
-
},
|
140
|
-
|
141
|
-
componentWillMount: function() {
|
142
|
-
// shouldn't it be done in model??? otherwise it will
|
143
|
-
// re-load stuff on each re-rendering of parent block
|
144
|
-
if (this.props.roles) {
|
145
|
-
$.get(this.url(), function(data) {
|
146
|
-
this.setPermissions(data);
|
147
|
-
}.bind(this));
|
148
|
-
}
|
149
|
-
},
|
150
|
-
|
151
|
-
setPermissions: function(_resources) {
|
152
|
-
/**
|
153
|
-
* Filter out owned resources.
|
154
|
-
* Filter out permissions on resources which are not held by the current role.
|
155
|
-
*/
|
156
|
-
var resources;
|
157
|
-
|
158
|
-
if (this.props.owned) {
|
159
|
-
var ownedIds = _.pluck(this.props.owned, 'id');
|
160
|
-
|
161
|
-
resources = _resources.filter(function(r) {
|
162
|
-
return !_.contains(ownedIds, r.id);
|
163
|
-
});
|
164
|
-
} else {
|
165
|
-
resources = _resources;
|
166
|
-
}
|
167
|
-
|
168
|
-
var roleSet = {};
|
169
|
-
|
170
|
-
this.props.roles.forEach(function(r) {
|
171
|
-
roleSet[r] = r;
|
172
|
-
});
|
173
|
-
|
174
|
-
var cleanResources = resources.filter(function(item) {
|
175
|
-
// assets of 'secret' kind are internal
|
176
|
-
return item.id.split(':')[1] !== 'secret';
|
177
|
-
});
|
178
|
-
|
179
|
-
cleanResources.forEach(function(resource) {
|
180
|
-
var permissions = resource.permissions,
|
181
|
-
hasPermissions = [];
|
182
|
-
|
183
|
-
permissions.forEach(function(permission) {
|
184
|
-
if (roleSet.hasOwnProperty(permission.role)) {
|
185
|
-
hasPermissions.push(permission);
|
186
|
-
}
|
187
|
-
});
|
188
|
-
|
189
|
-
resource.permissions = hasPermissions;
|
190
|
-
});
|
191
|
-
|
192
|
-
this.setState({resources: cleanResources, loaded: true});
|
193
|
-
},
|
194
|
-
|
195
|
-
render: function() {
|
196
|
-
var content;
|
197
|
-
|
198
|
-
if (this.state.loaded) {
|
199
|
-
if (this.state.expand || this.props.tabview) {
|
200
|
-
content = (
|
201
|
-
<PermissionsTable resources={this.state.resources}
|
202
|
-
hideHandler={this.collapse}
|
203
|
-
tabview={this.props.tabview} />
|
204
|
-
);
|
205
|
-
} else {
|
206
|
-
content = (
|
207
|
-
<PermissionsSummary length={this.state.resources.length}
|
208
|
-
expandHandler={this.expand} />
|
209
|
-
);
|
210
|
-
}
|
211
|
-
} else {
|
212
|
-
if (this.props.roles) {
|
213
|
-
content = (
|
214
|
-
<span>Loading...</span>
|
215
|
-
);
|
216
|
-
} else {
|
217
|
-
content = 'You are not authorized to see these permissions';
|
218
|
-
}
|
219
|
-
}
|
220
|
-
|
221
|
-
var cx = React.addons.classSet;
|
222
|
-
|
223
|
-
var classes = cx({
|
224
|
-
permissions: true,
|
225
|
-
loading: !this.state.loaded
|
226
|
-
});
|
227
|
-
|
228
|
-
var permissionsheader = this.props.tabview ? '' : (<h3>Permissions held</h3>);
|
229
|
-
|
230
|
-
return (
|
231
|
-
<section className={classes}>
|
232
|
-
{permissionsheader}
|
233
|
-
<div id="permissionDetails">
|
234
|
-
{content}
|
235
|
-
</div>
|
236
|
-
</section>
|
237
|
-
);
|
238
|
-
},
|
239
|
-
|
240
|
-
url: function() {
|
241
|
-
return '/api/authz/' +
|
242
|
-
conjur.app.configuration.account +
|
243
|
-
'/resources?acting_as=' +
|
244
|
-
this.props.role;
|
245
|
-
}
|
246
|
-
});
|
247
|
-
|
248
|
-
}).bind(conjur.views)
|
249
|
-
(
|
250
|
-
conjur,
|
251
|
-
React,
|
252
|
-
jQuery,
|
253
|
-
_
|
254
|
-
);
|
data/public/js/views/policies.js
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
/** @jsx React.DOM */
|
2
|
-
/* global conjur, React */
|
3
|
-
|
4
|
-
(function(conjur, React) {
|
5
|
-
'use strict';
|
6
|
-
|
7
|
-
var GenericList = conjur.views.GenericList;
|
8
|
-
|
9
|
-
this.PolicyBox = React.createClass({
|
10
|
-
render: function() {
|
11
|
-
return (
|
12
|
-
<div className="policyBox">
|
13
|
-
<div className="policyList">
|
14
|
-
<h2>Policies</h2>
|
15
|
-
<GenericList data={{kind: 'policies', members: this.props.data.members}} />
|
16
|
-
</div>
|
17
|
-
</div>
|
18
|
-
);
|
19
|
-
}
|
20
|
-
});
|
21
|
-
|
22
|
-
}).bind(conjur.views)
|
23
|
-
(
|
24
|
-
conjur,
|
25
|
-
React
|
26
|
-
);
|