conjur-asset-ui 1.3.1 → 1.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -3
- data/Gemfile +1 -3
- data/README.md +0 -34
- data/Rakefile +1 -69
- data/conjur-asset-ui.gemspec +1 -1
- data/lib/conjur-asset-ui-version.rb +1 -1
- data/lib/conjur/command/ui.rb +1 -1
- data/lib/conjur/webserver/server.rb +8 -14
- data/public/_client_code.html +42 -0
- data/public/_client_libs.html +15 -2
- data/public/css/bootstrap.css +7 -0
- data/public/css/styles.less +4 -170
- data/public/fonts/glyphicons-halflings-regular.eot +0 -0
- data/public/fonts/glyphicons-halflings-regular.svg +229 -0
- data/public/fonts/glyphicons-halflings-regular.ttf +0 -0
- data/public/fonts/glyphicons-halflings-regular.woff +0 -0
- data/public/index.html.erb +7 -5
- data/public/js/init.js +97 -183
- data/public/js/lib/JSXTransformer.js +10862 -0
- data/public/js/lib/async.js +958 -0
- data/public/js/lib/backbone.js +2 -0
- data/public/js/lib/bootstrap.js +6 -0
- data/public/js/lib/less.js +16 -0
- data/public/js/lib/moment.js +7768 -0
- data/public/js/lib/react-bootstrap.js +5346 -0
- data/public/js/lib/react-bootstrap.min.js +4 -0
- data/public/js/lib/sorted-set.no-require.js +28 -3
- data/public/js/lib/underscore-min.js +6 -0
- data/public/js/lib/underscore.string.min.js +1 -0
- data/public/js/main.js +57 -0
- data/public/js/models/groupRecord.js +11 -12
- data/public/js/models/hostRecord.js +7 -6
- data/public/js/models/layerRecord.js +11 -12
- data/public/js/models/namespace.js +0 -2
- data/public/js/models/policyList.js +1 -3
- data/public/js/models/policyRecord.js +7 -6
- data/public/js/models/record.js +23 -24
- data/public/js/models/resourceList.js +10 -28
- data/public/js/models/userList.js +2 -7
- data/public/js/models/userRecord.js +8 -7
- data/public/js/models/variableList.js +7 -18
- data/public/js/models/variableRecord.js +12 -13
- data/public/js/routers.js +26 -72
- data/public/js/views/annotations.js +27 -38
- data/public/js/views/audit.js +17 -23
- data/public/js/views/dashboard.js +58 -94
- data/public/js/views/generic.js +9 -16
- data/public/js/views/group.js +55 -94
- data/public/js/views/groups.js +7 -3
- data/public/js/views/host.js +44 -75
- data/public/js/views/hosts.js +6 -2
- data/public/js/views/layer.js +82 -127
- data/public/js/views/layers.js +6 -2
- data/public/js/views/mixins/search.js +5 -12
- data/public/js/views/mixins/tabs.js +55 -95
- data/public/js/views/navSearch.js +5 -16
- data/public/js/views/owned.js +8 -14
- data/public/js/views/permissions.js +178 -244
- data/public/js/views/policies.js +4 -2
- data/public/js/views/policy.js +38 -65
- data/public/js/views/resource.js +34 -49
- data/public/js/views/role.js +37 -52
- data/public/js/views/searchResults.js +138 -205
- data/public/js/views/time.js +13 -26
- data/public/js/views/user.js +55 -178
- data/public/js/views/users.js +7 -2
- data/public/js/views/variable.js +45 -226
- data/public/js/views/variables.js +8 -4
- metadata +19 -18
- data/.jshintrc +0 -41
- data/bower.json +0 -93
- data/features/navigation_bar.feature +0 -31
- data/features/step_definitions/custom_step.rb +0 -32
- data/features/support/env.rb +0 -38
- data/features/support/hooks.rb +0 -30
- data/features/support/world.rb +0 -17
- data/gulpfile.js +0 -140
- data/package.json +0 -47
- data/preprocessor.js +0 -7
- data/public/js/views/chart.js +0 -471
@@ -1,29 +1,18 @@
|
|
1
1
|
/** @jsx React.DOM */
|
2
|
-
/* global conjur, React */
|
3
2
|
|
4
3
|
(function(conjur, React) {
|
5
4
|
'use strict';
|
6
5
|
|
7
|
-
var
|
8
|
-
|
9
|
-
this.NavSearchForm = React.createClass({
|
10
|
-
mixins: [Search],
|
6
|
+
var NavSearchForm = this.NavSearchForm = React.createClass({
|
7
|
+
mixins: [conjur.views.mixins.Search],
|
11
8
|
|
12
9
|
render: function() {
|
13
10
|
return (
|
14
|
-
<form className="form-inline navbar-form"
|
15
|
-
role="search"
|
16
|
-
onSubmit={this.handleSubmit}>
|
11
|
+
<form className="form-inline navbar-form" role="search" onSubmit={this.handleSubmit}>
|
17
12
|
<div className="form-group">
|
18
|
-
<input ref="input"
|
19
|
-
type="text"
|
20
|
-
className="form-control"
|
21
|
-
placeholder="Search Conjur"></input>
|
13
|
+
<input ref="input" type="text" className="form-control" placeholder="Search Conjur"></input>
|
22
14
|
</div>
|
23
|
-
<button type="submit"
|
24
|
-
className="btn btn-default search-button">
|
25
|
-
Search
|
26
|
-
</button>
|
15
|
+
<button type="submit" className="btn btn-default search-button">Search</button>
|
27
16
|
</form>
|
28
17
|
);
|
29
18
|
}
|
data/public/js/views/owned.js
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
/** @jsx React.DOM */
|
2
|
-
/* global conjur, React, _ */
|
3
2
|
|
4
|
-
(function(conjur,
|
3
|
+
(function(conjur, _, React) {
|
5
4
|
'use strict';
|
6
5
|
|
7
6
|
var knownTypes = ['user', 'group', 'layer', 'host', 'variable', 'policy'];
|
@@ -35,16 +34,11 @@
|
|
35
34
|
return a.id.toLowerCase().localeCompare(b.id.toLowerCase());
|
36
35
|
}).map(function(resource) {
|
37
36
|
var kind = resource.id.split(':')[1];
|
38
|
-
|
39
37
|
filters.push(kind);
|
40
38
|
|
41
|
-
if ((this.state.filter === '')
|
42
|
-
(this.state.filter
|
43
|
-
(this.state.filter === 'other' &&
|
44
|
-
_.intersection([kind], knownTypes).length === 0)) {
|
45
|
-
|
46
|
-
var ResourceLink = conjur.views.ResourceLink;
|
47
|
-
|
39
|
+
if ((this.state.filter === '')
|
40
|
+
|| (this.state.filter != 'other' && this.state.filter === kind)
|
41
|
+
|| (this.state.filter === 'other' && _.intersection([kind], knownTypes).length === 0)) {
|
48
42
|
return (
|
49
43
|
<li className="list-group-item list-group-item-noborder">
|
50
44
|
<ResourceLink data={resource} />
|
@@ -67,7 +61,7 @@
|
|
67
61
|
|
68
62
|
var filterSelect = '';
|
69
63
|
|
70
|
-
if (this.props.resources.length > 9 || this.state.filter
|
64
|
+
if (this.props.resources.length > 9 || this.state.filter != '') {
|
71
65
|
// TODO: sort, when done with previous TODO
|
72
66
|
filterSelect = _.intersection(_.uniq(filters, true), knownTypes).map(function(f) {
|
73
67
|
return (
|
@@ -133,7 +127,7 @@
|
|
133
127
|
}
|
134
128
|
});
|
135
129
|
|
136
|
-
this.OwnedResources = React.createClass({
|
130
|
+
var OwnedResources = this.OwnedResources = React.createClass({
|
137
131
|
getInitialState: function() {
|
138
132
|
return {
|
139
133
|
expanded: false
|
@@ -179,6 +173,6 @@
|
|
179
173
|
}).bind(conjur.views)
|
180
174
|
(
|
181
175
|
conjur,
|
182
|
-
|
183
|
-
|
176
|
+
_,
|
177
|
+
React
|
184
178
|
);
|
@@ -1,254 +1,188 @@
|
|
1
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
2
|
|
3
|
+
var PermissionsTable = React.createClass({
|
4
|
+
render: function() {
|
5
|
+
var rows = [];
|
6
|
+
var resources = _.sortBy(this.props.resources, function(r){
|
7
|
+
return r.id; // this way it will be sorting by (kind, id)
|
8
|
+
});
|
9
|
+
resources.forEach(function(r){
|
10
|
+
var rowspan = r.permissions.length + 1;
|
11
|
+
var parts = r.id.split(":");
|
12
|
+
var id = parts[2];
|
13
|
+
var kind = parts[1]; // ignore env?
|
14
|
+
var cells = [
|
15
|
+
<td rowSpan={rowspan}> <ResourceLink id={r.id}/> </td>,
|
16
|
+
<td rowSpan={rowspan}> {kind} </td>
|
17
|
+
];
|
18
|
+
if(rowspan == 1){
|
19
|
+
cells.push(<td colSpan="3"> full permissions </td>);
|
20
|
+
}
|
21
|
+
|
22
|
+
rows.push(
|
23
|
+
<tr key={r.id}>{cells}</tr>
|
24
|
+
);
|
25
|
+
|
26
|
+
if(rowspan > 1){
|
27
|
+
rows.push(r.permissions.map(function(p){
|
28
|
+
return <PermissionRow data={p}/>
|
29
|
+
}));
|
30
|
+
}
|
86
31
|
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
32
|
+
});
|
33
|
+
rows = _.flatten(rows);
|
34
|
+
|
35
|
+
var showhidelink = <div><a onClick={this.props.hideHandler}>Hide all «</a></div>;
|
36
|
+
|
37
|
+
if (this.props.tabview) {
|
38
|
+
showhidelink="";
|
39
|
+
}
|
40
|
+
|
41
|
+
if (rows.length==0) {
|
42
|
+
return <span>None</span>;
|
43
|
+
}
|
44
|
+
|
45
|
+
return <div>
|
46
|
+
{showhidelink}
|
47
|
+
<table>
|
48
|
+
<thead>
|
49
|
+
<tr>
|
50
|
+
<th> Resource </th>
|
51
|
+
<th> Kind </th>
|
52
|
+
<th> Privilege </th>
|
53
|
+
<th> Can Grant? </th>
|
54
|
+
<th> Granted By </th>
|
55
|
+
</tr>
|
56
|
+
</thead>
|
57
|
+
<tbody> {rows} </tbody>
|
58
|
+
</table>
|
59
|
+
</div>
|
60
|
+
}
|
61
|
+
});
|
62
|
+
|
63
|
+
|
64
|
+
// Renders a permission as a tr
|
65
|
+
var PermissionRow = React.createClass({
|
66
|
+
render: function(){
|
67
|
+
var p = this.props.data;
|
68
|
+
return <tr>
|
69
|
+
<td> { p.privilege } </td>
|
70
|
+
<td> { p.grant_option ? "yes" : "no" }</td>
|
71
|
+
<td> <RoleLink id={p.grantor}/> </td>
|
72
|
+
</tr>;
|
73
|
+
}
|
74
|
+
});
|
75
|
+
|
76
|
+
var PermissionsSummary = React.createClass({
|
77
|
+
render: function() {
|
78
|
+
var expand = "";
|
79
|
+
if ( this.props.length > 0 )
|
80
|
+
expand = <span>
|
81
|
+
<br/>
|
82
|
+
<span>
|
83
|
+
<a onClick={this.props.expandHandler}>Show all »</a>
|
84
|
+
</span>
|
85
|
+
</span>;
|
86
|
+
|
87
|
+
return <div>
|
88
|
+
<span>
|
89
|
+
{this.props.length} permissions
|
90
|
+
</span>
|
91
|
+
{expand}
|
92
|
+
</div>
|
93
|
+
}
|
94
|
+
});
|
95
|
+
|
96
|
+
var Permissions = React.createClass({
|
97
|
+
getInitialState: function() {
|
98
|
+
return {resources: null, loaded: false, expand: false}
|
99
|
+
},
|
100
|
+
|
101
|
+
expand: function(event) {
|
102
|
+
this.setState({expand: true})
|
103
|
+
},
|
104
|
+
|
105
|
+
collapse: function(event) {
|
106
|
+
this.setState({expand: false})
|
107
|
+
},
|
108
|
+
|
109
|
+
componentWillMount: function() { // shouldn't it be done in model??? otherwise it will re-load stuff on each re-rendering of parent block
|
110
|
+
if ( this.props.roles ) {
|
111
|
+
$.get(this.url(), function(data){
|
112
|
+
this.setPermissions(data);
|
113
|
+
}.bind(this));
|
114
|
+
}
|
115
|
+
},
|
116
|
+
|
117
|
+
setPermissions: function(_resources) {
|
118
|
+
/**
|
119
|
+
* Filter out owned resources.
|
120
|
+
* Filter out permissions on resources which are not held by the current role.
|
121
|
+
*/
|
122
|
+
var resources;
|
123
|
+
|
124
|
+
if ( this.props.owned ) {
|
125
|
+
var ownedIds = _.pluck(this.props.owned, 'id');
|
126
|
+
resources = _resources.filter(function(r) {
|
127
|
+
return !_.contains(ownedIds, r.id);
|
128
|
+
});
|
129
|
+
}
|
130
|
+
else
|
131
|
+
resources = _resources;
|
132
|
+
|
133
|
+
var roleSet = {};
|
134
|
+
this.props.roles.forEach(function(r) {
|
135
|
+
roleSet[r] = r;
|
136
|
+
});
|
91
137
|
|
92
|
-
|
93
|
-
|
94
|
-
<td>{p.privilege}</td>
|
95
|
-
<td>{p.grant_option ? 'yes' : 'no'}</td>
|
96
|
-
<td><RoleLink id={p.grantor}/></td>
|
97
|
-
</tr>
|
98
|
-
);
|
99
|
-
}
|
138
|
+
var cleanResources = resources.filter(function(item) {
|
139
|
+
return item.id.split(':')[1] !== "secret"; // assets of 'secret' kind are internal
|
100
140
|
});
|
101
141
|
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
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
|
-
}
|
142
|
+
cleanResources.forEach(function(resource) {
|
143
|
+
var permissions = resource.permissions;
|
144
|
+
var hasPermissions = [];
|
145
|
+
permissions.forEach(function(permission) {
|
146
|
+
if ( roleSet.hasOwnProperty(permission['role']) )
|
147
|
+
hasPermissions.push(permission);
|
148
|
+
});
|
149
|
+
resource.permissions = hasPermissions;
|
126
150
|
});
|
127
151
|
|
128
|
-
this.
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
}
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
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
|
-
}
|
152
|
+
this.setState({resources: cleanResources, loaded: true});
|
153
|
+
},
|
154
|
+
|
155
|
+
render: function(){
|
156
|
+
var content;
|
157
|
+
if (this.state.loaded) {
|
158
|
+
if ( this.state.expand || this.props.tabview )
|
159
|
+
content = <PermissionsTable resources={this.state.resources} hideHandler={this.collapse} tabview={this.props.tabview}/>
|
160
|
+
else
|
161
|
+
content = <PermissionsSummary length={this.state.resources.length} expandHandler={this.expand} />
|
162
|
+
}
|
163
|
+
else {
|
164
|
+
if ( this.props.roles )
|
165
|
+
content = <span>Loading...</span>
|
166
|
+
else
|
167
|
+
content = "You are not authorized to see these permissions";
|
168
|
+
}
|
169
|
+
|
170
|
+
var cx = React.addons.classSet;
|
171
|
+
var classes = cx({
|
172
|
+
permissions: true,
|
173
|
+
loading: !this.state.loaded
|
246
174
|
});
|
247
175
|
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
176
|
+
var permissionsheader = this.props.tabview ? "" : <h3>Permissions held</h3>;
|
177
|
+
return <section className={classes}>
|
178
|
+
{permissionsheader}
|
179
|
+
<div id="permissionDetails">
|
180
|
+
{content}
|
181
|
+
</div>
|
182
|
+
</section>;
|
183
|
+
},
|
184
|
+
|
185
|
+
url: function(){
|
186
|
+
return "/api/authz/" + conjur.app.configuration.account + "/resources?acting_as=" + this.props.role;
|
187
|
+
}
|
188
|
+
})
|