conjur-asset-ui-api 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (114) hide show
  1. checksums.yaml +7 -0
  2. data/.git-hooks/pre_commit/ensure_livescript_compiled.rb +31 -0
  3. data/.git-hooks/pre_commit/trailing_whitespace.rb +26 -0
  4. data/.gitignore +20 -0
  5. data/.overcommit.yml +5 -0
  6. data/.project +18 -0
  7. data/Gemfile +8 -0
  8. data/LICENSE.txt +22 -0
  9. data/README.md +41 -0
  10. data/Rakefile +1 -0
  11. data/compile_ls +2 -0
  12. data/conjur-asset-ui.gemspec +36 -0
  13. data/lib/conjur-asset-ui-version.rb +7 -0
  14. data/lib/conjur-asset-ui.rb +7 -0
  15. data/lib/conjur/audit/follower.rb +63 -0
  16. data/lib/conjur/audit/humanizer.rb +53 -0
  17. data/lib/conjur/audit/tableizer.rb +55 -0
  18. data/lib/conjur/command/ui.rb +38 -0
  19. data/lib/conjur/webserver/api_proxy.rb +94 -0
  20. data/lib/conjur/webserver/audit_stream.rb +92 -0
  21. data/lib/conjur/webserver/authorize.rb +28 -0
  22. data/lib/conjur/webserver/conjur_info.rb +33 -0
  23. data/lib/conjur/webserver/home.rb +36 -0
  24. data/lib/conjur/webserver/login.rb +50 -0
  25. data/lib/conjur/webserver/server.rb +111 -0
  26. data/livescript/views/audit.ls +124 -0
  27. data/public/css/bootstrap.css +7 -0
  28. data/public/css/styles.less +400 -0
  29. data/public/fonts/glyphicons-halflings-regular.eot +0 -0
  30. data/public/fonts/glyphicons-halflings-regular.svg +229 -0
  31. data/public/fonts/glyphicons-halflings-regular.ttf +0 -0
  32. data/public/fonts/glyphicons-halflings-regular.woff +0 -0
  33. data/public/images/conjur-logo.svg +26 -0
  34. data/public/images/icon-client-pc.svg +12 -0
  35. data/public/images/icon-environment.png +0 -0
  36. data/public/images/icon-person.svg +12 -0
  37. data/public/images/icon-service-dots.svg +13 -0
  38. data/public/images/icon-variable.png +0 -0
  39. data/public/index.html +121 -0
  40. data/public/js/lib/JSXTransformer.js +10862 -0
  41. data/public/js/lib/async.js +958 -0
  42. data/public/js/lib/backbone.js +2 -0
  43. data/public/js/lib/bootstrap.js +6 -0
  44. data/public/js/lib/date.extensions.js +141 -0
  45. data/public/js/lib/less.js +16 -0
  46. data/public/js/lib/moment.js +7768 -0
  47. data/public/js/lib/pace.js +2 -0
  48. data/public/js/lib/prelude-browser-min.js +1 -0
  49. data/public/js/lib/react-with-addons.js +15505 -0
  50. data/public/js/lib/react.js +14469 -0
  51. data/public/js/lib/sorted-set.no-require.js +1170 -0
  52. data/public/js/lib/sorted-set.no-require.js.txt +6 -0
  53. data/public/js/lib/underscore-min.js +6 -0
  54. data/public/js/lib/underscore.string.min.js +1 -0
  55. data/public/js/main.js +353 -0
  56. data/public/js/models/namespace.js +6 -0
  57. data/public/js/models/policyList.js +10 -0
  58. data/public/js/models/record.js +26 -0
  59. data/public/js/models/resourceList.js +61 -0
  60. data/public/js/models/userList.js +16 -0
  61. data/public/js/models/variableList.js +12 -0
  62. data/public/js/views/audit.js +191 -0
  63. data/public/js/views/dashboard.js +35 -0
  64. data/public/js/views/generic.js +42 -0
  65. data/public/js/views/group.js +32 -0
  66. data/public/js/views/groups.js +18 -0
  67. data/public/js/views/host.js +40 -0
  68. data/public/js/views/hosts.js +18 -0
  69. data/public/js/views/layer.js +63 -0
  70. data/public/js/views/layers.js +18 -0
  71. data/public/js/views/mixins/search.js +9 -0
  72. data/public/js/views/namespaces.js +40 -0
  73. data/public/js/views/navSearch.js +16 -0
  74. data/public/js/views/permissions.js +91 -0
  75. data/public/js/views/policies.js +17 -0
  76. data/public/js/views/policy.js +23 -0
  77. data/public/js/views/resource.js +23 -0
  78. data/public/js/views/role.js +18 -0
  79. data/public/js/views/searchResults.js +146 -0
  80. data/public/js/views/time.js +14 -0
  81. data/public/js/views/user.js +22 -0
  82. data/public/js/views/users.js +18 -0
  83. data/public/js/views/variable.js +41 -0
  84. data/public/js/views/variables.js +18 -0
  85. data/vendor/prelude-ls/.gitignore +2 -0
  86. data/vendor/prelude-ls/.travis.yml +3 -0
  87. data/vendor/prelude-ls/CHANGELOG.md +81 -0
  88. data/vendor/prelude-ls/LICENSE +22 -0
  89. data/vendor/prelude-ls/Makefile +50 -0
  90. data/vendor/prelude-ls/README.md +15 -0
  91. data/vendor/prelude-ls/browser/prelude-browser-min.js +1 -0
  92. data/vendor/prelude-ls/browser/prelude-browser.js +1172 -0
  93. data/vendor/prelude-ls/lib/Func.js +40 -0
  94. data/vendor/prelude-ls/lib/List.js +602 -0
  95. data/vendor/prelude-ls/lib/Num.js +129 -0
  96. data/vendor/prelude-ls/lib/Obj.js +153 -0
  97. data/vendor/prelude-ls/lib/Str.js +68 -0
  98. data/vendor/prelude-ls/lib/index.js +164 -0
  99. data/vendor/prelude-ls/package.json +50 -0
  100. data/vendor/prelude-ls/package.ls +46 -0
  101. data/vendor/prelude-ls/src/Func.ls +17 -0
  102. data/vendor/prelude-ls/src/List.ls +299 -0
  103. data/vendor/prelude-ls/src/Num.ls +83 -0
  104. data/vendor/prelude-ls/src/Obj.ls +61 -0
  105. data/vendor/prelude-ls/src/Str.ls +32 -0
  106. data/vendor/prelude-ls/src/index.ls +56 -0
  107. data/vendor/prelude-ls/test/Func.ls +36 -0
  108. data/vendor/prelude-ls/test/List.ls +751 -0
  109. data/vendor/prelude-ls/test/Num.ls +258 -0
  110. data/vendor/prelude-ls/test/Obj.ls +145 -0
  111. data/vendor/prelude-ls/test/Prelude.ls +49 -0
  112. data/vendor/prelude-ls/test/Str.ls +208 -0
  113. data/vendor/prelude-ls/test/browser.html +5 -0
  114. metadata +328 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: de26f41cb7967fb35721ea8a7f0f63c9a839224f
