conjur-asset-ui 1.3.0 → 1.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (81) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +3 -1
  3. data/.jshintrc +41 -0
  4. data/Gemfile +3 -1
  5. data/README.md +34 -0
  6. data/Rakefile +69 -1
  7. data/bower.json +93 -0
  8. data/conjur-asset-ui.gemspec +1 -1
  9. data/features/navigation_bar.feature +31 -0
  10. data/features/step_definitions/custom_step.rb +32 -0
  11. data/features/support/env.rb +38 -0
  12. data/features/support/hooks.rb +30 -0
  13. data/features/support/world.rb +17 -0
  14. data/gulpfile.js +140 -0
  15. data/lib/conjur/command/ui.rb +1 -1
  16. data/lib/conjur/webserver/server.rb +14 -9
  17. data/lib/conjur-asset-ui-version.rb +1 -1
  18. data/package.json +47 -0
  19. data/preprocessor.js +7 -0
  20. data/public/_client_libs.html +2 -15
  21. data/public/css/styles.less +170 -4
  22. data/public/index.html.erb +5 -7
  23. data/public/js/init.js +183 -97
  24. data/public/js/lib/sorted-set.no-require.js +3 -28
  25. data/public/js/models/groupRecord.js +12 -11
  26. data/public/js/models/hostRecord.js +6 -7
  27. data/public/js/models/layerRecord.js +12 -11
  28. data/public/js/models/namespace.js +2 -0
  29. data/public/js/models/policyList.js +3 -1
  30. data/public/js/models/policyRecord.js +6 -7
  31. data/public/js/models/record.js +24 -23
  32. data/public/js/models/resourceList.js +28 -10
  33. data/public/js/models/userList.js +7 -2
  34. data/public/js/models/userRecord.js +7 -8
  35. data/public/js/models/variableList.js +18 -7
  36. data/public/js/models/variableRecord.js +13 -12
  37. data/public/js/routers.js +72 -26
  38. data/public/js/views/annotations.js +38 -27
  39. data/public/js/views/audit.js +23 -17
  40. data/public/js/views/chart.js +471 -0
  41. data/public/js/views/dashboard.js +94 -58
  42. data/public/js/views/generic.js +16 -9
  43. data/public/js/views/group.js +94 -55
  44. data/public/js/views/groups.js +3 -7
  45. data/public/js/views/host.js +75 -44
  46. data/public/js/views/hosts.js +2 -6
  47. data/public/js/views/layer.js +127 -82
  48. data/public/js/views/layers.js +2 -6
  49. data/public/js/views/mixins/search.js +12 -5
  50. data/public/js/views/mixins/tabs.js +95 -55
  51. data/public/js/views/navSearch.js +16 -5
  52. data/public/js/views/owned.js +14 -8
  53. data/public/js/views/permissions.js +244 -178
  54. data/public/js/views/policies.js +2 -4
  55. data/public/js/views/policy.js +65 -38
  56. data/public/js/views/resource.js +49 -34
  57. data/public/js/views/role.js +52 -37
  58. data/public/js/views/searchResults.js +205 -138
  59. data/public/js/views/time.js +26 -13
  60. data/public/js/views/user.js +178 -55
  61. data/public/js/views/users.js +2 -7
  62. data/public/js/views/variable.js +226 -45
  63. data/public/js/views/variables.js +4 -8
  64. metadata +20 -20
  65. data/public/_client_code.html +0 -42
  66. data/public/css/bootstrap.css +0 -7
  67. data/public/fonts/glyphicons-halflings-regular.eot +0 -0
  68. data/public/fonts/glyphicons-halflings-regular.svg +0 -229
  69. data/public/fonts/glyphicons-halflings-regular.ttf +0 -0
  70. data/public/fonts/glyphicons-halflings-regular.woff +0 -0
  71. data/public/js/lib/JSXTransformer.js +0 -10862
  72. data/public/js/lib/async.js +0 -958
  73. data/public/js/lib/backbone.js +0 -2
  74. data/public/js/lib/bootstrap.js +0 -6
  75. data/public/js/lib/less.js +0 -16
  76. data/public/js/lib/moment.js +0 -7768
  77. data/public/js/lib/react-bootstrap.js +0 -5346
  78. data/public/js/lib/react-bootstrap.min.js +0 -4
  79. data/public/js/lib/underscore-min.js +0 -6
  80. data/public/js/lib/underscore.string.min.js +0 -1
  81. data/public/js/main.js +0 -57
