kcv 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.envrc +1 -0
- data/.gitignore +10 -0
- data/.rubocop.yml +30 -0
- data/.travis.yml +5 -0
- data/Gemfile +8 -0
- data/README.md +28 -0
- data/Rakefile +12 -0
- data/bin/console +14 -0
- data/bin/rspec +21 -0
- data/bin/setup +8 -0
- data/kcv.gemspec +37 -0
- data/lib/kcv.rb +9 -0
- data/lib/kcv/agent_resolver.rb +26 -0
- data/lib/kcv/version.rb +5 -0
- metadata +158 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: b63d5b72b1a0cb5d1c4616e1c5a397ff1b2d962b29f9a8c81b5579c0f4599654
|
4
|
+
data.tar.gz: eb868d698a8485521a71e213750715dc139aebf394dd6e59d531086fdaf4c9d1
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 968a0ccb155eba06ed6bf40ac143e7d9dcf617c323c6a98f397eccdd9b890a81f660e0b9cd1245244f791c253e375b48e3b5b9b8dd369465be9f8667e12f93d7
|
7
|
+
data.tar.gz: a41390eb0b9a263c6441eb9d192d9391612b535745e6c46c0d8ea6424c47f813a4162f9998e74b938aa9fe6f4d596ebd2cdadfe2d0b31cf6879a075dbc98c34c
|
data/.envrc
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
PATH_add bin
|
data/.gitignore
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
Rails:
|
2
|
+
Enabled: true
|
3
|
+
|
4
|
+
Rails/Delegate:
|
5
|
+
Enabled: false
|
6
|
+
|
7
|
+
# inherit_gem:
|
8
|
+
# rubocop-rails:
|
9
|
+
# - config/rails.yml
|
10
|
+
|
11
|
+
AllCops:
|
12
|
+
DisplayCopNames: true
|
13
|
+
TargetRubyVersion: 2.4
|
14
|
+
Exclude:
|
15
|
+
- 'bin/**/*'
|
16
|
+
- 'vendor/**/*'
|
17
|
+
|
18
|
+
Layout/MultilineMethodDefinitionBraceLayout:
|
19
|
+
EnforcedStyle: same_line
|
20
|
+
|
21
|
+
Metrics/LineLength:
|
22
|
+
Max: 110
|
23
|
+
|
24
|
+
Metrics/BlockLength:
|
25
|
+
Exclude:
|
26
|
+
- '*.gemspec'
|
27
|
+
ExcludedMethods: ['describe', 'context']
|
28
|
+
|
29
|
+
Style/StringLiterals:
|
30
|
+
Enabled: false
|
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# KCV
|
2
|
+
|
3
|
+
KCV is a glue gem for making it easy to use [Keycard](https://github.com/mlibrary/keycard),
|
4
|
+
[Checkpoint](https://github.com/mlibrary/checkpoint), and [Vizier](https://github.com/mlibrary/keycard)
|
5
|
+
together in your application.
|
6
|
+
|
7
|
+
Each of the above libraries is designed to be independent of each other, but follow relatively
|
8
|
+
simple interfaces that work together. For example, Checkpoint grants permissions to agents
|
9
|
+
and has an AgentResolver extension mechanisms and Keycard can inspect a request for the attributes
|
10
|
+
needed to create agents, but neither should depend on the other. This is where KCV comes in,
|
11
|
+
providing an AgentResolver implementation that depends on Keycard's interface. Then, this can
|
12
|
+
be used directly or extended within your application.
|
13
|
+
|
14
|
+
## Installation
|
15
|
+
|
16
|
+
Add this line to your application's Gemfile:
|
17
|
+
|
18
|
+
```ruby
|
19
|
+
gem 'kcv'
|
20
|
+
```
|
21
|
+
|
22
|
+
And then execute:
|
23
|
+
|
24
|
+
$ bundle
|
25
|
+
|
26
|
+
## License
|
27
|
+
|
28
|
+
Checkpoint is licensed under the BSD-3-Clause license. See [LICENSE.md](LICENSE.md).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "kcv"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/rspec
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
#
|
5
|
+
# This file was generated by Bundler.
|
6
|
+
#
|
7
|
+
# The application 'rspec' is installed as part of a gem, and
|
8
|
+
# this file is here to facilitate running it.
|
9
|
+
#
|
10
|
+
|
11
|
+
bundle_binstub = File.expand_path("../bundle", __FILE__)
|
12
|
+
load(bundle_binstub) if File.file?(bundle_binstub)
|
13
|
+
|
14
|
+
require "pathname"
|
15
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
16
|
+
Pathname.new(__FILE__).realpath)
|
17
|
+
|
18
|
+
require "rubygems"
|
19
|
+
require "bundler/setup"
|
20
|
+
|
21
|
+
load Gem.bin_path("rspec-core", "rspec")
|
data/bin/setup
ADDED
data/kcv.gemspec
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
lib = File.expand_path('lib', __dir__)
|
5
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
6
|
+
require "kcv/version"
|
7
|
+
|
8
|
+
Gem::Specification.new do |spec|
|
9
|
+
spec.name = "kcv"
|
10
|
+
spec.version = KCV::VERSION
|
11
|
+
spec.authors = ["Noah Botimer"]
|
12
|
+
spec.email = ["botimer@umich.edu"]
|
13
|
+
|
14
|
+
spec.summary = 'Glue gem for integration of Keycard, Checkpoint, and Vizier.'
|
15
|
+
spec.description = <<~DESC
|
16
|
+
This gem provides utilities for using Keycard, Checkpoint, and Vizier together, which have
|
17
|
+
no direct dependencies on each other. An application could implement any of these, but they
|
18
|
+
provide a standard base implementation for convenience and consistency.
|
19
|
+
DESC
|
20
|
+
spec.homepage = "https://github.com/mlibrary/kcv"
|
21
|
+
|
22
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
23
|
+
f.match(%r{^(test|spec|features)/})
|
24
|
+
end
|
25
|
+
spec.bindir = "exe"
|
26
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
27
|
+
spec.require_paths = ["lib"]
|
28
|
+
|
29
|
+
spec.add_dependency "checkpoint", "~> 1.0.1"
|
30
|
+
spec.add_dependency "keycard", "~> 0.1.2"
|
31
|
+
spec.add_dependency "vizier", "~> 0.1.0"
|
32
|
+
|
33
|
+
spec.add_development_dependency "bundler", "~> 1.16"
|
34
|
+
spec.add_development_dependency "coveralls", "~> 0.8"
|
35
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
36
|
+
spec.add_development_dependency "rspec", "~> 3.7"
|
37
|
+
end
|
data/lib/kcv.rb
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'checkpoint/agent'
|
4
|
+
require 'ostruct'
|
5
|
+
|
6
|
+
module KCV
|
7
|
+
class AgentResolver < Checkpoint::Agent::Resolver
|
8
|
+
def initialize(agent_factory: Checkpoint::Agent)
|
9
|
+
@agent_factory = agent_factory
|
10
|
+
end
|
11
|
+
|
12
|
+
def resolve(actor)
|
13
|
+
super + actor.identity.all.map { |k, v| agents_for(k, v) }.flatten
|
14
|
+
end
|
15
|
+
|
16
|
+
def agents_for(attribute, values)
|
17
|
+
[ values ].flatten.map do |value|
|
18
|
+
agent_factory.from(OpenStruct.new(agent_type: attribute, agent_id: value))
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
attr_reader :agent_factory
|
25
|
+
end
|
26
|
+
end
|
data/lib/kcv/version.rb
ADDED
metadata
ADDED
@@ -0,0 +1,158 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: kcv
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Noah Botimer
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-06-08 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: checkpoint
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 1.0.1
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 1.0.1
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: keycard
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.1.2
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 0.1.2
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: vizier
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 0.1.0
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 0.1.0
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: bundler
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1.16'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '1.16'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: coveralls
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0.8'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0.8'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rake
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '10.0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '10.0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rspec
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '3.7'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '3.7'
|
111
|
+
description: |
|
112
|
+
This gem provides utilities for using Keycard, Checkpoint, and Vizier together, which have
|
113
|
+
no direct dependencies on each other. An application could implement any of these, but they
|
114
|
+
provide a standard base implementation for convenience and consistency.
|
115
|
+
email:
|
116
|
+
- botimer@umich.edu
|
117
|
+
executables: []
|
118
|
+
extensions: []
|
119
|
+
extra_rdoc_files: []
|
120
|
+
files:
|
121
|
+
- ".envrc"
|
122
|
+
- ".gitignore"
|
123
|
+
- ".rubocop.yml"
|
124
|
+
- ".travis.yml"
|
125
|
+
- Gemfile
|
126
|
+
- README.md
|
127
|
+
- Rakefile
|
128
|
+
- bin/console
|
129
|
+
- bin/rspec
|
130
|
+
- bin/setup
|
131
|
+
- kcv.gemspec
|
132
|
+
- lib/kcv.rb
|
133
|
+
- lib/kcv/agent_resolver.rb
|
134
|
+
- lib/kcv/version.rb
|
135
|
+
homepage: https://github.com/mlibrary/kcv
|
136
|
+
licenses: []
|
137
|
+
metadata: {}
|
138
|
+
post_install_message:
|
139
|
+
rdoc_options: []
|
140
|
+
require_paths:
|
141
|
+
- lib
|
142
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
143
|
+
requirements:
|
144
|
+
- - ">="
|
145
|
+
- !ruby/object:Gem::Version
|
146
|
+
version: '0'
|
147
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
148
|
+
requirements:
|
149
|
+
- - ">="
|
150
|
+
- !ruby/object:Gem::Version
|
151
|
+
version: '0'
|
152
|
+
requirements: []
|
153
|
+
rubyforge_project:
|
154
|
+
rubygems_version: 2.7.3
|
155
|
+
signing_key:
|
156
|
+
specification_version: 4
|
157
|
+
summary: Glue gem for integration of Keycard, Checkpoint, and Vizier.
|
158
|
+
test_files: []
|