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,47 +0,0 @@
1
- /** @jsx React.DOM */
2
- /* global conjur, React */
3
-
4
- (function(conjur, React) {
5
- 'use strict';
6
-
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
- }
16
-
17
- // TODO: sort by date (optionally)
18
- // TODO: table view
19
- var annotationsList = [];
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
-
29
- annotationsList.push(<dt key={term}>{itemName}</dt>);
30
- annotationsList.push(<dd key={description}>{itemValue}</dd>);
31
- });
32
-
33
- return (
34
- <div>
35
- <dl className="annotations">
36
- {annotationsList}
37
- </dl>
38
- </div>
39
- );
40
- }
41
- });
42
-
43
- }).bind(conjur.views)
44
- (
45
- conjur,
46
- React
47
- );
@@ -1,369 +0,0 @@
1
- /**@jsx React.DOM*/
2
-
3
- // Generated by LiveScript 1.2.0
4
- (function(){
5
- var ref$, em, strong, table, div, th, tr, td, thead, tbody, section, h3, time, map, each, unique, isType, join, compact_fields, extended_fields, FieldsMixin, AuditTableHeader, Timestamp, wrapArray, AuditEntry, newEventSet, AuditTable, GlobalAudit, urlOfRole, urlOfResource, AuditBox, out$ = typeof exports != 'undefined' && exports || this, slice$ = [].slice;
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
- ref$ = require('prelude-ls'), map = ref$.map, each = ref$.each, unique = ref$.unique, isType = ref$.isType, join = ref$.join;
8
- compact_fields = ['auditview_user', 'auditview_action'];
9
- //extended_fields = ['timestamp', 'user', 'acting_as', 'action', 'entities', 'privilege','human'];
10
- extended_fields = ['timestamp','auditview_user','auditview_action'];
11
- known_rolsource_types = [ 'user','group','host','layer','policy']; // what if somebody explicitly will create the role of such type?
12
- FieldsMixin = {
13
- fields: function(){
14
- if (this.props.compact) {
15
- return compact_fields;
16
- } else {
17
- return extended_fields;
18
- }
19
- }
20
- };
21
- AuditTableHeader = React.createClass({
22
- mixins: [FieldsMixin],
23
- displayName: 'AuditTableHeader',
24
- render: function(){
25
- return thead({}, tr({}, map(function(it){
26
- return th({
27
- key: it
28
- }, it.replace('auditview_','').replace('_', ' '));
29
- })(
30
- this.fields())));
31
- }
32
- });
33
- Timestamp = React.createClass({
34
- displayName: 'Timestamp',
35
- render: function(){
36
- var ts;
37
- ts = moment(this.props.time); /*.format('YYYY-MM-DD hh:mm:ss');
38
- return <div className="timestamp">{ts}</div>;
39
- */
40
- return time({
41
- className: "timestamp",
42
- dateTime: ts.format(),
43
- title: ts.calendar()
44
- }, [ts.fromNow()]);
45
- }
46
- });
47
- wrapArray = function(it){
48
- if (isType('Array', it)) {
49
- return it;
50
- } else {
51
- return [it];
52
- }
53
- };
54
- out$.AuditEntry = AuditEntry = React.createClass({
55
- mixins: [FieldsMixin],
56
- displayName: 'AuditEntry',
57
- // TODO: make message a separate React Class
58
- humanizeEvent: function(e) {
59
- // copy of SHORT_FORMATS logic from cli-ruby:lib/conjur/command/audit.rb
60
- var msg=[];
61
-
62
- var ResourceLink = conjur.views.ResourceLink;
63
- var RoleLink = conjur.views.RoleLink;
64
-
65
- if ((e.kind=='resource') && (e.action=='check')) {
66
- msg = [ ]
67
- if ( e.allowed ) {
68
- msg.push("performed ");
69
- msg.push(em({}, e.privilege));
70
- msg.push(" on ");
71
- msg.push(ResourceLink({id: e.resource, noIcon: true}));
72
- }
73
- else {
74
- msg.push("was ");
75
- msg.push(strong({}, "denied permission"));
76
- msg.push(" to ");
77
- msg.push(em({}, e.privilege));
78
- msg.push(" ");
79
- msg.push(ResourceLink({id: e.resource, noIcon: true}));
80
- }
81
- } else if ((e.kind=="resource") && (e.action=="create")) {
82
- msg = [ " created ", ResourceLink({id: e.resource, noIcon: true}), " owned by ", RoleLink({id: e.owner, noIcon: true}) ];
83
- } else if ((e.kind=="resource") && (e.action=="update")) { // this is suspicious, but CLI audit does this
84
- msg = [ " gave ", ResourceLink({id: e.resource, noIcon: true}), " to ", RoleLink({id: e.owner, noIcon: true}) ];
85
- } else if ((e.kind=="resource") && (e.action=="destroy")) {
86
- msg = [ " deleted ", ResourceLink({id: e.resource, noIcon: true}) ];
87
- } else if ((e.kind=="resource") && (e.action=="permit")) {
88
- msg = [ " permitted ", RoleLink({id: e.grantee, noIcon: true}), " to ", em({}, e.privilege), " ", ResourceLink({id: e.resource, noIcon: true}) ]
89
- if ( e.grant_option )
90
- msg.push(" with grant option");
91
- } else if ((e.kind=="resource") && (e.action=="deny")) {
92
- msg = [ " denied ", em({}, e.privilege), " from ", RoleLink({id: e.grantee, noIcon: true}), " on ", ResourceLink({id: e.resource, noIcon: true}) ];
93
- } else if ((e.kind=="resource") && (e.action=="permitted_roles")) {
94
- msg = [ " listed roles permitted to ", em({}, e.privilege), " on ", ResourceLink({id: e.resource, noIcon: true}) ];
95
- } else if ((e.kind=="role") && (e.action=="check")) {
96
- msg = [ ]
97
- if ( e.allowed ) {
98
- //msg.push(RoleLink({id: e.role, noIcon: true}))
99
- msg.push(" performed ");
100
- msg.push(em({}, e.privilege));
101
- msg.push(" on ");
102
- msg.push(ResourceLink({id: e.resource, noIcon: true}));
103
- }
104
- else {
105
- //msg.push(RoleLink({id: e.role, noIcon: true}))
106
- msg.push(" was ");
107
- msg.push(strong({}, "denied permission"));
108
- msg.push(" to ");
109
- msg.push(em({}, e.privilege));
110
- msg.push(" on ");
111
- msg.push(ResourceLink({id: e.resource, noIcon: true}));
112
- }
113
- } else if ((e.kind=="role") && (e.action=="grant")) {
114
- /* what was the point of commenting this out? */
115
- msg = [ " granted role ", RoleLink({id: e.role, noIcon: true}), " to ", RoleLink({id: e.member, noIcon: true}) ];
116
- if (e.admin_option) {
117
- msg.push(" with admin permission");
118
- } else {
119
- msg.push(" without admin permission");
120
- }
121
- } else if ((e.kind=="role") && (e.action=="revoke")) {
122
- msg = [ " revoked role ", RoleLink({id: e.role, noIcon: true}), " from ", RoleLink({id: e.member, noIcon: true}) ];
123
- } else if ((e.kind=="role") && (e.action=="create")) {
124
- msg = [ " created role ", RoleLink({id: e.role, noIcon: true}) ];
125
- } else if ((e.kind=="annotation") && (e.action=="update")) {
126
- msg = [ " updated annotation on ", ResourceLink({id: e.resource, noIcon: true}) ];
127
- } else if (e.kind=="audit") {
128
- var action_part = _.compact([e.facility, e.action]).join(":");
129
- var parts = [action_part];
130
- if (e.role!=null) {
131
- parts.push(" by ");
132
- parts.push(RoleLink({id: e.role, noIcon: true}));
133
- }
134
- if (e.resource_id!=null) {
135
- parts.push(" on");
136
- parts.push(ResourceLink({id: e.resource_id, noIcon: true}));
137
- }
138
- if (e.allowed!=null) {
139
- parts.push(" (allowed: "+e.allowed+")");
140
- }
141
- var statement = parts.join(" ");
142
- msg = [" reported ", parts ];
143
- if (e.audit_message!=null) {
144
- msg.push("; message: ");
145
- msg.push(e.audit_message);
146
- }
147
- } else {
148
- msg.push(" unknown event: "+e.kind+":"+e.action+"!");
149
- }
150
-
151
- if (e.error!=null) {
152
- msg.push(" (failed with "+e.error+")");
153
- }
154
-
155
- return msg;
156
- },
157
- transformField: function(key, value){
158
- var ResourceLink = conjur.views.ResourceLink;
159
- var RoleLink = conjur.views.RoleLink;
160
-
161
- var that;
162
- switch (key) {
163
- case 'entities':
164
- return [
165
- (that = this.props.resource) != null ? ResourceLink({
166
- data: that
167
- }) : void 8, (that = this.props.role) != null ? RoleLink({
168
- id: that
169
- }) : void 8
170
- ];
171
- case 'user':
172
- if (value != null) {
173
- return RoleLink({
174
- id: value
175
- });
176
- }
177
- break;
178
- case 'acting_as':
179
- that = this.props.user;
180
- if ((value != null) && ( value != that )) {
181
- return RoleLink({
182
- id: value
183
- });
184
- }
185
- break;
186
- case 'auditview_user': //virtual field
187
- var acting_user =this.props.user;
188
- var acting_role = this.props.acting_as;
189
- msg = [ RoleLink({id: acting_user}) ];
190
- if ((acting_role!=null) && (acting_role != acting_user)) {
191
- msg.push([" as ", RoleLink({id: acting_role})]);
192
- }
193
- return msg;
194
- case 'timestamp':
195
- if (value != null) {
196
- return Timestamp({
197
- time: value
198
- });
199
- }
200
- break;
201
- case 'auditview_action':
202
- return this.humanizeEvent(this.props);
203
- default:
204
- return value;
205
- }
206
- },
207
- render: function(){
208
- var this$ = this;
209
- return tr({
210
- className: this.props.action
211
- }, map(function(it){
212
- return td.apply(null, [{
213
- key: it
214
- }].concat(slice$.call(wrapArray(this$.transformField(it, this$.props[it])))));
215
- })(
216
- this.fields()));
217
- }
218
- });
219
- newEventSet = function(){
220
- var evts;
221
- evts = new SortedSet({
222
- comparator: function(a, b){
223
- return a && b && b.id - a.id;
224
- }
225
- });
226
- evts.containsLike = function(item){
227
- var existing;
228
- existing = this.findIterator(item).value();
229
- if (existing != null) {
230
- return this.priv.comparator(existing, item) === 0;
231
- }
232
- };
233
- return evts;
234
- };
235
- out$.AuditTable = AuditTable = React.createClass({
236
- displayName: 'AuditTable',
237
- getInitialState: function(){
238
- return {
239
- events: newEventSet()
240
- };
241
- },
242
- knownRolsourceTypes: function() {
243
- return ;
244
- },
245
- render: function(){
246
- var compact;
247
- compact = this.props.compact;
248
- return section({
249
- className: 'audit'
250
- }, [
251
- h3({}, this.props.caption), table({
252
- className: 'audit-table'
253
- }, [
254
- AuditTableHeader({
255
- key: 'thead',
256
- compact: compact
257
- }), tbody({
258
- key: 'tbody'
259
- }, this.state.events.filter(function(ev){
260
- // remove internal resources creation
261
- if ((ev.role!=null) && (ev.role.split(':')[1] == '@')) {
262
- return false;
263
- }
264
- if ((ev.resource!=null) && (ev.resource.split(':')[1] == '@')) {
265
- return false;
266
- }
267
- if ((ev.resource!=null) && (ev.resource.split(':')[1] == 'secret')) {
268
- return false;
269
- }
270
- if ((ev.grantee!=null) && (ev.grantee.split(':')[1] == '@')) {
271
- return false;
272
- }
273
-
274
- // hide automated creation of roles corresponding to resources of known type
275
- if ((ev.kind=="role") && (ev.action=="create")) {
276
- var rolekind = ev.role.split(':')[1];
277
- if (_.contains(known_rolsource_types, rolekind)) {
278
- return false;
279
- }
280
- }
281
- return true;
282
- }).map(function(it){
283
- // new way to clone objects, custom clone$ does not work no more as expected
284
- var ref$ = React.addons.update(it, {$merge: {key: it.id, compact: compact} });
285
- return new AuditEntry(ref$);
286
- }))
287
- ])
288
- ]);
289
- },
290
- componentDidMount: function(){
291
- return each(this.addSource)(
292
- wrapArray(
293
- this.props.src));
294
- },
295
- componentWillUnmount: function(){
296
- return each(function(it){
297
- // console.log("closing event source ", it);
298
- return it.close();
299
- })(
300
- this.sources);
301
- },
302
- addEvent: function(arg$){
303
- var data, event;
304
- data = arg$.data;
305
- event = JSON.parse(data);
306
- if (event.action === "check" && event.privilege === "read" && event.allowed) {
307
- return true;
308
- } else {
309
- if (!this.state.events.containsLike(event)) {
310
- this.state.events.insert(event);
311
- return this.forceUpdate();
312
- }
313
- }
314
- },
315
- addSource: function(url){
316
- var evtSrc;
317
- // console.log("opening eventsource to " + url);
318
- evtSrc = new EventSource(url);
319
- // console.log(evtSrc);
320
- evtSrc.onmessage = this.addEvent;
321
- evtSrc.onerror = function(a, b, c, d){
322
- return console.log(a, b, c, d);
323
- };
324
- return (this.sources || (this.sources = [])).push(evtSrc);
325
- }
326
- });
327
- out$.GlobalAudit = GlobalAudit = React.createClass({
328
- displayName: 'GlobalAudit',
329
- render: function(){
330
- return AuditTable({
331
- src: '/api/audit/all',
332
- caption: 'All recent audit events'
333
- });
334
- }
335
- });
336
- urlOfRole = function(role){
337
- return "/api/audit/roles/" + encodeURIComponent(role);
338
- };
339
- urlOfResource = function(resource){
340
- return "/api/audit/resources/" + encodeURIComponent(resource);
341
- };
342
- out$.AuditBox = AuditBox = React.createClass({
343
- displayName: 'AuditBox',
344
- render: function(){
345
- var roles, resources, roleSrcs, resSrcs, things;
346
- roles = this.props.roles || [];
347
- resources = this.props.resources || [];
348
- roleSrcs = map(urlOfRole)(
349
- roles);
350
- resSrcs = map(urlOfResource)(
351
- resources);
352
- things = join(', ')(
353
- unique(
354
- roles.concat(resources)));
355
-
356
- var options= { src: roleSrcs.concat(resSrcs) };
357
- if (this.props.tabview==null) {
358
- options=_.extend(options, {caption: "Recent Activity"});
359
- }
360
- return AuditTable(options);
361
- }
362
- });
363
- /* it does not work as expected with new react any more (prototype fields are squashed within react)
364
- function clone$(it){
365
- function fun(){} fun.prototype = it;
366
- return new fun;
367
- }
368
- */
369
- }).call(this);
@@ -1,62 +0,0 @@
1
- /** @jsx React.DOM */
2
- /* global conjur, React, _ */
3
-
4
- (function(conjur, React, _) {
5
- 'use strict';
6
-
7
- var Breadcrumb = React.createClass({
8
- render: function() {
9
- var className = '',
10
- text;
11
-
12
- if (this.props.active === true) {
13
- className = 'active';
14
- text = this.props.text;
15
-
16
- } else if (this.props.extra === true) {
17
- className = 'b-breadcrumb__extra';
18
- text = this.props.text;
19
- } else {
20
- text = (<a href={this.props.url}>{this.props.text}</a>);
21
- }
22
-
23
- return (
24
- <li className={className}>
25
- {text}
26
- </li>
27
- );
28
- }
29
- });
30
-
31
- this.Breadcrumbs = React.createClass({
32
- render: function() {
33
- var items = _.map(this.props.elems || [], function(e, idx, coll) {
34
- var length = coll.length - 1,
35
- active = idx + 1 === length ? true : false,
36
- extra = idx === length ? true : false;
37
-
38
- return (
39
- <Breadcrumb url={e.url}
40
- text={e.text}
41
- active={active}
42
- extra={extra}
43
- key={e.url + e.text} />
44
- );
45
- });
46
-
47
- return (
48
- <div className="b-breadcrumbs">
49
- <ol className="breadcrumb">
50
- {items}
51
- </ol>
52
- </div>
53
- );
54
- }
55
- });
56
-
57
- }).bind(conjur.views)
58
- (
59
- conjur,
60
- React,
61
- _
62
- );