data/public/js/routers.js CHANGED
@@ -1,14 +1,23 @@
1
1
  /** @jsx React.DOM */
2
+ /* global conjur, jQuery, _, Backbone, React */
2
3
 
3
- (function(conjur, $, _, Backbone, React, SearchResults) {
4
+
5
+ (function(conjur, $, _, Backbone, React) {
4
6
  'use strict';
5
7
 
6
- var GroupBox = conjur.views.GroupBox,
8
+ var Dashboard = conjur.views.Dashboard,
9
+ GroupBox = conjur.views.GroupBox,
7
10
  LayerBox = conjur.views.LayerBox,
8
11
  PolicyBox = conjur.views.PolicyBox,
9
12
  VariableBox = conjur.views.VariableBox,
10
- HostBox = conjur.views.HostBox,
11
- UserBox = conjur.views.UserBox;
13
+ UserBox = conjur.views.UserBox,
14
+ Group = conjur.views.Group,
15
+ Host = conjur.views.Host,
16
+ Layer = conjur.views.Layer,
17
+ Policy = conjur.views.Policy,
18
+ User = conjur.views.User,
19
+ Variable = conjur.views.Variable,
20
+ SearchResults = conjur.views.SearchResults;
12
21
 
13
22
  conjur.Workspace = Backbone.Router.extend({
14
23
  routes: {
@@ -37,7 +46,8 @@
37
46
 
38
47
  conjur.app.lists[conjur.app.kind].fetch(function(list) {
39
48
  var component = componentFunction(list);
40
- // doesn't make much sense due to http://stackoverflow.com/questions/24889934/componentinstance-setstate-undefined-in-0-11-0
49
+ // doesn't make much sense due to
50
+ // http://stackoverflow.com/questions/24889934/componentinstance-setstate-undefined-in-0-11-0
41
51
  //components[kind] = component;
42
52
 
43
53
  React.renderComponent(
@@ -45,8 +55,11 @@
45
55
  document.getElementById('content')
46
56
  );
47
57
 
48
- // state reset won't work anymore in react v11, plus I am not sure how it is supposed to work, if namespace was just reset to zero
49
- // component.setState({currentNamespace: namespace.currentNamespace, members: list.members(namespace.currentNamespace)});
58
+ // state reset won't work anymore in react v11,
59
+ // plus I am not sure how it is supposed to work,
60
+ // if namespace was just reset to zero
61
+ // component.setState({currentNamespace: namespace.currentNamespace,
62
+ // members: list.members(namespace.currentNamespace)});
50
63
  });
51
64
  },
52
65
 
@@ -73,9 +86,11 @@
73
86
  component,
74
87
  document.getElementById('content')
75
88
  );
76
- }, function(status, text, xhr) {
77
- if (status == 403) {
78
- conjur.app.flash = 'You are not authorized to view ' + conjur.app.kind + ':' + id + '.';
89
+ }, function(status, text) {
90
+ if (status === 403) {
91
+ conjur.app.flash = 'You are not authorized to view ' +
92
+ conjur.app.kind + ':' + id + '.';
93
+
79
94
  window.history.back();
80
95
  } else {
81
96
  console.error('HTTP error: ', status, text);
@@ -98,7 +113,9 @@
98
113
 
99
114
  user: function(user) {
100
115
  this.activateRecord('user', user, function(record) {
101
- return <User data={record}/>;
116
+ return (
117
+ <User data={record}/>
118
+ );
102
119
  });
103
120
  },
104
121
 
@@ -107,13 +124,17 @@
107
124
  conjur.app.kind = 'users';
108
125
 
109
126
  this.activateList(function(list) {
110
- return <UserBox data={{namespaces: list.namespaces, members: list.members('')}} />;
127
+ return (
128
+ <UserBox data={{namespaces: list.namespaces, members: list.members('')}} />
129
+ );
111
130
  });
112
131
  },
113
132
 
114
133
  group: function(group) {
115
134
  this.activateRecord('group', group, function(record) {
116
- return <Group data={record} />;
135
+ return (
136
+ <Group data={record} />
137
+ );
117
138
  });
118
139
  },
119
140
 
@@ -122,13 +143,17 @@
122
143
  conjur.app.kind = 'groups';
123
144
 
124
145
  this.activateList(function(list) {
125
- return <GroupBox data={{namespaces: list.namespaces, members: list.members('')}} />;
146
+ return (
147
+ <GroupBox data={{namespaces: list.namespaces, members: list.members('')}} />
148
+ );
126
149
  });
127
150
  },
128
151
 
129
- host: function(host){
152
+ host: function(host) {
130
153
  this.activateRecord('host', host, function(record) {
131
- return <Host data={record}/>;
154
+ return (
155
+ <Host data={record}/>
156
+ );
132
157
  });
133
158
  },
134
159
 
@@ -138,13 +163,17 @@
138
163
  var HostBox = conjur.views.HostBox;
139
164
 
140
165
  this.activateList(function(list) {
141
- return <HostBox data={{namespaces: list.namespaces, members: list.members('')}} />;
166
+ return (
167
+ <HostBox data={{namespaces: list.namespaces, members: list.members('')}} />
168
+ );
142
169
  });
143
170
  },
144
171
 
145
172
  layer: function(layer) {
146
173
  this.activateRecord('layer', layer, function(record) {
147
- return <Layer data={record} />;
174
+ return (
175
+ <Layer data={record} />
176
+ );
148
177
  });
149
178
  },
150
179
 
@@ -153,13 +182,17 @@
153
182
  conjur.app.kind = 'layers';
154
183
 
155
184
  this.activateList(function(list) {
156
- return <LayerBox data={{namespaces: list.namespaces, members: list.members('')}} />;
185
+ return (
186
+ <LayerBox data={{namespaces: list.namespaces, members: list.members('')}} />
187
+ );
157
188
  });
158
189
  },
159
190
 
160
191
  variable: function(variable) {
161
192
  this.activateRecord('variable', variable, function(record) {
162
- return <Variable data={record} />;
193
+ return (
194
+ <Variable data={record} />
195
+ );
163
196
  });
164
197
  },
165
198
 
@@ -168,7 +201,9 @@
168
201
  conjur.app.kind = 'variables';
169
202
 
170
203
  this.activateList(function(list) {
171
- return <VariableBox data={{namespaces: list.namespaces, members: list.members('')}} />;
204
+ return (
205
+ <VariableBox data={{namespaces: list.namespaces, members: list.members('')}} />
206
+ );
172
207
  });
173
208
  },
174
209
 
@@ -176,17 +211,21 @@
176
211
  conjur.app.kind = 'policies';
177
212
 
178
213
  this.activateList(function(list) {
179
- return <PolicyBox data={{members: list.members('')}} />;
214
+ return (
215
+ <PolicyBox data={{members: list.members('')}} />
216
+ );
180
217
  });
181
218
  },
182
219
 
183
220
  policy: function(policy) {
184
221
  this.activateRecord('policy', policy, function(record) {
185
- return <Policy data={record} />;
222
+ return (
223
+ <Policy data={record} />
224
+ );
186
225
  });
187
226
  },
188
227
 
189
- audit: function(){
228
+ audit: function() {
190
229
  $('#inlineSearchContainer').show();
191
230
  this.setActiveNav('audit');
192
231
 
@@ -196,10 +235,17 @@
196
235
  );
197
236
  },
198
237
 
199
- search: function(search){
238
+ search: function(search) {
200
239
  $('#inlineSearchContainer').show();
201
240
  SearchResults.search(search);
202
241
  }
203
242
  });
204
243
 
205
- })(conjur, jQuery, _, Backbone, React, SearchResults);
244
+ })
245
+ (
246
+ conjur,
247
+ jQuery,
248
+ _,
249
+ Backbone,
250
+ React
251
+ );
@@ -1,36 +1,47 @@
1
1
  /** @jsx React.DOM */
