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.
Files changed (211) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +8 -3
  3. data/CHANGELOG.md +10 -0
  4. data/Makefile +19 -0
  5. data/README.md +0 -3
  6. data/Rakefile +22 -17
  7. data/TODO.md +0 -23
  8. data/app/.csscomb.json +304 -0
  9. data/app/.eslintignore +3 -0
  10. data/app/.eslintrc +265 -0
  11. data/app/config/preprocessor.js +19 -0
  12. data/app/config/webpack.js +124 -0
  13. data/app/gulpfile.js +96 -0
  14. data/app/package.json +86 -0
  15. data/app/src/actions.js +550 -0
  16. data/app/src/app.js +83 -0
  17. data/app/src/clients/audit.js +34 -0
  18. data/app/src/clients/auth.js +24 -0
  19. data/app/src/clients/generic.js +52 -0
  20. data/app/src/clients/graph.js +7 -0
  21. data/app/src/clients/layer_members.js +18 -0
  22. data/app/src/clients/list.js +31 -0
  23. data/app/src/clients/members.js +20 -0
  24. data/app/src/clients/request.js +531 -0
  25. data/app/src/clients/search.js +5 -0
  26. data/app/src/components/app/__tests__/app-test.js +22 -0
  27. data/app/src/components/app/app.js +36 -0
  28. data/app/src/components/app/wrapper.js +17 -0
  29. data/app/src/components/audit/__tests__/table_header-test.js +22 -0
  30. data/app/src/components/audit/box.js +9 -0
  31. data/app/src/components/audit/constants.js +5 -0
  32. data/app/src/components/audit/entry.js +105 -0
  33. data/app/src/components/audit/fields_mixin.js +11 -0
  34. data/app/src/components/audit/humanize_event.js +213 -0
  35. data/app/src/components/audit/table.js +64 -0
  36. data/app/src/components/audit/table_header.js +37 -0
  37. data/app/src/components/audit/timestamp.js +28 -0
  38. data/app/src/components/auth/login.js +177 -0
  39. data/app/src/components/auth/login.less +71 -0
  40. data/app/src/components/auth/logout.js +42 -0
  41. data/app/src/components/auth/logout.less +21 -0
  42. data/app/src/components/chart/chart.js +540 -0
  43. data/app/src/components/chart/chart_helper_mixin.js +78 -0
  44. data/app/src/components/custom/list.js +3 -0
  45. data/app/src/components/custom/view.js +81 -0
  46. data/app/src/components/dashboard/activity.js +144 -0
  47. data/app/src/components/dashboard/dashboard.js +46 -0
  48. data/app/src/components/flash/flash.js +98 -0
  49. data/app/src/components/flash/flash.less +3 -0
  50. data/app/src/components/generic/__tests__/time-test.js +42 -0
  51. data/app/src/components/generic/annotations.js +39 -0
  52. data/app/src/components/generic/breadcrumbs.js +57 -0
  53. data/app/src/components/generic/foldable_audit_section.js +204 -0
  54. data/app/src/components/generic/list.js +141 -0
  55. data/app/src/components/generic/list_factory.js +41 -0
  56. data/app/src/components/generic/resource_link.js +64 -0
  57. data/app/src/components/generic/role_link.js +66 -0
  58. data/app/src/components/generic/tab_mixin.js +146 -0
  59. data/app/src/components/generic/time.js +32 -0
  60. data/app/src/components/graph/__tests__/collapse-test.js +133 -0
  61. data/app/src/components/graph/__tests__/edges-from-vertices-test.js +48 -0
  62. data/app/src/components/graph/__tests__/new-vertex-set-test.js +16 -0
  63. data/app/src/components/graph/__tests__/next-id-test.js +27 -0
  64. data/app/src/components/graph/__tests__/role-kind-from-id-test.js +24 -0
  65. data/app/src/components/graph/__tests__/vertices-from-edges-test.js +72 -0
  66. data/app/src/components/graph/graph.js +449 -0
  67. data/app/src/components/graph/graph.less +39 -0
  68. data/app/src/components/graph/helpers.js +368 -0
  69. data/app/src/components/group/list.js +3 -0
  70. data/app/src/components/group/view.js +153 -0
  71. data/app/src/components/host/activity.js +111 -0
  72. data/app/src/components/host/details.js +28 -0
  73. data/app/src/components/host/executors.js +77 -0
  74. data/app/src/components/host/host_link.js +18 -0
  75. data/app/src/components/host/list.js +3 -0
  76. data/app/src/components/host/updaters.js +77 -0
  77. data/app/src/components/host/view.js +145 -0
  78. data/app/src/components/layer/list.js +3 -0
  79. data/app/src/components/layer/view.js +197 -0
  80. data/app/src/components/navbar/__tests__/navbar-test.js +21 -0
  81. data/app/src/components/navbar/nav_search_form.js +40 -0
  82. data/app/src/components/navbar/navbar.js +96 -0
  83. data/app/src/components/notfound/notfound.js +35 -0
  84. data/app/src/components/notfound/notfound.less +21 -0
  85. data/app/src/components/owned_resources/owned_resources.js +84 -0
  86. data/app/src/components/owned_resources/owned_resources_box.js +101 -0
  87. data/app/src/components/permissions/permissions.js +138 -0
  88. data/app/src/components/permissions/permissions_table.js +101 -0
  89. data/app/src/components/policy/list.js +3 -0
  90. data/app/src/components/policy/view.js +107 -0
  91. data/app/src/components/refresh/refresh.js +29 -0
  92. data/app/src/components/refresh/refresh.less +15 -0
  93. data/app/src/components/search/group.js +43 -0
  94. data/app/src/components/search/group_heading.js +50 -0
  95. data/app/src/components/search/group_title.js +37 -0
  96. data/app/src/components/search/result_item.js +55 -0
  97. data/app/src/components/search/search.js +118 -0
  98. data/app/src/components/user/activity.js +112 -0
  99. data/app/src/components/user/details.js +30 -0
  100. data/app/src/components/user/list.js +3 -0
  101. data/app/src/components/user/pubkeys.js +118 -0
  102. data/app/src/components/user/pubkeys.less +56 -0
  103. data/app/src/components/user/view.js +143 -0
  104. data/app/src/components/variable/activity.js +101 -0
  105. data/app/src/components/variable/details.js +46 -0
  106. data/app/src/components/variable/fetchers.js +77 -0
  107. data/app/src/components/variable/list.js +3 -0
  108. data/app/src/components/variable/updaters.js +77 -0
  109. data/app/src/components/variable/view.js +115 -0
  110. data/app/src/constants.js +36 -0
  111. data/{public → app/src}/images/conjur-logo.svg +0 -0
  112. data/{public → app/src}/images/icon-client-pc.svg +0 -0
  113. data/{public → app/src}/images/icon-environment.png +0 -0
  114. data/{public → app/src}/images/icon-person.svg +0 -0
  115. data/{public → app/src}/images/icon-policy.png +0 -0
  116. data/{public → app/src}/images/icon-resource.png +0 -0
  117. data/{public → app/src}/images/icon-service-dots.svg +0 -0
  118. data/{public → app/src}/images/icon-variable.png +0 -0
  119. data/app/src/pages/index.html +27 -0
  120. data/app/src/routes.js +64 -0
  121. data/app/src/stores/app_store.js +35 -0
  122. data/app/src/stores/audit_store.js +143 -0
  123. data/app/src/stores/graph_store.js +51 -0
  124. data/app/src/stores/group_store.js +104 -0
  125. data/app/src/stores/host_store.js +111 -0
  126. data/app/src/stores/layer_store.js +115 -0
  127. data/app/src/stores/policy_store.js +88 -0
  128. data/app/src/stores/resources_store.js +115 -0
  129. data/app/src/stores/route_store.js +21 -0
  130. data/app/src/stores/search_store.js +77 -0
  131. data/app/src/stores/user_store.js +109 -0
  132. data/app/src/stores/variable_store.js +93 -0
  133. data/app/src/styles/bootstrap.less +54 -0
  134. data/{public/css → app/src/styles}/styles.less +26 -82
  135. data/app/src/utils.js +38 -0
  136. data/app/src/vendor/pace.js +2 -0
  137. data/conjur-asset-ui.gemspec +3 -4
  138. data/docker/assets-build/Dockerfile +12 -0
  139. data/docker/conjur-ui/Dockerfile +33 -0
  140. data/docker/conjur-ui/README.md +38 -0
  141. data/docker/conjur-ui/mime.types +90 -0
  142. data/docker/conjur-ui/nginx.conf +110 -0
  143. data/docker/conjur-ui/start.py +72 -0
  144. data/docker/conjur-ui/start.sh +18 -0
  145. data/docker/conjur-ui/test.env +8 -0
  146. data/lib/conjur-asset-ui-version.rb +1 -1
  147. data/lib/conjur/command/ui.rb +10 -2
  148. data/lib/conjur/webserver/home.rb +3 -3
  149. data/lib/conjur/webserver/login.rb +1 -1
  150. data/lib/conjur/webserver/server.rb +16 -4
  151. data/public/js/views/roleGraph.js +91 -0
  152. metadata +167 -105
  153. data/.jshintrc +0 -41
  154. data/bower.json +0 -98
  155. data/gulpfile.js +0 -139
  156. data/package.json +0 -47
  157. data/preprocessor.js +0 -7
  158. data/public/_client_libs.html +0 -9
  159. data/public/index.html.erb +0 -63
  160. data/public/js/init.js +0 -196
  161. data/public/js/lib/pace.js +0 -2
  162. data/public/js/lib/sorted-set.no-require.js +0 -1145
  163. data/public/js/lib/sorted-set.no-require.js.txt +0 -6
  164. data/public/js/models/groupRecord.js +0 -72
  165. data/public/js/models/hostRecord.js +0 -60
  166. data/public/js/models/layerRecord.js +0 -79
  167. data/public/js/models/namespace.js +0 -12
  168. data/public/js/models/policyList.js +0 -16
  169. data/public/js/models/policyRecord.js +0 -54
  170. data/public/js/models/record.js +0 -117
  171. data/public/js/models/resourceList.js +0 -87
  172. data/public/js/models/userList.js +0 -25
  173. data/public/js/models/userRecord.js +0 -75
  174. data/public/js/models/variableList.js +0 -27
  175. data/public/js/models/variableRecord.js +0 -77
  176. data/public/js/routers.js +0 -242
  177. data/public/js/views/annotations.js +0 -47
  178. data/public/js/views/audit.js +0 -369
  179. data/public/js/views/breadcrumbs.js +0 -62
  180. data/public/js/views/chart.js +0 -617
  181. data/public/js/views/dashboard.js +0 -146
  182. data/public/js/views/generic.js +0 -122
  183. data/public/js/views/group.js +0 -109
  184. data/public/js/views/groups.js +0 -26
  185. data/public/js/views/host.js +0 -200
  186. data/public/js/views/hosts.js +0 -26
  187. data/public/js/views/layer.js +0 -146
  188. data/public/js/views/layers.js +0 -26
  189. data/public/js/views/mixins/search.js +0 -22
  190. data/public/js/views/mixins/tabs.js +0 -154
  191. data/public/js/views/namespaces.js +0 -40
  192. data/public/js/views/navSearch.js +0 -36
  193. data/public/js/views/owned.js +0 -184
  194. data/public/js/views/permissions.js +0 -254
  195. data/public/js/views/policies.js +0 -26
  196. data/public/js/views/policy.js +0 -70
  197. data/public/js/views/resource.js +0 -59
  198. data/public/js/views/role.js +0 -63
  199. data/public/js/views/searchResults.js +0 -212
  200. data/public/js/views/sections.js +0 -226
  201. data/public/js/views/time.js +0 -39
  202. data/public/js/views/user.js +0 -297
  203. data/public/js/views/users.js +0 -26
  204. data/public/js/views/variable.js +0 -310
  205. data/public/js/views/variables.js +0 -26
  206. data/spec/javascripts/helpers/.gitkeep +0 -0
  207. data/spec/javascripts/support/jasmine.yml +0 -112
  208. data/spec/javascripts/support/jasmine_helper.rb +0 -22
  209. data/spec/javascripts/support/run.html.erb +0 -23
  210. data/spec/javascripts/views/AuditSpec.js +0 -22
  211. data/spec/javascripts/views/AuditSpec.ls +0 -18
