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,6 +0,0 @@
1
- Sorted set data structures in JavaScript
2
- by Adam Hooper
3
-
4
- https://github.com/adamhooper/js-sorted-set/tree/53995817e07e8f3c1e7c8de85692d7fff824414f
5
-
6
- (Public domain.)
@@ -1,72 +0,0 @@
1
- /* global conjur, jQuery, async */
2
-
3
- (function(conjur, $, async, errback) {
4
- 'use strict';
5
-
6
- var Generic = this.Generic;
7
-
8
- var Group = this.Group = function(args) {
9
- if (!(this instanceof Group)) {
10
- return new Group(args);
11
- }
12
-
13
- var superArguments = Array.prototype.slice.call(arguments);
14
- superArguments.unshift('group');
15
- Generic.apply(this, superArguments);
16
-
17
- return undefined;
18
- };
19
-
20
- Group.prototype = Object.create(Generic.prototype);
21
- Group.prototype.constructor = Group;
22
-
23
- Group.prototype.fetch = function(callback, customErrback) {
24
- var id = this.id;
25
-
26
- if (typeof(customErrback) === 'undefined') {
27
- customErrback = errback; // reset to default
28
- }
29
-
30
- async.parallel([
31
- this.attributes.bind(this),
32
- this.ownedResources.bind(this),
33
- function(cb) {
34
- $.ajax({
35
- url: '/api/authz/' +
36
- conjur.app.configuration.account +
37
- '/roles/group/' +
38
- id +
39
- '?members',
40
- success: function(result) {
41
- cb(null, result);
42
- },
43
- error: cb
44
- });
45
- },
46
- this.allRoles.bind(this),
47
- this.resource.bind(this)
48
- ], function(err, results) {
49
- if (err) {
50
- return customErrback(err.status);
51
- }
52
-
53
- callback({
54
- group: results[0],
55
- owned: results[1],
56
- members: results[2],
57
- roles: results[3],
58
- annotations: results[4].annotations,
59
- owner: results[4].owner
60
- });
61
-
62
- return undefined;
63
- });
64
- };
65
-
66
- }).bind(conjur.models.Record)
67
- (
68
- conjur,
69
- jQuery,
70
- async,
71
- conjur.utils.errback
72
- );
@@ -1,60 +0,0 @@
1
- /* global conjur, async */
2
-
3
- (function(conjur, async, errback) {
4
- 'use strict';
5
-
6
- var Generic = this.Generic;
7
-
8
- var Host = this.Host = function(args) {
9
- if (!(this instanceof Host)) {
10
- return new Host(args);
11
- }
12
-
13
- var superArguments = Array.prototype.slice.call(arguments);
14
- superArguments.unshift('host');
15
- Generic.apply(this, superArguments);
16
-
17
- return undefined;
18
- };
19
-
20
- Host.prototype = Object.create(Generic.prototype);
21
- Host.prototype.constructor = Host;
22
-
23
- Host.prototype.fetch = function(callback, customErrback) {
24
- var self = this;
25
-
26
- if (typeof(customErrback) === 'undefined') {
27
- customErrback = errback; // reset to default
28
- }
29
-
30
- async.parallel([
31
- this.attributes.bind(this),
32
- this.ownedResources.bind(this),
33
- this.allRoles.bind(this),
34
- this.resource.bind(this),
35
- this.auditRole.bind(this),
36
- this.auditResource.bind(this)
37
- ], function(err, results) {
38
- if (err) {
39
- return customErrback(err.status);
40
- }
41
-
42
- callback({
43
- host: results[0],
44
- owned: results[1],
45
- roles: results[2],
46
- annotations: results[3].annotations,
47
- owner: results[3].owner,
48
- audit: self.mergeAudit(results[4], results[5])
49
- });
50
-
51
- return undefined;
52
- });
53
- };
54
-
55
- }).bind(conjur.models.Record)
56
- (
57
- conjur,
58
- async,
59
- conjur.utils.errback
60
- );
@@ -1,79 +0,0 @@
1
- /* global conjur, jQuery, _, async */
2
-
3
- (function(conjur, $, _, async, errback) {
4
- 'use strict';
5
-
6
- var Generic = this.Generic;
7
-
8
- var Layer = this.Layer = function(args) {
9
- if (!(this instanceof Layer)) {
10
- return new Layer(args);
11
- }
12
-
13
- var superArguments = Array.prototype.slice.call(arguments);
14
- superArguments.unshift('layer');
15
- Generic.apply(this, superArguments);
16
-
17
- return undefined;
18
- };
19
-
20
- Layer.prototype = Object.create(Generic.prototype);
21
- Layer.prototype.constructor = Layer;
22
-
23
- Layer.prototype.fetch = function(callback, customErrback) {
24
- var id = this.id;
25
-
26
- if (typeof(customErrback) === 'undefined') {
27
- customErrback = errback; // reset to default
28
- }
29
-
30
- function members(role) {
31
- return function(cb) {
32
- $.ajax({
33
- url: '/api/authz/' +
34
- conjur.app.configuration.account +
35
- '/roles/' +
36
- role +
37
- '?members',
38
- success: function(result) {
39
- cb(null, result);
40
- },
41
- error: cb
42
- });
43
- };
44
- }
45
-
46
- async.parallel([
47
- this.attributes.bind(this),
48
- this.ownedResources.bind(this),
49
- members('@/layer/' + id + '/use_host'),
50
- members('@/layer/' + id + '/admin_host'),
51
- this.allRoles.bind(this),
52
- this.resource.bind(this)
53
- ], function(err, results) {
54
- if (err) {
55
- return customErrback(err.status);
56
- }
57
-
58
- callback({
59
- layer: results[0],
60
- owned: results[1],
61
- users: _.pluck(results[2], 'member'),
62
- admins: _.pluck(results[3], 'member'),
63
- roles: results[4],
64
- annotations: results[5].annotations,
65
- owner: results[5].owner
66
- });
67
-
68
- return undefined;
69
- });
70
- };
71
-
72
- }).bind(conjur.models.Record)
73
- (
74
- conjur,
75
- jQuery,
76
- _,
77
- async,
78
- conjur.utils.errback
79
- );
@@ -1,12 +0,0 @@
1
- /* global conjur */
2
-
3
- (function(conjur) {
4
- 'use strict';
5
-
6
- conjur.models.Namespace = function() {
7
- return {
8
- currentNamespace: ''
9
- };
10
- };
11
-
12
- })(conjur);
@@ -1,16 +0,0 @@
1
- /* global conjur */
2
-
3
- (function(conjur) {
4
- 'use strict';
5
-
6
- conjur.models.PolicyList = function() {
7
- var options = {
8
- namespaceSelector: function() {
9
- return null;
10
- }
11
- };
12
-
13
- return conjur.models.ResourceList('policy', options);
14
- };
15
-
16
- })(conjur);
@@ -1,54 +0,0 @@
1
- /* global conjur, async */
2
-
3
- (function(conjur, async, errback) {
4
- 'use strict';
5
-
6
- var Generic = this.Generic;
7
-
8
- var Policy = this.Policy = function(args) {
9
- if (!(this instanceof Policy)) {
10
- return new Policy(args);
11
- }
12
-
13
- var superArguments = Array.prototype.slice.call(arguments);
14
- superArguments.unshift('policy');
15
- Generic.apply(this, superArguments);
16
-
17
- return undefined;
18
- };
19
-
20
- Policy.prototype = Object.create(Generic.prototype);
21
- Policy.prototype.constructor = Policy;
22
-
23
- Policy.prototype.fetch = function(callback, customErrback) {
24
- if (typeof(customErrback) === 'undefined') {
25
- customErrback = errback; // reset to default
26
- }
27
-
28
- async.parallel([
29
- this.resource.bind(this),
30
- this.ownedResources.bind(this),
31
- this.allRoles.bind(this)
32
- ], function(err, results) {
33
- if (err) {
34
- return customErrback(err.status);
35
- }
36
-
37
- callback({
38
- policy: results[0],
39
- owned: results[1],
40
- roles: results[2],
41
- annotations: results[0].annotations,
42
- owner: results[0].owner
43
- });
44
-
45
- return undefined;
46
- });
47
- };
48
-
49
- }).bind(conjur.models.Record)
50
- (
51
- conjur,
52
- async,
53
- conjur.utils.errback
54
- );
@@ -1,117 +0,0 @@
1
- /* global conjur, jQuery, _ */
2
-
3
- (function(conjur, $, errback, _) {
4
- 'use strict';
5
-
6
- var Generic = this.Generic = function(kind, id) {
7
- this.kind = kind;
8
- this.id = id;
9
- };
10
-
11
- function ajax(url, callback, err) {
12
- $.ajax({
13
- url: url,
14
- success: function(data) {
15
- callback(null, data);
16
- },
17
- error: err || callback
18
- });
19
- }
20
-
21
- Generic.prototype.attributes = function(callback) {
22
- var id = this.id;
23
-
24
- ajax('/api/'+
25
- conjur.utils.pluralize(this.kind) +
26
- '/' +
27
- window.encodeURIComponent(id),
28
- callback);
29
- };
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
-
61
- Generic.prototype.resource = function(callback) {
62
- ajax('/api/authz/' +
63
- conjur.app.configuration.account +
64
- '/resources/' +
65
- this.kind +
66
- '/' +
67
- window.encodeURIComponent(this.id),
68
- callback);
69
- };
70
-
71
- Generic.prototype.ownedResources = function(callback) {
72
- var roleid = [this.kind, this.id].join(':');
73
-
74
- ajax('/api/authz/' +
75
- conjur.app.configuration.account +
76
- '/resources?owner=' +
77
- roleid,
78
- function(err, result) {
79
- if (typeof result.filter === 'function') {
80
- result = result.filter(function(item) {
81
- // assets of 'secret' kind are internal
82
- return item.id.split(':')[1] !== 'secret';
83
- });
84
- }
85
-
86
- callback(err, result);
87
- });
88
- };
89
-
90
- Generic.prototype.allRoles = function(callback) {
91
- ajax('/api/authz/' +
92
- conjur.app.configuration.account +
93
- '/roles/' +
94
- window.encodeURIComponent(this.kind) +
95
- '/' +
96
- window.encodeURIComponent(this.id) +
97
- '?all',
98
- callback);
99
- };
100
-
101
- Generic.prototype.fetch = function(callback) {
102
- this.attributes(function(err, data) {
103
- if (err) {
104
- return errback(err);
105
- }
106
-
107
- return callback(data);
108
- });
109
- };
110
-
111
- }).bind(conjur.models.Record)
112
- (
113
- conjur,
114
- jQuery,
115
- conjur.utils.errback,
116
- _
117
- );
@@ -1,87 +0,0 @@
1
- /* global conjur, jQuery, _ */
2
-
3
- (function(conjur, $, _) {
4
- 'use strict';
5
-
6
- this.ResourceList = function(kind, options) {
7
- var List = function() {
8
- this._members = null;
9
- this.namespaces = null;
10
- this.options = options || {};
11
-
12
- if (!this.options.idSelector) {
13
- this.options.idSelector = function(member) {
14
- var idTokens = member.id.split(':');
15
-
16
- return idTokens[idTokens.length-1];
17
- };
18
- }
19
-
20
- if (!this.options.namespaceSelector) {
21
- this.options.namespaceSelector = function(member) {
22
- return member.identifier.split('/')[0];
23
- };
24
- }
25
- };
26
-
27
- List.prototype.members = function(namespace) {
28
- var result;
29
-
30
- if (namespace === '') {
31
- result = _.clone(this._members);
32
- } else {
33
- result = this._members.filter(function(o) {
34
- return this.options.namespaceSelector(o) === namespace;
35
- }.bind(this));
36
- }
37
-
38
- return result.sort(function(a, b) {
39
- return a.identifier.localeCompare(b.identifier);
40
- });
41
- };
42
-
43
- List.prototype.fetch = function(callback) {
44
- if (this._members) {
45
- return callback(this);
46
- }
47
-
48
- var self = this;
49
-
50
- $.ajax({
51
- url: '/api/authz/' +
52
- window.encodeURIComponent(conjur.app.configuration.account) +
53
- '/resources/' +
54
- window.encodeURIComponent(kind),
55
- success: function(data) {
56
- var filter = this.options.filter;
57
-
58
- if (filter) {
59
- data = _.filter(data, filter);
60
- }
61
-
62
- self._members = data;
63
-
64
- self._members.forEach(function(member) {
65
- member.identifier = this.options.idSelector(member);
66
- }.bind(this));
67
-
68
- self.namespaces = _.unique(
69
- self._members.map(this.options.namespaceSelector)
70
- ).sort();
71
-
72
- callback(self);
73
- }.bind(this)
74
- });
75
-
76
- return undefined;
77
- };
78
-
79
- return new List();
80
- };
81
-
82
- }).bind(conjur.models)
83
- (
84
- conjur,
85
- jQuery,
86
- _
87
- );