4
+ data.tar.gz: ebd5a26239e74212c595d69298eed97bdbe81fcd
5
+ SHA512:
6
+ metadata.gz: a6faf7355101b509e800604e39b7b2173b24048e0ddd28ef564536d39deac108ee840fc75be67a473e4be4179d72e2b17146bf5e7b3fd6c3323450418d9b77d6
7
+ data.tar.gz: 225521cc4f10ba28ac536175522042eba3f1da11db74283b05ca8a1b9f05d0532eae7db8f5b1d83617fd119e03bb1d5d7f067841fd856641cdf15d9a4dac5f5f
@@ -0,0 +1,31 @@
1
+ require 'pathname'
2
+
3
+ module Overcommit::Hook::PreCommit
4
+ # Ensure the livescript source files are compiled.
5
+ # Also make sure they're included in the commit.
6
+ class EnsureLivescriptCompiled < Base
7
+ def compiled_path ls
8
+ ls.sub('livescript/', 'public/js/').sub(/\.ls$/, '.js')
9
+ end
10
+
11
+ def relative path
12
+ Pathname.new(path).relative_path_from Pathname.getwd
13
+ end
14
+
15
+ def check_file lsfile
16
+ compiled = compiled_path lsfile
17
+
18
+ return "#{relative compiled}: older than #{relative lsfile}.
19
+ $ ./compile_ls &" if File.stat(lsfile) > File.stat(compiled)
20
+
21
+ return "#{relative lsfile}: compiled file not added.
22
+ $ git add #{relative compiled}" unless modified_files.include? compiled
23
+ end
24
+
25
+ def run
26
+ errs = applicable_files.map(&method(:check_file)).compact
27
+ return :bad, errs.join('\n') unless errs.empty?
28
+ :good
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,26 @@
1
+ module Overcommit::Hook::PreCommit
2
+ # Checks for trailing whitespace in files.
3
+ class TrailingWhitespace < Base
4
+ def message
5
+ "Trailing whitespace detected"
6
+ end
7
+
8
+ def lint_split output, message = message
9
+ # Keep lines from the output for files that we actually modified
10
+ error_lines, warning_lines = output.split("\n").partition do |output_line|
11
+ _, file, line = output_line.match(/^([^:]+):(\d+)/).to_a
12
+ modified_lines(file).include?(line.to_i)
13
+ end
14
+
15
+ return :bad, message + ":\n" + error_lines.join("\n") unless error_lines.empty?
16
+ return :warn, message + " (on lines you didn't modify):\n" + warning_lines.join("\n")\
17
+ unless warning_lines.empty?
18
+
19
+ :good
20
+ end
21
+
22
+ def run
23
+ lint_split execute(%w[grep -IHn \s$] + applicable_files).stdout
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,20 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ .idea
19
+ .DS_Store
20
+
@@ -0,0 +1,5 @@
1
+ PreCommit:
2
+ EnsureLivescriptCompiled:
3
+ description: 'Checking if LiveScript files are compiled'
4
+ include: 'livescript/*.ls'
5
+ requires_files: true
@@ -0,0 +1,18 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <projectDescription>
3
+ <name>conjur-asset-ui</name>
4
+ <comment></comment>
5
+ <projects>
6
+ </projects>
7
+ <buildSpec>
8
+ <buildCommand>
9
+ <name>com.aptana.ide.core.unifiedBuilder</name>
10
+ <arguments>
11
+ </arguments>
12
+ </buildCommand>
13
+ </buildSpec>
14
+ <natures>
15
+ <nature>com.aptana.ruby.core.rubynature</nature>
16
+ <nature>com.aptana.projects.webnature</nature>
17
+ </natures>
18
+ </projectDescription>
data/Gemfile ADDED
@@ -0,0 +1,8 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in conjur-asset-pubkeys.gemspec
4
+ gemspec
5
+
6
+ group :development do
7
+ gem 'pry'
8
+ end
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Kevin Gilpin
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,41 @@
1
+ conjur-asset-ui
2
+ ===============
3
+
4
+ This Gem is a Conjur plugin providing UI features.
5
+
6
+ Usage
7
+ -----
8
+
9
+ First install the gem, with the rather clumsy name `conjur-asset-ui-api`.
10
+
11
+ ```
12
+ gem install conjur-asset-ui-api
13
+ ```
14
+
15
+ Or add the following line to your `Gemfile`:
16
+
17
+ ```
18
+ gem 'conjur-asset-ruby-api'
19
+ ```
20
+
21
+ Next, edit your `.conjurrc` file to add the `"ui"` plugin, for example:
22
+
23
+ ```
24
+ stack: v4
25
+ account: sandbox
26
+ plugins:
27
+ - ui
28
+ - layer
29
+ ```
30
+
31
+ Make sure you are logged into conjur:
32
+
33
+ ```
34
+ conjur authn:login
35
+ ```
36
+
37
+ And run the UI:
38
+
39
+ ```
40
+ conjur ui
41
+ ```
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,2 @@
1
+ #!/bin/bash
2
+ lsc -w -c -o public/js livescript
@@ -0,0 +1,36 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'conjur-asset-ui-version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "conjur-asset-ui-api"
8
+ spec.version = Conjur::Asset::UI::VERSION
9
+ spec.authors = ["Jon Mason", "Kevin Gilpin", "Rafa\305\202 Rzepecki"]
10
+ spec.email = ["jon@conjur.net", "kgilpin@conjur.net", "rafal@conjur.net"]
11
+ spec.homepage = "http://conjur.net"
12
+ spec.summary = "Conjur User Interface Plugin"
13
+ spec.homepage = ""
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_dependency "puma"
22
+ spec.add_dependency "conjur-api", "~> 4.6"
23
+ spec.add_dependency "launchy"
24
+ spec.add_dependency "rack"
25
+
26
+ # we're monkey patching hackily, so fix the version
27
+ spec.add_dependency "rack-streaming-proxy", "= 2.0.1"
28
+
29
+ spec.add_development_dependency "conjur-cli"
30
+ spec.add_development_dependency "bundler", "~> 1.3"
31
+ spec.add_development_dependency "rake"
32
+ spec.add_development_dependency "rspec"
33
+ spec.add_development_dependency "simplecov"
34
+ spec.add_development_dependency "spork"
35
+ spec.add_development_dependency "ci_reporter"
36
+ end
@@ -0,0 +1,7 @@
1
+ module Conjur
2
+ module Asset
3
+ module UI
4
+ VERSION="1.1.0"
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ require 'conjur-asset-ui-version'
2
+ require 'conjur/webserver/api_proxy'
3
+ require 'conjur/webserver/authorize'
4
+ require 'conjur/webserver/conjur_info'
5
+ require 'conjur/webserver/home'
6
+ require 'conjur/webserver/login'
7
+ require 'conjur/webserver/server'
@@ -0,0 +1,63 @@
1
+ module Conjur
2
+ module Audit
3
+ class Follower
4
+ # Initialize a follower that will fetch more records by
5
+ # calling :block: with options to merge into the options passed
6
+ # to the audit method (eg, limit, offset)
7
+ def initialize &block
8
+ @fetch = block
9
+ end
10
+
11
+ # Filter events received so that only events for which
12
+ # :block: returns truthy are passed to the block given to
13
+ # :#follow:.
14
+ def filter &filter
15
+ @filter = filter
16
+ end
17
+
18
+ # Follow audit events, yielding non-empty
19
+ # arrays of new events to :block: as they
20
+ # are fetched.
21
+ def follow &block
22
+ @last_event_id = nil
23
+
24
+ loop do
25
+ new_events = fetch_new_events
26
+ new_events.select!(&@filter) if @filter
27
+ if new_events.empty?
28
+ sleep 1
29
+ else
30
+ block.call new_events
31
+ end
32
+ end
33
+ end
34
+
35
+ protected
36
+
37
+ # Fetch all events after @last_event_id, updating it
38
+ # to point to the last event returned by this method.
39
+ # May return an empty array if no new events are available.
40
+ def fetch_new_events
41
+ # If @last_event_id is nil just fetch and return the
42
+ # most recent events, updating @last_event_id
43
+ if @last_event_id.nil?
44
+ events = @fetch.call(offset: 0)
45
+ @last_event_id = events.last['event_id'] unless events.empty?
46
+ return events
47
+ end
48
+
49
+ # We have a @last_event_id, fetch batches of events until we
50
+ # find it.
51
+ events = []
52
+ while (index = events.find_index{|e| e['event_id'] == @last_event_id}).nil?
53
+ events = @fetch.call(offset: events.length, limit: 10).reverse.concat events
54
+ end
55
+
56
+ # Update @last_event_id and return the sliced events, reversing it one
57
+ # last time (because the block given to follow expects events to be reversed)
58
+ @last_event_id = events.last['event_id'] unless events.empty?
59
+ events[index + 1..-1].reverse
60
+ end
61
+ end
62
+ end
63
+ end
@@ -0,0 +1,53 @@
1
+ module Conjur
2
+ module Audit
3
+ module Humanizer
4
+ class << self
5
+ # Add a "human" field to the event, describing what happened.
6
+ def humanize event
7
+ e = event.symbolize_keys
8
+ # hack: sometimes resource is a hash. We don't want that!
9
+ if e[:resource] && e[:resource].kind_of?(Hash)
10
+ e[:resource] = e[:resource]['id']
11
+ end
12
+ s = " #{e[:conjur_user]}"
13
+ s << " (as #{e[:conjur_role]})" if e[:conjur_role] != e[:conjur_user]
14
+ formatter = SHORT_FORMATS["#{e[:asset]}:#{e[:action]}"]
15
+ if formatter
16
+ s << " " << formatter.call(e)
17
+ else
18
+ s << " unknown event: #{e[:asset]}:#{e[:action]}!"
19
+ end
20
+ s << " (failed with #{e[:error]})" if e[:error]
21
+ event['human'] = s
22
+ end
23
+
24
+ def append_features base
25
+ base.class_eval do
26
+ def humanize e
27
+ Conjur::Audit::Humanizer.humanize e
28
+ end
29
+ def self.humanize e
30
+ Conjur::Audit::Humanizer.humanize e
31
+ end
32
+ end
33
+ end
34
+
35
+ private
36
+ SHORT_FORMATS = {
37
+ 'resource:check' => lambda{|e| "checked that they can #{e[:privilege]} #{e[:resource]} (#{e[:allowed]})" },
38
+ 'resource:create' => lambda{|e| "created resource #{e[:resource_id]} owned by #{e[:owner]}" },
39
+ 'resource:update' => lambda{|e| "gave #{e[:resource]} to #{e[:owner]}" },
40
+ 'resource:destroy' => lambda{|e| "destroyed resource #{e[:resource]}" },
41
+ 'resource:permit' => lambda{|e| "permitted #{e[:grantee]} to #{e[:privilege]} #{e[:resource]} (grant option: #{!!e[:grant_option]})" },
42
+ 'resource:deny' => lambda{|e| "denied #{e[:privilege]} from #{e[:grantee]} on #{e[:resource]}" },
43
+ 'resource:permitted_roles' => lambda{|e| "listed roles permitted to #{e[:permission]} on #{e[:resource]}" },
44
+ 'role:check' => lambda{|e| "checked that #{e[:role] == e[:conjur_user] ? 'they' : e[:role]} can #{e[:privilege]} #{e[:resource]} (#{e[:allowed]})" },
45
+ 'role:grant' => lambda{|e| "granted role #{e[:role]} to #{e[:member]} #{e[:admin_option] ? ' with ' : ' without '}admin" },
46
+ 'role:revoke' => lambda{|e| "revoked role #{e[:role]} from #{e[:member]}" },
47
+ 'role:create' => lambda{|e| "created role #{e[:role_id]}" }
48
+ }
49
+
50
+ end
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,55 @@
1
+ module Conjur
2
+ module Audit
3
+ module Tableizer
4
+ class << self
5
+ # Output a standardized event suitable for table display.
6
+ def tableize event
7
+ e = event.symbolize_keys
8
+ # hack: sometimes resource is a hash. We don't want that!
9
+ if e[:resource] && e[:resource].kind_of?(Hash)
10
+ e[:resource] = e[:resource]['id']
11
+ end
12
+
13
+ formatter = INFO_FORMATS["#{e[:asset]}:#{e[:action]}"]
14
+ info = if formatter
15
+ formatter.call(e)
16
+ else
17
+ { }
18
+ end
19
+
20
+ result = {}
21
+ result[:actor] = e[:conjur_role] || e[:conjur_user]
22
+ result.merge! info
23
+ event['table'] = result
24
+ end
25
+
26
+ def append_features base
27
+ base.class_eval do
28
+ def tableize e
29
+ Conjur::Audit::Tableizer.tableize e
30
+ end
31
+ def self.humanize e
32
+ Conjur::Audit::Tableizer.tableize e
33
+ end
34
+ end
35
+ end
36
+
37
+ private
38
+
39
+ INFO_FORMATS = {
40
+ 'resource:check' => lambda{|e| { action: :check, object_kind: :resource, object: e[:resource], privilege: e[:privilege], result: e[:allowed] } },
41
+ 'resource:create' => lambda{|e| { action: :create, object_kind: :resource, object: e[:resource_id] } },
42
+ 'resource:update' => lambda{|e| { action: :update, object_kind: :resource, object: e[:resource] } },
43
+ 'resource:destroy' => lambda{|e| { action: :destroy, object_kind: :resource, object: e[:resource] } },
44
+ 'resource:permit' => lambda{|e| { action: :permit, object_kind: :resource, object: e[:resource], privilege: e[:privilege], grantee: e[:grantee], grant_option: e[:grant_option] } },
45
+ 'resource:deny' => lambda{|e| { action: :deny, object_kind: :resource, object: e[:resource], privilege: e[:privilege], grantee: e[:grantee] } },
46
+ 'resource:permitted_roles' => lambda{|e| { action: :list_roles, object_kind: :resource, object: e[:resource] } },
47
+ 'role:check' => lambda{|e| { action: :check, object_kind: :resource, object: e[:resource], privilege: e[:privilege], detail: e[:allowed] } },
48
+ 'role:grant' => lambda{|e| { action: :grant, object_kind: :role, object: e[:role], member: e[:member], admin: e[:admin_option] } },
49
+ 'role:revoke' => lambda{|e| { action: :revoke, object_kind: :role, object: e[:role], member: e[:member] } },
50
+ 'role:create' => lambda{|e| { action: :create, object_kind: :role, object: e[:role_id] } }
51
+ }
52
+ end
53
+ end
54
+ end
55
+ end
@@ -0,0 +1,38 @@
1
+ #
2
+ # Copyright (C) 2013 Conjur Inc
3
+ #
4
+ # Permission is hereby granted, free of charge, to any person obtaining a copy of
5
+ # this software and associated documentation files (the "Software"), to deal in
6
+ # the Software without restriction, including without limitation the rights to
7
+ # use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
8
+ # the Software, and to permit persons to whom the Software is furnished to do so,
9
+ # subject to the following conditions:
10
+ #
11
+ # The above copyright notice and this permission notice shall be included in all
12
+ # copies or substantial portions of the Software.
13
+ #
14
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
16
+ # FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
17
+ # COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
18
+ # IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
19
+ # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20
+ #
21
+ class Conjur::Command::UI < Conjur::Command
22
+ desc "Launch a UI"
23
+ arg_name "root-path"
24
+ Conjur::CLI.command :ui do |c|
25
+ c.action do |global_options,options,args|
26
+ root = args.pop || File.expand_path('../../../public', File.dirname(__FILE__))
27
+
28
+ require 'conjur/webserver/server'
29
+ server = Conjur::WebServer::Server.new
30
+ thread = Thread.new do
31
+ server.start(root)
32
+ end
33
+ sleep 0.5
34
+ server.open
35
+ thread.join
36
+ end
37
+ end
38
+ end