Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ AllCops:
Exclude:
- vendor/bundle/**/*

require:
plugins:
- rubocop-rspec
- rubocop-performance
- rubocop-rake
Expand Down
8 changes: 4 additions & 4 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ group :development do
gem "codecov", "~> 0.6"
gem "grpc_mock", "~> 0.4"
gem "pry-byebug", "~> 3.10"
gem "rspec", "~> 3.0"
gem "rubocop-performance", "~> 1.14"
gem "rubocop-rspec", "~> 2.11"
gem "rspec", "~> 3.5"
gem "rubocop-performance", "~> 1.24"
gem "rubocop-rspec", "~> 3.5"

gem "rake", "~> 13.1"

gem "rubocop-rake", "~> 0.6.0"
gem "rubocop-rake", "~> 0.7.1"
end
8 changes: 4 additions & 4 deletions aserto.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ Gem::Specification.new do |spec|
spec.metadata["rubygems_mfa_required"] = "true"

# runtime dependencies
spec.add_runtime_dependency "aserto-authorizer", "~> 0.20", ">= 0.20.2"
spec.add_runtime_dependency "aserto-directory", "~> 0.31", ">= 0.31.4"
spec.add_runtime_dependency "jwt", "~> 2.4"
spec.add_runtime_dependency "rack", ">= 2.0", "< 4.0"
spec.add_dependency "aserto-authorizer", "~> 0.20", ">= 0.20.2"
spec.add_dependency "aserto-directory", "~> 0.31", ">= 0.31.6"
spec.add_dependency "jwt", "~> 2.4"
spec.add_dependency "rack", ">= 2.0", "< 4.0"
end
18 changes: 10 additions & 8 deletions lib/aserto/directory/v3/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,16 @@ def initialize(config)
@model = create_client(:model, base_config.model)
end

SERVICE_MAP = {
reader: ::Aserto::Directory::Reader::V3::Reader::Stub,
writer: ::Aserto::Directory::Writer::V3::Writer::Stub,
importer: ::Aserto::Directory::Importer::V3::Importer::Stub,
exporter: ::Aserto::Directory::Exporter::V3::Exporter::Stub,
model: ::Aserto::Directory::Model::V3::Model::Stub
}.freeze

private_constant :SERVICE_MAP

private

attr_reader :reader, :writer, :model, :importer, :exporter
Expand All @@ -86,14 +96,6 @@ def respond_to_missing?(_name, _include_private)
end
end

SERVICE_MAP = {
reader: ::Aserto::Directory::Reader::V3::Reader::Stub,
writer: ::Aserto::Directory::Writer::V3::Writer::Stub,
importer: ::Aserto::Directory::Importer::V3::Importer::Stub,
exporter: ::Aserto::Directory::Exporter::V3::Exporter::Stub,
model: ::Aserto::Directory::Model::V3::Model::Stub
}.freeze

def create_client(type, config)
return NullClient.new(type) unless config

Expand Down
2 changes: 1 addition & 1 deletion lib/aserto/policy_path_mapper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def execute(policy_root, request)
path = route[:path] if route
end

policy_path = +"#{policy_root}.#{method}.#{path}"
policy_path = "#{policy_root}.#{method}.#{path}"
policy_path.tr!("/", ".")
policy_path.gsub!("..", ".")
policy_path.gsub!(":", "__")
Expand Down
6 changes: 1 addition & 5 deletions spec/aserto/directory/client_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,9 @@
it "returns the correct object" do
expect(client.object(type: "type", key: "key").to_h).to eq(
{
created_at: nil,
display_name: "display_name",
hash: "",
key: "key",
properties: nil,
type: "type",
updated_at: nil
type: "type"
}
)
end
Expand Down
10 changes: 2 additions & 8 deletions spec/aserto/directory/v3/client_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -76,16 +76,10 @@
).to_h).to eq(
{
result: {
created_at: nil,
display_name: "display_name",
etag: "",
id: "id",
properties: nil,
type: "type",
updated_at: nil
},
relations: [],
page: nil
type: "type"
}
}
)
end
Expand Down
12 changes: 5 additions & 7 deletions spec/integration/directory_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,7 @@
subject_type: "user",
relation: "member",
object_id: "my-group",
object_type: "group",
subject_relation: "" }
object_type: "group" }
)
end

Expand All @@ -157,7 +156,7 @@
object_id: "my-group",
object_type: "group"
).to_h).to eq(
{ check: true, trace: [] }
{ check: true }
)
end

Expand All @@ -169,7 +168,7 @@
object_id: "my-group",
object_type: "group"
).to_h).to eq(
{ check: true, trace: [] }
{ check: true, context: {} }
)
end

Expand All @@ -181,7 +180,7 @@
object_id: "my-group",
object_type: "group"
).to_h).to eq(
{ check: true, trace: [] }
{ check: true }
)
end

Expand All @@ -195,8 +194,7 @@
subject_type: "user",
relation: "member",
object_id: "my-group",
object_type: "group",
subject_relation: ""
object_type: "group"
}
)
end
Expand Down
3 changes: 1 addition & 2 deletions spec/integration/topaz.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@ def stop
end

def configure
system "topaz config new -r ghcr.io/aserto-policies/policy-todo:2.1.0 -n todo -d -f"
system "topaz config use todo"
system "topaz templates install todo -f --no-console -i"
end

def cleanup
Expand Down
Loading