conjur-asset-ui-beta 1.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (150) hide show
  1. checksums.yaml +7 -0
  2. data/.git-hooks/pre_commit/trailing_whitespace.rb +26 -0
  3. data/.gitignore +23 -0
  4. data/.project +18 -0
  5. data/CHANGELOG.md +14 -0
  6. data/Gemfile +10 -0
  7. data/LICENSE.txt +22 -0
  8. data/README.md +72 -0
  9. data/Rakefile +76 -0
  10. data/TODO.md +31 -0
  11. data/app/.csscomb.json +304 -0
  12. data/app/.jshintrc +46 -0
  13. data/app/build/css/bootstrap.css +6906 -0
  14. data/app/build/fonts/glyphicons-halflings-regular.eot +0 -0
  15. data/app/build/fonts/glyphicons-halflings-regular.svg +288 -0
  16. data/app/build/fonts/glyphicons-halflings-regular.ttf +0 -0
  17. data/app/build/fonts/glyphicons-halflings-regular.woff +0 -0
  18. data/app/build/fonts/glyphicons-halflings-regular.woff2 +0 -0
  19. data/app/build/images/conjur-logo.svg +26 -0
  20. data/app/build/images/icon-client-pc.svg +12 -0
  21. data/app/build/images/icon-environment.png +0 -0
  22. data/app/build/images/icon-person.svg +12 -0
  23. data/app/build/images/icon-policy.png +0 -0
  24. data/app/build/images/icon-resource.png +0 -0
  25. data/app/build/images/icon-service-dots.svg +13 -0
  26. data/app/build/images/icon-variable.png +0 -0
  27. data/app/build/index.html +26 -0
  28. data/app/build/js/app.js +78070 -0
  29. data/app/build/js/pace.js +2 -0
  30. data/app/config/preprocessor.js +9 -0
  31. data/app/config/webpack.js +84 -0
  32. data/app/gulpfile.js +144 -0
  33. data/app/package.json +83 -0
  34. data/app/src/actions.js +493 -0
  35. data/app/src/app.js +76 -0
  36. data/app/src/clients/audit.js +54 -0
  37. data/app/src/clients/generic.js +87 -0
  38. data/app/src/clients/layer_members.js +36 -0
  39. data/app/src/clients/list.js +82 -0
  40. data/app/src/clients/members.js +37 -0
  41. data/app/src/clients/search.js +19 -0
  42. data/app/src/components/app/__tests__/app-test.js +22 -0
  43. data/app/src/components/app/app.js +66 -0
  44. data/app/src/components/audit/__tests__/table_header-test.js +40 -0
  45. data/app/src/components/audit/box.js +11 -0
  46. data/app/src/components/audit/constants.js +7 -0
  47. data/app/src/components/audit/entry.js +107 -0
  48. data/app/src/components/audit/fields_mixin.js +13 -0
  49. data/app/src/components/audit/humanize_event.js +216 -0
  50. data/app/src/components/audit/table.js +100 -0
  51. data/app/src/components/audit/table_header.js +38 -0
  52. data/app/src/components/audit/timestamp.js +30 -0
  53. data/app/src/components/chart/chart.js +539 -0
  54. data/app/src/components/chart/chart_helper_mixin.js +79 -0
  55. data/app/src/components/custom/list.js +5 -0
  56. data/app/src/components/custom/view.js +71 -0
  57. data/app/src/components/dashboard/activity.js +113 -0
  58. data/app/src/components/dashboard/dashboard.js +47 -0
  59. data/app/src/components/flash/flash.js +17 -0
  60. data/app/src/components/generic/__tests__/time-test.js +43 -0
  61. data/app/src/components/generic/annotations.js +41 -0
  62. data/app/src/components/generic/breadcrumbs.js +59 -0
  63. data/app/src/components/generic/foldable_audit_section.js +252 -0
  64. data/app/src/components/generic/list.js +144 -0
  65. data/app/src/components/generic/list_factory.js +42 -0
  66. data/app/src/components/generic/resource_link.js +65 -0
  67. data/app/src/components/generic/role_link.js +65 -0
  68. data/app/src/components/generic/tab_mixin.js +148 -0
  69. data/app/src/components/generic/time.js +34 -0
  70. data/app/src/components/group/list.js +5 -0
  71. data/app/src/components/group/view.js +137 -0
  72. data/app/src/components/host/activity.js +93 -0
  73. data/app/src/components/host/details.js +30 -0
  74. data/app/src/components/host/host_link.js +20 -0
  75. data/app/src/components/host/list.js +5 -0
  76. data/app/src/components/host/view.js +113 -0
  77. data/app/src/components/layer/list.js +5 -0
  78. data/app/src/components/layer/view.js +180 -0
  79. data/app/src/components/navbar/__tests__/navbar-test.js +21 -0
  80. data/app/src/components/navbar/nav_search_form.js +41 -0
  81. data/app/src/components/navbar/navbar.js +71 -0
  82. data/app/src/components/owned_resources/owned_resources.js +86 -0
  83. data/app/src/components/owned_resources/owned_resources_box.js +106 -0
  84. data/app/src/components/permissions/permissions.js +143 -0
  85. data/app/src/components/permissions/permissions_table.js +104 -0
  86. data/app/src/components/policy/list.js +5 -0
  87. data/app/src/components/policy/view.js +98 -0
  88. data/app/src/components/refresh/refresh.js +30 -0
  89. data/app/src/components/refresh/refresh.less +15 -0
  90. data/app/src/components/search/group.js +45 -0
  91. data/app/src/components/search/group_heading.js +50 -0
  92. data/app/src/components/search/group_title.js +38 -0
  93. data/app/src/components/search/result_item.js +57 -0
  94. data/app/src/components/search/search.js +103 -0
  95. data/app/src/components/user/activity.js +92 -0
  96. data/app/src/components/user/details.js +30 -0
  97. data/app/src/components/user/list.js +5 -0
  98. data/app/src/components/user/pubkeys.js +116 -0
  99. data/app/src/components/user/pubkeys.less +56 -0
  100. data/app/src/components/user/view.js +123 -0
  101. data/app/src/components/variable/activity.js +83 -0
  102. data/app/src/components/variable/details.js +48 -0
  103. data/app/src/components/variable/fetchers.js +83 -0
  104. data/app/src/components/variable/list.js +5 -0
  105. data/app/src/components/variable/updaters.js +83 -0
  106. data/app/src/components/variable/view.js +105 -0
  107. data/app/src/constants.js +35 -0
  108. data/app/src/images/conjur-logo.svg +26 -0
  109. data/app/src/images/icon-client-pc.svg +12 -0
  110. data/app/src/images/icon-environment.png +0 -0
  111. data/app/src/images/icon-person.svg +12 -0
  112. data/app/src/images/icon-policy.png +0 -0
  113. data/app/src/images/icon-resource.png +0 -0
  114. data/app/src/images/icon-service-dots.svg +13 -0
  115. data/app/src/images/icon-variable.png +0 -0
  116. data/app/src/pages/index.html +26 -0
  117. data/app/src/routes.js +57 -0
  118. data/app/src/stores/app_store.js +29 -0
  119. data/app/src/stores/audit_store.js +77 -0
  120. data/app/src/stores/group_store.js +105 -0
  121. data/app/src/stores/host_store.js +98 -0
  122. data/app/src/stores/layer_store.js +115 -0
  123. data/app/src/stores/policy_store.js +89 -0
  124. data/app/src/stores/resources_store.js +118 -0
  125. data/app/src/stores/route_store.js +24 -0
  126. data/app/src/stores/search_store.js +73 -0
  127. data/app/src/stores/user_store.js +111 -0
  128. data/app/src/stores/variable_store.js +94 -0
  129. data/app/src/styles/bootstrap.less +56 -0
  130. data/app/src/styles/styles.less +634 -0
  131. data/app/src/utils.js +43 -0
  132. data/app/src/vendor/pace.js +2 -0
  133. data/conjur-asset-ui.gemspec +36 -0
  134. data/features/navigation_bar.feature +31 -0
  135. data/features/step_definitions/custom_step.rb +32 -0
  136. data/features/support/env.rb +38 -0
  137. data/features/support/hooks.rb +30 -0
  138. data/features/support/world.rb +17 -0
  139. data/lib/conjur-asset-ui-version.rb +7 -0
  140. data/lib/conjur-asset-ui.rb +7 -0
  141. data/lib/conjur/command/ui.rb +54 -0
  142. data/lib/conjur/webserver/api_proxy.rb +94 -0
  143. data/lib/conjur/webserver/authorize.rb +28 -0
  144. data/lib/conjur/webserver/conjur_info.rb +33 -0
  145. data/lib/conjur/webserver/home.rb +42 -0
  146. data/lib/conjur/webserver/login.rb +57 -0
  147. data/lib/conjur/webserver/renderer.rb +34 -0
  148. data/lib/conjur/webserver/server.rb +130 -0
  149. data/public/js/views/roleGraph.js +91 -0
  150. metadata +373 -0