@@ -1,146 +0,0 @@
1
- /**@jsx React.DOM*/
2
- /* global conjur, React, jQuery */
3
-
4
- (function(conjur, React, $) {
5
- 'use strict';
6
-
7
- var Chart = conjur.views.Chart,
8
- ChartHelperMixin = conjur.views.ChartHelperMixin,
9
- FoldableAuditSection = conjur.views.FoldableAuditSection;
10
-
11
- var Activity = React.createClass({
12
- mixins: [ChartHelperMixin],
13
-
14
- getDefaultProps: function() {
15
- return {
16
- options: {
17
- legend: {
18
- slogins: 'Logins',
19
- ssudo: 'Sudo calls',
20
- sreads: 'Secret reads',
21
- supdates: 'Secret updates',
22
- fsudo: 'Sudo failures',
23
- freads: 'Secret read failures',
24
- fupdates: 'Secret update failures',
25
- fother: 'Other failures'
26
- },
27
- axis: {
28
- y: {
29
- label: 'Value'
30
- }
31
- }
32
- }
33
- };
34
- },
35
-
36
- getDefaultItem: function() {
37
- return {
38
- slogins: 0,
39
- ssudo: 0,
40
- fsudo: 0,
41
- sreads: 0,
42
- freads: 0,
43
- supdates: 0,
44
- fupdates: 0,
45
- fother: 0
46
- };
47
- },
48
-
49
- getEventType: function(e) {
50
- if (e.hasOwnProperty('facility') && e.facility === 'ssh') {
51
- if (e.allowed === true) {
52
- if (e.action === 'sudo') {
53
- return 'ssudo';
54
- }
55
-
56
- if (e.action === 'login') {
57
- return 'slogins';
58
- }
59
- }
60
-
61
- if (e.allowed === false) {
62
- if (e.action === 'sudo') {
63
- return 'fsudo';
64
- }
65
- }
66
- }
67
-
68
- if ((e.action === 'check') && e.hasOwnProperty('resource') && e.resource.split(':')[1] === 'variable') {
69
- if (e.hasOwnProperty('error') || e.allowed === false) {
70
- if (e.privilege === 'execute') {
71
- return 'freads';
72
- }
73
-
74
- if (e.privilege === 'update') {
75
- return 'fupdates';
76
- }
77
- }
78
-
79
- if (!e.hasOwnProperty('error') && e.allowed !== false) {
80
- if (e.privilege === 'execute') {
81
- return 'sreads';
82
- }
83
-
84
- if (e.privilege === 'update') {
85
- return 'supdates';
86
- }
87
- }
88
- }
89
-
90
- if (e.hasOwnProperty('error') || e.allowed === false) {
91
- return 'fother';
92
- }
93
-
94
- return null;
95
- },
96
-
97
- render: function() {
98
- var data = this.getData(this.props.audit);
99
-
100
- return (
101
- <div className="b-dashboard-activity">
102
- <h2>Activity</h2>
103
- <div className="b-dashboard-activity__graph">
104
- <Chart options={this.props.options}
105
- data={data} />
106
- </div>
107
- </div>
108
- );
109
- }
110
- });
111
-
112
- this.Dashboard = React.createClass({
113
- getInitialState: function() {
114
- return {audit: []};
115
- },
116
-
117
- componentWillMount: function() {
118
- $.get('/api/audit/all',
119
- function(data) {
120
- this.setState({audit: data});
121
- }.bind(this));
122
- },
123
-
124
- render: function() {
125
- return (
126
- <div className="b-dashboard">
127
- <Activity audit={this.state.audit} />
128
- <hr />
129
- {FoldableAuditSection.warnings(this.state.audit)}
130
- <hr />
131
- {FoldableAuditSection.changes(this.state.audit)}
132
- <hr />
133
- <AuditTable src="/api/audit/all"
134
- caption="Recent activity"
135
- />
136
- </div>
137
- );
138
- }
139
- });
140
-
141
- }).bind(conjur.views)
142
- (
143
- conjur,
144
- React,
145
- jQuery
146
- );
@@ -1,122 +0,0 @@
1
- /** @jsx React.DOM */
2
- /* global conjur, React, _ */
3
-
4
- (function(conjur, React, _) {
5
- 'use strict';
6
-
7
- var RoleLink = conjur.views.RoleLink;
8
-
9
- var GenericListItem = React.createClass({
10
- render: function() {
11
- var recordUrl = '/ui/' +
12
- this.props.data.kind +
13
- '/' +
14
- window.encodeURIComponent(this.props.data.record.identifier);
15
-
16
- return (
17
- <tr>
18
- <td className="id">
19
- <a href={recordUrl}>
20
- {this.props.data.record.identifier}
21
- </a>
22
- </td>
23
- <td className="ownerId">
24
- <RoleLink id={this.props.data.record.ownerid || this.props.data.record.owner} />
25
- </td>
26
- </tr>
27
- );
28
- }
29
- });
30
-
31
- this.GenericList = React.createClass({
32
- getInitialState: function() {
33
- return {
34
- sort: {
35
- column: this.props.defaultColumn || 'id',
36
- order: this.props.defaultOrder || 'asc'
37
- },
38
- columns: this.props.columns || {
39
- id: {
40
- id: 'id',
41
- name: 'Id',
42
- defaultSortOrder: 'desc'
43
- },
44
- owner: {
45
- id: 'owner',
46
- name: 'Owner',
47
- defaultSortOrder: 'desc'
48
- }
49
- }
50
- };
51
- },
52
-
53
- sortColumn: function(column) {
54
- return function(e) {
55
- e.preventDefault();
56
-
57
- var order = (this.state.sort.order === 'asc') ? 'desc' : 'asc';
58
-
59
- if (this.state.sort.column !== column) {
60
- order = this.state.columns[column].defaultSortOrder;
61
- }
62
-
63
- this.setState({sort: {column: column, order: order}});
64
- }.bind(this);
65
- },
66
-
67
- sortClass: function(column) {
68
- var order = (this.state.sort.order === 'asc') ?
69
- 'glyphicon glyphicon-chevron-up' : 'glyphicon glyphicon-chevron-down';
70
-
71
- return (this.state.sort.column === column) ? order : '';
72
- },
73
-
74
- render: function() {
75
- var items = this.props.data.members.map(function(o) {
76
- return o;
77
- });
78
-
79
- items = _.sortBy(items, this.state.sort.column);
80
-
81
- if (this.state.sort.order === 'desc') {
82
- items.reverse();
83
- }
84
-
85
- var rows = items.map(function (o) {
86
- var componentName = _.str.capitalize(
87
- this.props.data.kind.substring(0, this.props.data.kind.length-1)
88
- ) + 'ListItem';
89
-
90
- var itemKind = window[componentName] || GenericListItem; // Caution!
91
- return itemKind({data: {kind: this.props.data.kind, record: o}, key: o.id});
92
- }.bind(this));
93
-
94
- var columns = _.values(this.state.columns).map(function(c) {
95
- return (
96
- <th onClick={this.sortColumn(c.id)} key={c.id} >
97
- {c.name}<span className={'header ' + this.sortClass(c.id)} />
98
- </th>
99
- );
100
- }, this);
101
-
102
- return (
103
- <table className={this.props.data.kind + 'List'}>
104
- <thead>
105
- <tr>
106
- {columns}
107
- </tr>
108
- </thead>
109
- <tbody>
110
- {rows}
111
- </tbody>
112
- </table>
113
- );
114
- }
115
- });
116
-
117
- }).bind(conjur.views)
118
- (
119
- conjur,
120
- React,
121
- _
122
- );
@@ -1,109 +0,0 @@
1
- /** @jsx React.DOM */
2
- /* global conjur, React, ReactBootstrap, _ */
3
-
4
- (function(conjur, React, ReactBootstrap, _) {
5
- 'use strict';
6
-
7
- var TabbedArea = ReactBootstrap.TabbedArea,
8
- TabPane = ReactBootstrap.TabPane,
9
- Tab = conjur.views.mixins.Tab,
10
- AuditBox = window.AuditBox,
11
- Breadcrumbs = conjur.views.Breadcrumbs,
12
- RoleLink = conjur.views.RoleLink;
13
-
14
- this.Group = React.createClass({
15
- mixins: [Tab],
16
-
17
- render: function() {
18
- var data = this.props.data;
19
-
20
- var members = data.members.map(function(member) {
21
- return (
22
- <li className="list-group-item list-group-item-noborder">
23
- <RoleLink id={member.member} />
24
- </li>
25
- );
26
- });
27
-
28
- var resourceId = [
29
- conjur.app.configuration.account,
30
- 'group',
31
- data.group.id
32
- ].join(':');
33
-
34
- var group = data.group;
35
-
36
- // TODO: refactor (common code should go to mixins)
37
- // TODO: memberships
38
- // TODO: controls for members management
39
- var overviewTab =(
40
- <TabPane key="overview" tab="Overview">
41
- <dl className="dl-horizontal">
42
- <dt>Created by</dt>
43
- <dd><RoleLink id={group.userid} /></dd>
44
-
45
- <dt>Owner</dt>
46
- <dd><RoleLink id={data.owner} /></dd>
47
- </dl>
48
- </TabPane>
49
- );
50
-
51
- var membersTab = (
52
- <TabPane key="members" tab={conjur.utils.getTabname('Members', members)}>
53
- <ul className="list-group">
54
- {members}
55
- </ul>
56
- </TabPane>
57
- );
58
-
59
- var ownedTab = this.ownedTab(),
60
- membershipsTab = this.membershipsTab(group.roleid),
61
- permissionsTab = this.permissionsTab(group.roleid),
62
- annotationsTab = this.annotationsTab();
63
-
64
- var auditTab = (
65
- <TabPane key="audit" tab="Recent Activity">
66
- <div className="audit auditGroup">
67
- <AuditBox roles={[resourceId]}
68
- resources={[resourceId]}
69
- tabview={true} />
70
- </div>
71
- </TabPane>
72
- );
73
-
74
- var tabs = _.compact([
75
- overviewTab,
76
- membersTab,
77
- ownedTab,
78
- membershipsTab,
79
- permissionsTab,
80
- annotationsTab,
81
- auditTab
82
- ]);
83
-
84
- var elems = [
85
- {url: '/ui/groups', text: 'Groups'},
86
- {url: '', text: this.props.data.group.id},
87
- {url: '', text: '(owned by ' + this.props.data.group.ownerid + ')'}
88
- ];
89
-
90
- return (
91
- <div className="b-group">
92
- <Breadcrumbs elems={elems} />
93
- <hr />
94
- <h2>Group {data.group.id}</h2>
95
- <TabbedArea defaultActiveKey="overview">
96
- {tabs}
97
- </TabbedArea>
98
- </div>
99
- );
100
- }
101
- });
102
-
103
- }).bind(conjur.views)
104
- (
105
- conjur,
106
- React,
107
- ReactBootstrap,
108
- _
109
- );
@@ -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.GroupBox = React.createClass({
10
- render: function() {
11
- return (
12
- <div className="groupBox">
13
- <div className="groupList">
14
- <h2>Groups</h2>
15
- <GenericList data={{kind: 'groups', members: this.props.data.members}} />
16
- </div>
17
- </div>
18
- );
19
- }
20
- });
21
-
22
- }).bind(conjur.views)
23
- (
24
- conjur,
25
- React
26
- );
@@ -1,200 +0,0 @@
1
- /** @jsx React.DOM */
2
- /* global conjur, React, ReactBootstrap, _ */
3
-
4
- (function(conjur, React, ReactBootstrap, _) {
5
- 'use strict';
6
-
7
- var TabbedArea = ReactBootstrap.TabbedArea,
8
- TabPane = ReactBootstrap.TabPane,
9
- Tab = conjur.views.mixins.Tab,
10
- AuditBox = window.AuditBox,
11
- AnnotationsBox = conjur.views.AnnotationsBox,
12
- Breadcrumbs = conjur.views.Breadcrumbs,
13
- RoleLink = conjur.views.RoleLink,
14
- Time = conjur.views.Time,
15
- Chart = conjur.views.Chart,
16
- ChartHelperMixin = conjur.views.ChartHelperMixin,
17
- FoldableAuditSection = conjur.views.FoldableAuditSection;
18
-
19
- this.HostLink = React.createClass({
20
- hostId : function() {
21
- return this.props.data.split(':')[2];
22
- },
23
-
24
- hostUrl: function() {
25
- return '/ui/hosts/' + window.encodeURIComponent(this.hostId());
26
- },
27
-
28
- render: function() {
29
- return (
30
- <a href={this.hostUrl()}>
31
- {this.hostId()}
32
- </a>
33
- );
34
- }
35
- });
36
-
37
- var Activity = React.createClass({
38
- mixins: [ChartHelperMixin],
39
-
40
- getDefaultProps: function() {
41
- return {
42
- options: {
43
- legend: {
44
- logins: 'Logins to host',
45
- sudo: 'Sudo calls on host',
46
- reads: 'Secret reads by host',
47
- updates: 'Secret updates by host',
48
- warnings: 'Warnings'
49
- },
50
- axis: {
51
- y: {
52
- label: 'Value'
53
- }
54
- }
55
- }
56
- };
57
- },
58
-
59
- getDefaultItem: function() {
60
- return {
61
- logins: 0,
62
- sudo: 0,
63
- reads: 0,
64
- updates: 0,
65
- warnings: 0
66
- };
67
- },
68
-
69
- getEventType: function(e) {
70
- if (e.hasOwnProperty('facility') && e.facility === 'ssh') {
71
- if (e.action === 'sudo' && e.allowed === true) {
72
- return 'sudo';
73
- }
74
-
75
- if (e.action === 'login' && e.allowed === true) {
76
- return 'logins';
77
- }
78
- }
79
-
80
- if (e.hasOwnProperty('error') || e.allowed === false) {
81
- return 'warnings';
82
- }
83
-
84
- if (e.action === 'check' &&
85
- e.hasOwnProperty('allowed') &&
86
- e.allowed === true) {
87
-
88
- if (e.hasOwnProperty('role') && e.role === this.props.roleid) {
89
- if (e.hasOwnProperty('resource') &&
90
- e.resource.split(':')[1] === 'variable') {
91
-
92
- if (e.privilege === 'update') {
93
- return 'updates';
94
- }
95
-
96
- if (e.privilege === 'execute') {
97
- return 'reads';
98
- }
99
- }
100
- }
101
- }
102
-
103
- return null;
104
- },
105
-
106
- render: function() {
107
- var data = this.getData(this.props.audit);
108
-
109
- return (
110
- <div className="b-host-activity">
111
- <h2>Activity</h2>
112
- <div className="b-host-activity__graph">
113
- <Chart options={this.props.options}
114
- data={data} />
115
- </div>
116
- </div>
117
- );
118
- }
119
- });
120
-
121
- var Details = React.createClass({
122
- render: function() {
123
- // TODO: control for 'enroll'
124
- return (
125
- <div className="b-host-details">
126
- <h2>Details</h2>
127
- <dl className="dl-horizontal">
128
- <dt>Owner</dt>
129
- <dd><RoleLink id={this.props.owner}/></dd>
130
-
131
- <dt>Created by</dt>
132
- <dd><RoleLink id={this.props.host.userid}/></dd>
133
-
134
- <dt>Created At</dt>
135
- <dd><Time timestamp={this.props.host.created_at}/></dd>
136
- </dl>
137
- </div>
138
- );
139
- }
140
- });
141
-
142
- this.Host = React.createClass({
143
- mixins: [Tab],
144
-
145
- render: function() {
146
- var host = this.props.data.host,
147
- permissionsTab = this.permissionsTab(host.roleid),
148
- membershipsTab = this.membershipsTab(host.roleid),
149
- ownedTab = this.ownedTab();
150
-
151
- var tabs = _.compact([
152
- membershipsTab,
153
- ownedTab,
154
- permissionsTab
155
- ]);
156
-
157
- var elems = [
158
- {url: '/ui/hosts', text: 'Hosts'},
159
- {url: '', text: this.props.data.host.id},
160
- {url: '', text: '(owned by ' + this.props.data.host.ownerid + ')'}
161
- ];
162
-
163
- return (
164
- <div className="b-host">
165
- <Breadcrumbs elems={elems} />
166
- <hr />
167
- <Activity audit={this.props.data.audit} roleid={host.roleid}/>
168
- <hr />
169
- {FoldableAuditSection.warnings(this.props.data.audit)}
170
- <hr />
171
- <div className="row">
172
- <div className="col-md-6">
173
- <Details owner={this.props.data.owner}
174
- host={host} />
175
- </div>
176
- <div className="col-md-6">
177
- <h2>Annotations</h2>
178
- <AnnotationsBox annotations={this.props.data.annotations} />
179
- </div>
180
- </div>
181
- <hr/>
182
- <h2>Other</h2>
183
- <TabbedArea>
184
- {tabs}
185
- </TabbedArea>
186
- <hr />
187
- <AuditBox roles={[host.roleid]}
188
- resources={[host.resource_identifier]} />
189
- </div>
190
- );
191
- }
192
- });
193
-
194
- }).bind(conjur.views)
195
- (
196
- conjur,
197
- React,
198
- ReactBootstrap,
199
- _
200
- );