conjur-asset-ui 1.3.2 → 1.4.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (128) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +3 -1
  3. data/.jshintrc +41 -0
  4. data/CHANGELOG.md +7 -0
  5. data/Gemfile +3 -1
  6. data/README.md +38 -4
  7. data/Rakefile +69 -1
  8. data/TODO.md +31 -0
  9. data/bower.json +98 -0
  10. data/conjur-asset-ui.gemspec +3 -3
  11. data/features/navigation_bar.feature +31 -0
  12. data/features/step_definitions/custom_step.rb +32 -0
  13. data/features/support/env.rb +38 -0
  14. data/features/support/hooks.rb +30 -0
  15. data/features/support/world.rb +17 -0
  16. data/gulpfile.js +139 -0
  17. data/lib/conjur/command/ui.rb +1 -1
  18. data/lib/conjur/webserver/server.rb +14 -8
  19. data/lib/conjur-asset-ui-version.rb +1 -1
  20. data/package.json +47 -0
  21. data/preprocessor.js +7 -0
  22. data/public/_client_libs.html +1 -16
  23. data/public/build/css/styles.css +87 -0
  24. data/public/build/css/vendor.css +5 -0
  25. data/public/build/fonts/glyphicons-halflings-regular.eot +0 -0
  26. data/public/{fonts → build/fonts}/glyphicons-halflings-regular.svg +47 -47
  27. data/public/{fonts → build/fonts}/glyphicons-halflings-regular.ttf +0 -0
  28. data/public/build/fonts/glyphicons-halflings-regular.woff +0 -0
  29. data/public/build/js/app.min.js +4 -0
  30. data/public/build/js/vendor.min.js +23 -0
  31. data/public/build/maps/app.min.js.map +1 -0
  32. data/public/build/maps/vendor.min.js.map +1 -0
  33. data/public/css/styles.less +246 -17
  34. data/public/index.html.erb +11 -10
  35. data/public/js/init.js +186 -97
  36. data/public/js/lib/sorted-set.no-require.js +3 -28
  37. data/public/js/models/groupRecord.js +14 -12
  38. data/public/js/models/hostRecord.js +13 -8
  39. data/public/js/models/layerRecord.js +14 -12
  40. data/public/js/models/namespace.js +2 -0
  41. data/public/js/models/policyList.js +3 -1
  42. data/public/js/models/policyRecord.js +8 -8
  43. data/public/js/models/record.js +59 -27
  44. data/public/js/models/resourceList.js +28 -10
  45. data/public/js/models/userList.js +7 -2
  46. data/public/js/models/userRecord.js +14 -9
  47. data/public/js/models/variableList.js +18 -7
  48. data/public/js/models/variableRecord.js +18 -14
  49. data/public/js/routers.js +74 -37
  50. data/public/js/views/annotations.js +39 -28
  51. data/public/js/views/audit.js +31 -25
  52. data/public/js/views/breadcrumbs.js +62 -0
  53. data/public/js/views/chart.js +617 -0
  54. data/public/js/views/dashboard.js +144 -65
  55. data/public/js/views/generic.js +16 -9
  56. data/public/js/views/group.js +103 -55
  57. data/public/js/views/groups.js +3 -7
  58. data/public/js/views/host.js +192 -56
  59. data/public/js/views/hosts.js +2 -6
  60. data/public/js/views/layer.js +136 -82
  61. data/public/js/views/layers.js +2 -6
  62. data/public/js/views/mixins/search.js +12 -5
  63. data/public/js/views/mixins/tabs.js +95 -55
  64. data/public/js/views/navSearch.js +16 -5
  65. data/public/js/views/owned.js +14 -8
  66. data/public/js/views/permissions.js +244 -178
  67. data/public/js/views/policies.js +2 -4
  68. data/public/js/views/policy.js +65 -38
  69. data/public/js/views/resource.js +54 -34
  70. data/public/js/views/role.js +59 -37
  71. data/public/js/views/searchResults.js +205 -138
  72. data/public/js/views/sections.js +226 -0
  73. data/public/js/views/time.js +38 -13
  74. data/public/js/views/user.js +288 -59
  75. data/public/js/views/users.js +2 -7
  76. data/public/js/views/variable.js +293 -53
  77. data/public/js/views/variables.js +4 -8
  78. metadata +34 -56
  79. data/.git-hooks/pre_commit/ensure_livescript_compiled.rb +0 -31
  80. data/.overcommit.yml +0 -5
  81. data/compile_ls +0 -6
  82. data/livescript/views/audit.ls +0 -136
  83. data/public/_client_code.html +0 -42
  84. data/public/css/bootstrap.css +0 -7
  85. data/public/fonts/glyphicons-halflings-regular.eot +0 -0
  86. data/public/fonts/glyphicons-halflings-regular.woff +0 -0
  87. data/public/js/lib/JSXTransformer.js +0 -10862
  88. data/public/js/lib/async.js +0 -958
  89. data/public/js/lib/backbone.js +0 -2
  90. data/public/js/lib/bootstrap.js +0 -6
  91. data/public/js/lib/date.extensions.js +0 -141
  92. data/public/js/lib/less.js +0 -16
  93. data/public/js/lib/moment.js +0 -7768
  94. data/public/js/lib/prelude-browser-min.js +0 -1
  95. data/public/js/lib/react-bootstrap.js +0 -5346
  96. data/public/js/lib/react-bootstrap.min.js +0 -4
  97. data/public/js/lib/underscore-min.js +0 -6
  98. data/public/js/lib/underscore.string.min.js +0 -1
  99. data/public/js/main.js +0 -57
  100. data/vendor/prelude-ls/.gitignore +0 -2
  101. data/vendor/prelude-ls/.travis.yml +0 -3
  102. data/vendor/prelude-ls/CHANGELOG.md +0 -81
  103. data/vendor/prelude-ls/LICENSE +0 -22
  104. data/vendor/prelude-ls/Makefile +0 -50
  105. data/vendor/prelude-ls/README.md +0 -15
  106. data/vendor/prelude-ls/browser/prelude-browser-min.js +0 -1
  107. data/vendor/prelude-ls/browser/prelude-browser.js +0 -1172
  108. data/vendor/prelude-ls/lib/Func.js +0 -40
  109. data/vendor/prelude-ls/lib/List.js +0 -602
  110. data/vendor/prelude-ls/lib/Num.js +0 -129
  111. data/vendor/prelude-ls/lib/Obj.js +0 -153
  112. data/vendor/prelude-ls/lib/Str.js +0 -68
  113. data/vendor/prelude-ls/lib/index.js +0 -164
  114. data/vendor/prelude-ls/package.json +0 -50
  115. data/vendor/prelude-ls/package.ls +0 -46
  116. data/vendor/prelude-ls/src/Func.ls +0 -17
  117. data/vendor/prelude-ls/src/List.ls +0 -299
  118. data/vendor/prelude-ls/src/Num.ls +0 -83
  119. data/vendor/prelude-ls/src/Obj.ls +0 -61
  120. data/vendor/prelude-ls/src/Str.ls +0 -32
  121. data/vendor/prelude-ls/src/index.ls +0 -56
  122. data/vendor/prelude-ls/test/Func.ls +0 -36
  123. data/vendor/prelude-ls/test/List.ls +0 -751
  124. data/vendor/prelude-ls/test/Num.ls +0 -258
  125. data/vendor/prelude-ls/test/Obj.ls +0 -145
  126. data/vendor/prelude-ls/test/Prelude.ls +0 -49
  127. data/vendor/prelude-ls/test/Str.ls +0 -208
  128. data/vendor/prelude-ls/test/browser.html +0 -5