@@ -0,0 +1,86 @@
1
+ 'use strict';
2
+
3
+ var React = require('react');
4
+
5
+ var OwnedResourcesBox = require('./owned_resources_box');
6
+
7
+ var OwnedResourcesSummary = React.createClass({
8
+ displayName: 'OwnedResourcesSummary',
9
+
10
+ render() {
11
+ var expand = '';
12
+
13
+ if (this.props.length > 0) {
14
+ expand = (
15
+ <span>
16
+ <br/>
17
+ <span>
18
+ <a onClick={this.props.handler}>Show all &raquo;</a>
19
+ </span>
20
+ </span>
21
+ );
22
+ }
23
+
24
+ var message = '';
25
+
26
+ if (this.props.length === 0) {
27
+ message = 'none';
28
+ } else {
29
+ message = '' + this.props.length + ' things';
30
+ }
31
+
32
+ return (
33
+ <div>
34
+ <span>
35
+ {message}
36
+ </span>
37
+ {expand}
38
+ </div>
39
+ );
40
+ }
41
+ });
42
+
43
+ module.exports = React.createClass({
44
+ displayName: 'OwnedResources',
45
+
46
+ getInitialState() {
47
+ return {
48
+ expanded: false
49
+ };
50
+ },
51
+
52
+ toggle(e) {
53
+ e.preventDefault();
54
+
55
+ this.setState({expanded: !this.state.expanded});
56
+ },
57
+
58
+ render() {
59
+ var content = null;
60
+
61
+ if (this.state.expanded || this.props.tabview) {
62
+ content = (
63
+ <OwnedResourcesBox resources={this.props.owned}
64
+ handler={this.toggle}
65
+ tabview={this.props.tabview} />
66
+ );
67
+
68
+ } else {
69
+ content = (
70
+ <OwnedResourcesSummary length={this.props.owned.length}
71
+ handler={this.toggle} />
72
+ );
73
+ }
74
+
75
+ var ownedheader = this.props.tabview ? '': (<h3>Owned assets</h3>);
76
+
77
+ return (
78
+ <section className="owned row">
79
+ {ownedheader}
80
+ <div id="ownedDetails" className="col-xs-6">
81
+ {content}
82
+ </div>
83
+ </section>
84
+ );
85
+ }
86
+ });
@@ -0,0 +1,106 @@
1
+ 'use strict';
2
+
3
+ var React = require('react');
4
+
5
+ var utils = require('../../utils');
6
+
7
+ var intersection = require('lodash/array/intersection'),
8
+ uniq = require('lodash/array/uniq'),
9
+ capitalize = require('lodash/string/capitalize');
10
+
11
+ var ResourceLink = require('../generic/resource_link');
12
+
13
+ var knownTypes = ['user', 'group', 'layer', 'host', 'variable', 'policy'];
14
+
15
+ module.exports = React.createClass({
16
+ displayName: 'OwnedResourcesBox',
17
+
18
+ getInitialState() {
19
+ return {
20
+ filter: ''
21
+ };
22
+ },
23
+
24
+ handleChange(e) {
25
+ e.preventDefault();
26
+
27
+ this.setState({filter: e.target.value});
28
+ },
29
+
30
+ render() {
31
+ var filters = [];
32
+
33
+ if (!this.props.resources) {
34
+ return (
35
+ <span>None</span>
36
+ );
37
+ }
38
+
39
+ var items = this.props.resources
40
+ .sort(function(a, b) {
41
+ // TODO: sort by kind with custom weights, by id, by creation date
42
+ // automatically gives sort by kind, id
43
+ return a.id.toLowerCase().localeCompare(b.id.toLowerCase());
44
+ }).map(function(resource) {
45
+ var kind = resource.id.split(':')[1];
46
+
47
+ filters.push(kind);
48
+
49
+ if ((this.state.filter === '') ||
50
+ (this.state.filter !== 'other' && this.state.filter === kind) ||
51
+ (this.state.filter === 'other' &&
52
+ intersection([kind], knownTypes).length === 0)) {
53
+
54
+ return (
55
+ <li className="list-group-item list-group-item-noborder">
56
+ <ResourceLink id={resource.id} />
57
+ </li>
58
+ );
59
+ }
60
+
61
+ return '';
62
+ }.bind(this));
63
+
64
+ var toggleButton = '';
65
+
66
+ if (!this.props.tabview) {
67
+ toggleButton = (
68
+ <div className="hide-all">
69
+ <a onClick={this.props.handler}>Hide all &laquo;</a>
70
+ </div>
71
+ );
72
+ }
73
+
74
+ var filterSelect = '';
75
+
76
+ if (this.props.resources.length > 9 || this.state.filter !== '') {
77
+ // TODO: sort, when done with previous TODO
78
+ filterSelect = intersection(uniq(filters, true), knownTypes).map(function(f) {
79
+ return (
80
+ <option value={f}>{capitalize(utils.pluralize(f))}</option>
81
+ );
82
+ });
83
+
84
+ filterSelect = (
85
+ <div className="form-group row">
86
+ <div className="col-xs-3">
87
+ <select className="form-control" type="select" ref="filter"
88
+ value={this.state.filter} onChange={this.handleChange}>
89
+ <option value="">Show all</option>
90
+ {filterSelect}
91
+ <option value="other">Other</option>
92
+ </select>
93
+ </div>
94
+ </div>
95
+ );
96
+ }
97
+
98
+ return (
99
+ <div className="owned">
100
+ {toggleButton}
101
+ {filterSelect}
102
+ <ul className="list-group">{items}</ul>
103
+ </div>
104
+ );
105
+ }
106
+ });
@@ -0,0 +1,143 @@
1
+ 'use strict';
2
+
3
+ var React = require('react'),
4
+ cx = require('react/lib/cx');
5
+
6
+ var filter = require('lodash/collection/filter');
7
+
8
+ var pluck = require('lodash/collection/pluck'),
9
+ includes = require('lodash/collection/includes');
10
+
11
+ var PermissionsTable = require('./permissions_table');
12
+
13
+ var PermissionsSummary = React.createClass({
14
+ displayName: 'PermissionsSummary',
15
+
16
+ render() {
17
+ var expand = '';
18
+
19
+ if (this.props.length > 0) {
20
+ expand = (
21
+ <span>
22
+ <br/>
23
+ <span>
24
+ <a onClick={this.props.expandHandler}>Show all &raquo;</a>
25
+ </span>
26
+ </span>
27
+ );
28
+ }
29
+
30
+ return (
31
+ <div>
32
+ <span>
33
+ {this.props.length} permissions
34
+ </span>
35
+ {expand}
36
+ </div>
37
+ );
38
+ }
39
+ });
40
+
41
+ module.exports = React.createClass({
42
+ displayName: 'Permissions',
43
+
44
+ getDefaultProps() {
45
+ return {
46
+ resources: [],
47
+ roles: []
48
+ };
49
+ },
50
+
51
+ getInitialState() {
52
+ return {
53
+ expand: false
54
+ };
55
+ },
56
+
57
+ expand() {
58
+ this.setState({expand: true});
59
+ },
60
+
61
+ collapse() {
62
+ this.setState({expand: false});
63
+ },
64
+
65
+ setPermissions(_resources) {
66
+ /**
67
+ * Filter out owned resources.
68
+ * Filter out permissions on resources which are not held by the current role.
69
+ */
70
+ var resources;
71
+
72
+ if (this.props.owned) {
73
+ var ownedIds = pluck(this.props.owned, 'id');
74
+
75
+ resources = filter(_resources, function(r) {
76
+ return ! includes(ownedIds, r.id);
77
+ });
78
+ } else {
79
+ resources = _resources;
80
+ }
81
+
82
+ var roleSet = {};
83
+
84
+ this.props.roles.forEach(function(r) {
85
+ roleSet[r] = r;
86
+ });
87
+
88
+ var cleanResources = filter(resources, function(item) {
89
+ // assets of 'secret' kind are internal
90
+ return item.id.split(':')[1] !== 'secret';
91
+ });
92
+
93
+ cleanResources.forEach(function(resource) {
94
+ var permissions = resource.permissions,
95
+ hasPermissions = [];
96
+
97
+ permissions.forEach(function(permission) {
98
+ if (roleSet.hasOwnProperty(permission.role)) {
99
+ hasPermissions.push(permission);
100
+ }
101
+ });
102
+
103
+ resource.permissions = hasPermissions;
104
+ });
105
+
106
+ return cleanResources;
107
+ },
108
+
109
+ render() {
110
+ var resources = this.setPermissions(this.props.resources);
111
+
112
+ var content;
113
+
114
+ if (this.state.expand || this.props.tabview) {
115
+ content = (
116
+ <PermissionsTable resources={resources}
117
+ hideHandler={this.collapse}
118
+ tabview={this.props.tabview} />
119
+ );
120
+ } else {
121
+ content = (
122
+ <PermissionsSummary length={this.state.resources.length}
123
+ expandHandler={this.expand} />
124
+ );
125
+ }
126
+
127
+ var classes = cx({
128
+ permissions: true,
129
+ loading: false
130
+ });
131
+
132
+ var permissionsheader = this.props.tabview ? '' : (<h3>Permissions held</h3>);
133
+
134
+ return (
135
+ <section className={classes}>
136
+ {permissionsheader}
137
+ <div id="permissionDetails">
138
+ {content}
139
+ </div>
140
+ </section>
141
+ );
142
+ }
143
+ });
@@ -0,0 +1,104 @@
1
+ 'use strict';
2
+
3
+ var React = require('react');
4
+
5
+ var ResourceLink = require('../generic/resource_link'),
6
+ RoleLink = require('../generic/role_link');
7
+
8
+ var sortBy = require('lodash/collection/sortBy'),
9
+ flatten = require('lodash/array/flatten');
10
+
11
+ // Renders a permission as a tr
12
+ var PermissionRow = React.createClass({
13
+ displayName: 'PermissionRow',
14
+
15
+ render() {
16
+ var p = this.props.data;
17
+
18
+ return (
19
+ <tr>
20
+ <td>{p.privilege}</td>
21
+ <td>{p.grant_option ? 'yes' : 'no'}</td>
22
+ <td><RoleLink id={p.grantor}/></td>
23
+ </tr>
24
+ );
25
+ }
26
+ });
27
+
28
+ module.exports = React.createClass({
29
+ displayName: 'PermissionsTable',
30
+
31
+ render() {
32
+ var rows = [];
33
+
34
+ var resources = sortBy(this.props.resources, function(r) {
35
+ return r.id; // this way it will be sorting by (kind, id)
36
+ });
37
+
38
+ resources.forEach(function(r) {
39
+ var rowspan = r.permissions.length + 1,
40
+ parts = r.id.split(':'),
41
+ kind = parts[1]; // ignore env?
42
+
43
+ var cells = [
44
+ (<td rowSpan={rowspan}> <ResourceLink id={r.id}/> </td>),
45
+ (<td rowSpan={rowspan}> {kind} </td>)
46
+ ];
47
+
48
+ if (rowspan === 1) {
49
+ cells.push(<td colSpan="3"> full permissions </td>);
50
+ }
51
+
52
+ rows.push(
53
+ (<tr key={r.id}>{cells}</tr>)
54
+ );
55
+
56
+ if (rowspan > 1) {
57
+ rows.push(r.permissions.map(function(p) {
58
+ return (
59
+ <PermissionRow data={p} />
60
+ );
61
+ }));
62
+ }
63
+
64
+ });
65
+
66
+ rows = flatten(rows);
67
+
68
+ var showhidelink = (
69
+ <div>
70
+ <a onClick={this.props.hideHandler}>Hide all &laquo;</a>
71
+ </div>
72
+ );
73
+
74
+ if (this.props.tabview) {
75
+ showhidelink = '';
76
+ }
77
+
78
+ if (rows.length === 0) {
79
+ return (
80
+ <span>None</span>
81
+ );
82
+ }
83
+
84
+ return (
85
+ <div>
86
+ {showhidelink}
87
+ <table>
88
+ <thead>
89
+ <tr>
90
+ <th> Resource </th>
91
+ <th> Kind </th>
92
+ <th> Privilege </th>
93
+ <th> Can Grant? </th>
94
+ <th> Granted By </th>
95
+ </tr>
96
+ </thead>
97
+ <tbody>
98
+ {rows}
99
+ </tbody>
100
+ </table>
101
+ </div>
102
+ );
103
+ }
104
+ });
@@ -0,0 +1,5 @@
1
+ 'use strict';
2
+
3
+ var genericListFactory = require('../generic/list_factory');
4
+
5
+ module.exports = genericListFactory('policy', 'Policies');