2
+ /* global conjur, React */
2
3
 
3
- var AnnotationsBox = React.createClass({
4
- render: function() {
5
-
6
- if (!this.props.annotations || !this.props.annotations.length>0 ) {
7
- return <div>
8
- <span>None</span>
9
- </div>;
10
- }
4
+ (function(conjur, React) {
5
+ 'use strict';
11
6
 
12
- // TODO: sort by date (optionally)
13
- // TODO: table view
14
- var annotations_list = [];
15
- this.props.annotations.sort(function(a,b) {
16
- return a.name.toLowerCase().localeCompare(b.name.toLowerCase());
17
- }).forEach(function(item){
18
- var itemname = item.name;
19
- var itemvalue = item.value;
7
+ this.AnnotationsBox = React.createClass({
8
+ render: function() {
9
+ if (!this.props.annotations || this.props.annotations.length === 0) {
10
+ return (
11
+ <div>
12
+ <span>None</span>
13
+ </div>
14
+ );
15
+ }
20
16
 
21
- var dt_key = "annotation_"+itemname+"_key";
22
- var dd_key = "annotation_"+itemname+"_value";
23
-
24
- annotations_list.push(<dt key={dt_key}>{itemname}</dt>);
25
- annotations_list.push(<dd key={dd_key}>{itemvalue}</dd>);
26
- });
17
+ // TODO: sort by date (optionally)
18
+ // TODO: table view
19
+ var annotationsList = [];
27
20
 
21
+ this.props.annotations.sort(function(a, b) {
22
+ return a.name.toLowerCase().localeCompare(b.name.toLowerCase());
23
+ }).forEach(function(item) {
24
+ var itemName = item.name,
25
+ itemValue = item.value,
26
+ term = 'annotation_' + itemName + '_key',
27
+ description = 'annotation_' + itemName + '_value';
28
28
 
29
- return <div>
29
+ annotationsList.push(<dt key={term}>{itemName}</dt>);
30
+ annotationsList.push(<dd key={description}>{itemValue}</dd>);
31
+ });
32
+
33
+ return (
34
+ <div>
30
35
  <dl className="annotations dl-horizontal">
31
- {annotations_list}
36
+ {annotationsList}
32
37
  </dl>
33
- </div>;
34
- }
35
- }
38
+ </div>
39
+ );
40
+ }
41
+ });
42
+
43
+ }).bind(conjur.views)
44
+ (
45
+ conjur,
46
+ React
36
47
  );
@@ -6,7 +6,7 @@
6
6
  ref$ = React.DOM, em = ref$.em, strong = ref$.strong, table = ref$.table, div = ref$.div, th = ref$.th, tr = ref$.tr, td = ref$.td, thead = ref$.thead, tbody = ref$.tbody, section = ref$.section, h3 = ref$.h3, time = ref$.time;
7
7
  ref$ = require('prelude-ls'), map = ref$.map, each = ref$.each, unique = ref$.unique, isType = ref$.isType, join = ref$.join;
8
8
  compact_fields = ['auditview_user', 'auditview_action'];
9
- //extended_fields = ['timestamp', 'user', 'acting_as', 'action', 'entities', 'privilege','human'];
9
+ //extended_fields = ['timestamp', 'user', 'acting_as', 'action', 'entities', 'privilege','human'];
10
10
  extended_fields = ['timestamp','auditview_user','auditview_action'];
11
11
  known_rolsource_types = [ 'user','group','host','layer','policy']; // what if somebody explicitly will create the role of such type?
12
12
  FieldsMixin = {
@@ -59,6 +59,9 @@
59
59
  // copy of SHORT_FORMATS logic from cli-ruby:lib/conjur/command/audit.rb
60
60
  var msg="";
61
61
 
62
+ var ResourceLink = conjur.views.ResourceLink;
63
+ var RoleLink = conjur.views.RoleLink;
64
+
62
65
  if ((e.kind=='resource') && (e.action=='check')) {
63
66
  msg = [ ]
64
67
  if ( e.allowed ) {
@@ -84,7 +87,7 @@
84
87
  } else if ((e.kind=="resource") && (e.action=="permit")) {
85
88
  msg = [ " permitted ", RoleLink({id: e.grantee, noIcon: true}), " to ", em({}, e.privilege), " ", ResourceLink({id: e.resource, noIcon: true}) ]
86
89
  if ( e.grant_option )
87
- msg.push(" with grant option");
90
+ msg.push(" with grant option");
88
91
  } else if ((e.kind=="resource") && (e.action=="deny")) {
89
92
  msg = [ " denied ", em({}, e.privilege), " from ", RoleLink({id: e.grantee, noIcon: true}), " on ", ResourceLink({id: e.resource, noIcon: true}) ];
90
93
  } else if ((e.kind=="resource") && (e.action=="permitted_roles")) {
@@ -126,24 +129,24 @@
126
129
  var parts = [action_part];
127
130
  if (e.role!=null) {
128
131
  parts.push(" by ");
129
- parts.push(RoleLink({id: e.role, noIcon: true}));
132
+ parts.push(RoleLink({id: e.role, noIcon: true}));
130
133
  }
131
- if (e.resource_id!=null) {
134
+ if (e.resource_id!=null) {
132
135
  parts.push(" on");
133
- parts.push(ResourceLink({id: e.resource_id, noIcon: true}));
136
+ parts.push(ResourceLink({id: e.resource_id, noIcon: true}));
134
137
  }
135
- if (e.allowed!=null) {
136
- parts.push(" (allowed: "+e.allowed+")");
138
+ if (e.allowed!=null) {
139
+ parts.push(" (allowed: "+e.allowed+")");
137
140
  }
138
141
  var statement = parts.join(" ");
139
142
  msg = [" reported ", parts ];
140
- if (e.audit_message!=null) {
143
+ if (e.audit_message!=null) {
141
144
  msg.push("; message: ");
142
145
  msg.push(e.audit_message);
143
146
  }
144
147
  } else {
145
148
  msg+=" unknown event: "+e.kind+":"+e.action+"!";
146
- }
149
+ }
147
150
 
148
151
  if (e.error!=null) {
149
152
  msg+=" (failed with "+e.error+")";
@@ -152,6 +155,9 @@
152
155
  return msg;
153
156
  },
154
157
  transformField: function(key, value){
158
+ var ResourceLink = conjur.views.ResourceLink;
159
+ var RoleLink = conjur.views.RoleLink;
160
+
155
161
  var that;
156
162
  switch (key) {
157
163
  case 'entities':
@@ -179,7 +185,7 @@
179
185
  break;
180
186
  case 'auditview_user': //virtual field
181
187
  var acting_user =this.props.user;
182
- var acting_role = this.props.acting_as;
188
+ var acting_role = this.props.acting_as;
183
189
  msg = [ RoleLink({id: acting_user}) ];
184
190
  if ((acting_role!=null) && (acting_role != acting_user)) {
185
191
  msg.push([" as ", RoleLink({id: acting_role})]);
@@ -192,7 +198,7 @@
192
198
  });
193
199
  }
194
200
  break;
195
- case 'auditview_action':
201
+ case 'auditview_action':
196
202
  return this.humanizeEvent(this.props);
197
203
  default:
198
204
  return value;
@@ -233,7 +239,7 @@
233
239
  events: newEventSet()
234
240
  };
235
241
  },
236
- knownRolsourceTypes: function() {
242
+ knownRolsourceTypes: function() {
237
243
  return ;
238
244
  },
239
245
  render: function(){
@@ -250,7 +256,7 @@
250
256
  compact: compact
251
257
  }), tbody({
252
258
  key: 'tbody'
253
- }, this.state.events.filter(function(ev){
259
+ }, this.state.events.filter(function(ev){
254
260
  // remove internal resources creation
255
261
  if ((ev.role!=null) && (ev.role.split(':')[1] == '@')) {
256
262
  return false;
@@ -270,12 +276,12 @@
270
276
  var rolekind = ev.role.split(':')[1];
271
277
  if (_.contains(known_rolsource_types, rolekind)) {
272
278
  return false;
273
- }
274
- }
279
+ }
280
+ }
275
281
  return true;
276
282
  }).map(function(it){
277
283
  // new way to clone objects, custom clone$ does not work no more as expected
278
- var ref$ = React.addons.update(it, {$merge: {key: it.id, compact: compact} });
284
+ var ref$ = React.addons.update(it, {$merge: {key: it.id, compact: compact} });
279
285
  return new AuditEntry(ref$);
280
286
  }))
281
287
  ])
@@ -345,7 +351,7 @@
345
351
  resources);
346
352
  things = join(', ')(
347
353
  unique(
348
- roles.concat(resources)));
354
+ roles.concat(resources)));
349
355
 
350
356
  var options= { src: roleSrcs.concat(resSrcs) };
351
357
  if (this.props.tabview==null) {