@@ -1,3 +1,5 @@
1
+ /* global conjur, async */
2
+
1
3
  (function(conjur, async, errback) {
2
4
  'use strict';
3
5
 
@@ -18,29 +20,32 @@
18
20
  Host.prototype = Object.create(Generic.prototype);
19
21
  Host.prototype.constructor = Host;
20
22
 
21
- Host.prototype.fetch = function(callback, custom_errback) {
22
- var self = this,
23
- id = this.id;
23
+ Host.prototype.fetch = function(callback, customErrback) {
24
+ var self = this;
24
25
 
25
- if (typeof(custom_errback) === 'undefined') {
26
- custom_errback = errback; // reset to default
26
+ if (typeof(customErrback) === 'undefined') {
27
+ customErrback = errback; // reset to default
27
28
  }
28
29
 
29
30
  async.parallel([
30
31
  this.attributes.bind(this),
31
32
  this.ownedResources.bind(this),
32
33
  this.allRoles.bind(this),
33
- this.resource.bind(this)
34
+ this.resource.bind(this),
35
+ this.auditRole.bind(this),
36
+ this.auditResource.bind(this)
34
37
  ], function(err, results) {
35
38
  if (err) {
36
- return custom_errback(err.status);
39
+ return customErrback(err.status);
37
40
  }
38
41
 
39
42
  callback({
40
43
  host: results[0],
41
44
  owned: results[1],
42
45
  roles: results[2],
43
- annotations: results[3].annotations
46
+ annotations: results[3].annotations,
47
+ owner: results[3].owner,
48
+ audit: self.mergeAudit(results[4], results[5])
44
49
  });
45
50
 
46
51
  return undefined;
@@ -1,3 +1,5 @@
1
+ /* global conjur, jQuery, _, async */
2
+
1
3
  (function(conjur, $, _, async, errback) {
2
4
  'use strict';
3
5
 
@@ -18,22 +20,21 @@
18
20
  Layer.prototype = Object.create(Generic.prototype);
19
21
  Layer.prototype.constructor = Layer;
20
22
 
21
- Layer.prototype.fetch = function(callback, custom_errback) {
22
- var self = this,
23
- id = this.id;
23
+ Layer.prototype.fetch = function(callback, customErrback) {
24
+ var id = this.id;
24
25
 
25
- if (typeof(custom_errback) === 'undefined') {
26
- custom_errback = errback; // reset to default
26
+ if (typeof(customErrback) === 'undefined') {
27
+ customErrback = errback; // reset to default
27
28
  }
28
29
 
29
30
  function members(role) {
30
31
  return function(cb) {
31
32
  $.ajax({
32
- url: '/api/authz/'
33
- + conjur.app.configuration.account
34
- + '/roles/'
35
- + role
36
- + '?members',
33
+ url: '/api/authz/' +
34
+ conjur.app.configuration.account +
35
+ '/roles/' +
36
+ role +
37
+ '?members',
37
38
  success: function(result) {
38
39
  cb(null, result);
39
40
  },
@@ -51,7 +52,7 @@
51
52
  this.resource.bind(this)
52
53
  ], function(err, results) {
53
54
  if (err) {
54
- return custom_errback(err.status);
55
+ return customErrback(err.status);
55
56
  }
56
57
 
57
58
  callback({
@@ -60,7 +61,8 @@
60
61
  users: _.pluck(results[2], 'member'),
61
62
  admins: _.pluck(results[3], 'member'),
62
63
  roles: results[4],
63
- annotations: results[5].annotations
64
+ annotations: results[5].annotations,
65
+ owner: results[5].owner
64
66
  });
65
67
 
66
68
  return undefined;
@@ -1,3 +1,5 @@
1
+ /* global conjur */
2
+
1
3
  (function(conjur) {
2
4
  'use strict';
3
5
 
@@ -1,9 +1,11 @@
1
+ /* global conjur */
2
+
1
3
  (function(conjur) {
2
4
  'use strict';
3
5
 
4
6
  conjur.models.PolicyList = function() {
5
7
  var options = {
6
- namespaceSelector: function(member) {
8
+ namespaceSelector: function() {
7
9
  return null;
8
10
  }
9
11
  };
@@ -1,3 +1,5 @@
1
+ /* global conjur, async */
2
+
1
3
  (function(conjur, async, errback) {
2
4
  'use strict';
3
5
 
@@ -18,12 +20,9 @@
18
20
  Policy.prototype = Object.create(Generic.prototype);
19
21
  Policy.prototype.constructor = Policy;
20
22
 
21
- Policy.prototype.fetch = function(callback, custom_errback) {
22
- var self = this,
23
- id = this.id;
24
-
25
- if (typeof(custom_errback) == 'undefined') {
26
- custom_errback = errback; // reset to default
23
+ Policy.prototype.fetch = function(callback, customErrback) {
24
+ if (typeof(customErrback) === 'undefined') {
25
+ customErrback = errback; // reset to default
27
26
  }
28
27
 
29
28
  async.parallel([
@@ -32,14 +31,15 @@
32
31
  this.allRoles.bind(this)
33
32
  ], function(err, results) {
34
33
  if (err) {
35
- return custom_errback(err.status);
34
+ return customErrback(err.status);
36
35
  }
37
36
 
38
37
  callback({
39
38
  policy: results[0],
40
39
  owned: results[1],
41
40
  roles: results[2],
42
- annotations: results[0].annotations
41
+ annotations: results[0].annotations,
42
+ owner: results[0].owner
43
43
  });
44
44
 
45
45
  return undefined;
@@ -1,4 +1,6 @@
1
- (function(conjur, $, errback) {
1
+ /* global conjur, jQuery, _ */
2
+
3
+ (function(conjur, $, errback, _) {
2
4
  'use strict';
3
5
 
4
6
  var Generic = this.Generic = function(kind, id) {
@@ -6,49 +8,78 @@
6
8
  this.id = id;
7
9
  };
8
10
 
9
- function ajax(url, callback) {
11
+ function ajax(url, callback, err) {
10
12
  $.ajax({
11
13
  url: url,
12
14
  success: function(data) {
13
15
  callback(null, data);
14
16
  },
15
- error: callback
17
+ error: err || callback
16
18
  });
17
19
  }
18
20
 
19
21
  Generic.prototype.attributes = function(callback) {
20
22
  var id = this.id;
21
23
 
22
- ajax('/api/'
23
- + conjur.utils.pluralize(this.kind)
24
- + '/'
25
- + window.encodeURIComponent(id),
24
+ ajax('/api/'+
25
+ conjur.utils.pluralize(this.kind) +
26
+ '/' +
27
+ window.encodeURIComponent(id),
26
28
  callback);
27
29
  };
28
30
 
31
+ Generic.prototype.auditRole = function(callback) {
32
+ var id = this.id;
33
+
34
+ ajax('/api/audit/roles/' +
35
+ window.encodeURIComponent(conjur.app.configuration.account +
36
+ ':' + this.kind + ':' + id),
37
+ callback,
38
+ function() {
39
+ return callback(null, []);
40
+ });
41
+ };
42
+
43
+ Generic.prototype.auditResource = function(callback) {
44
+ var id = this.id;
45
+
46
+ ajax('/api/audit/resources/' +
47
+ window.encodeURIComponent(conjur.app.configuration.account +
48
+ ':' + this.kind + ':' + id),
49
+ callback,
50
+ function() {
51
+ return callback(null, []);
52
+ });
53
+ };
54
+
55
+ Generic.prototype.mergeAudit = function(d1, d2) {
56
+ return _.uniq(d1.concat(d2), function(item, key, a) {
57
+ return item.id;
58
+ });
59
+ };
60
+
29
61
  Generic.prototype.resource = function(callback) {
30
- ajax('/api/authz/'
31
- + conjur.app.configuration.account
32
- + '/resources/'
33
- + this.kind
34
- + '/'
35
- + window.encodeURIComponent(this.id),
62
+ ajax('/api/authz/' +
63
+ conjur.app.configuration.account +
64
+ '/resources/' +
65
+ this.kind +
66
+ '/' +
67
+ window.encodeURIComponent(this.id),
36
68
  callback);
37
69
  };
38
70
 
39
71
  Generic.prototype.ownedResources = function(callback) {
40
- var id = this.id;
41
72
  var roleid = [this.kind, this.id].join(':');
42
73
 
43
- ajax('/api/authz/'
44
- + conjur.app.configuration.account
45
- + '/resources?owner='
46
- + roleid,
74
+ ajax('/api/authz/' +
75
+ conjur.app.configuration.account +
76
+ '/resources?owner=' +
77
+ roleid,
47
78
  function(err, result) {
48
79
  if (typeof result.filter === 'function') {
49
80
  result = result.filter(function(item) {
50
81
  // assets of 'secret' kind are internal
51
- return item.id.split(':')[1] != 'secret';
82
+ return item.id.split(':')[1] !== 'secret';
52
83
  });
53
84
  }
54
85
 
@@ -57,13 +88,13 @@
57
88
  };
58
89
 
59
90
  Generic.prototype.allRoles = function(callback) {
60
- ajax('/api/authz/'
61
- + conjur.app.configuration.account
62
- + '/roles/'
63
- + window.encodeURIComponent(this.kind)
64
- + '/'
65
- + window.encodeURIComponent(this.id)
66
- + '?all',
91
+ ajax('/api/authz/' +
92
+ conjur.app.configuration.account +
93
+ '/roles/' +
94
+ window.encodeURIComponent(this.kind) +
95
+ '/' +
96
+ window.encodeURIComponent(this.id) +
97
+ '?all',
67
98
  callback);
68
99
  };
69
100
 
@@ -81,5 +112,6 @@
81
112
  (
82
113
  conjur,
83
114
  jQuery,
84
- conjur.utils.errback
115
+ conjur.utils.errback,
116
+ _
85
117
  );
@@ -1,20 +1,23 @@
1
+ /* global conjur, jQuery, _ */
2
+
1
3
  (function(conjur, $, _) {
2
4
  'use strict';
3
5
 
4
- conjur.models.ResourceList = function(kind, options) {
6
+ this.ResourceList = function(kind, options) {
5
7
  var List = function() {
6
8
  this._members = null;
7
9
  this.namespaces = null;
8
10
  this.options = options || {};
9
11
 
10
- if ( !this.options.idSelector ) {
12
+ if (!this.options.idSelector) {
11
13
  this.options.idSelector = function(member) {
12
14
  var idTokens = member.id.split(':');
15
+
13
16
  return idTokens[idTokens.length-1];
14
17
  };
15
18
  }
16
19
 
17
- if ( !this.options.namespaceSelector ) {
20
+ if (!this.options.namespaceSelector) {
18
21
  this.options.namespaceSelector = function(member) {
19
22
  return member.identifier.split('/')[0];
20
23
  };
@@ -24,7 +27,7 @@
24
27
  List.prototype.members = function(namespace) {
25
28
  var result;
26
29
 
27
- if ( namespace === "" ) {
30
+ if (namespace === '') {
28
31
  result = _.clone(this._members);
29
32
  } else {
30
33
  result = this._members.filter(function(o) {
@@ -38,32 +41,47 @@
38
41
  };
39
42
 
40
43
  List.prototype.fetch = function(callback) {
41
- if ( this._members )
44
+ if (this._members) {
42
45
  return callback(this);
46
+ }
43
47
 
44
48
  var self = this;
45
49
 
46
50
  $.ajax({
47
- url: "/api/authz/" + encodeURIComponent(conjur.app.configuration.account) + "/resources/" + encodeURIComponent(kind),
51
+ url: '/api/authz/' +
52
+ window.encodeURIComponent(conjur.app.configuration.account) +
53
+ '/resources/' +
54
+ window.encodeURIComponent(kind),
48
55
  success: function(data) {
49
- var filter, idSelector;
56
+ var filter = this.options.filter;
50
57
 
51
- if ( filter = this.options.filter ) {
58
+ if (filter) {
52
59
  data = _.filter(data, filter);
53
60
  }
54
61
 
55
62
  self._members = data;
63
+
56
64
  self._members.forEach(function(member) {
57
65
  member.identifier = this.options.idSelector(member);
58
66
  }.bind(this));
59
- self.namespaces = _.unique(self._members.map(this.options.namespaceSelector)).sort();
67
+
68
+ self.namespaces = _.unique(
69
+ self._members.map(this.options.namespaceSelector)
70
+ ).sort();
71
+
60
72
  callback(self);
61
73
  }.bind(this)
62
74
  });
63
75
 
76
+ return undefined;
64
77
  };
65
78
 
66
79
  return new List();
67
80
  };
68
81
 
69
- })(conjur, jQuery, _);
82
+ }).bind(conjur.models)
83
+ (
84
+ conjur,
85
+ jQuery,
86
+ _
87
+ );
@@ -1,7 +1,9 @@
1
+ /* global conjur */
2
+
1
3
  (function(conjur) {
2
4
  'use strict';
3
5
 
4
- conjur.models.UserList = function() {
6
+ this.UserList = function() {
5
7
  var options = {
6
8
  namespaceSelector: function(member) {
7
9
  var idTokens = member.id.split('@');
@@ -17,4 +19,7 @@
17
19
  return conjur.models.ResourceList('user', options);
18
20
  };
19
21
 
20
- })(conjur);
22
+ }).bind(conjur.models)
23
+ (
24
+ conjur
25
+ );
@@ -1,3 +1,5 @@
1
+ /* global conjur, jQuery, async */
2
+
1
3
  (function(conjur, $, async, errback) {
2
4
  'use strict';
3
5
 
@@ -18,7 +20,7 @@
18
20
  User.prototype = Object.create(Generic.prototype);
19
21
  User.prototype.constructor = User;
20
22
 
21
- User.prototype.publicKeys = function(callback, custom_errback) {
23
+ User.prototype.publicKeys = function(callback) {
22
24
  $.ajax({
23
25
  url: '/api/pubkeys/' + window.encodeURIComponent(this.id),
24
26
  success: function(data) {
@@ -30,12 +32,11 @@
30
32
  });
31
33
  };
32
34
 
33
- User.prototype.fetch = function(callback, custom_errback) {
34
- var self = this,
35
- id = this.id;
35
+ User.prototype.fetch = function(callback, customErrback) {
36
+ var self = this;
36
37
 
37
- if (typeof(custom_errback) === 'undefined') {
38
- custom_errback = errback; // reset to default
38
+ if (typeof(customErrback) === 'undefined') {
39
+ customErrback = errback; // reset to default
39
40
  }
40
41
 
41
42
  async.parallel([
@@ -43,18 +44,22 @@
43
44
  this.ownedResources.bind(this),
44
45
  this.allRoles.bind(this),
45
46
  this.resource.bind(this),
46
- this.publicKeys.bind(this)
47
+ this.publicKeys.bind(this),
48
+ this.auditRole.bind(this),
49
+ this.auditResource.bind(this)
47
50
  ], function(err, results) {
48
51
  if (err) {
49
- return custom_errback(err.status);
52
+ return customErrback(err.status);
50
53
  }
51
54
 
52
55
  callback({
53
56
  user: results[0],
54
57
  owned: results[1],
55
58
  roles: results[2],
59
+ owner: results[3].owner,
56
60
  annotations: results[3].annotations,
57
- pubkeys: results[4]
61
+ pubkeys: results[4],
62
+ audit: self.mergeAudit(results[5], results[6])
58
63
  });
59
64
 
60
65
  return undefined;