cf-perm 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/perm/protos/permission_service_pb.rb +2 -0
- data/lib/perm/v1/client.rb +10 -6
- data/lib/perm/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c3d438b85d2fa5fee3e8f26986170c9d8f64adf4ad5ca76a9531a4e7f7d25a89
|
4
|
+
data.tar.gz: 87fbb221add46447626c3c50c04b69f2540f02beaff8ddec501b5882a7d61bed
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '09a5dbed10f9052c4303e0248155ade541276031e7380ffed621883fc3c8d0fb0b0f7c42d78a2c73d0817d322e746dc5c46ef4b4606be3b710ba1b1a3bea637a'
|
7
|
+
data.tar.gz: a1fa6b2e069a1c3209430304e89749978eede258de9304991fc54071247762e0832c4fb8243127385cb1e802775d7e3fd6e2dae414bf97265ee8925ea39c9ecf
|
@@ -4,11 +4,13 @@
|
|
4
4
|
require 'google/protobuf'
|
5
5
|
|
6
6
|
require 'actor_pb'
|
7
|
+
require 'group_pb'
|
7
8
|
Google::Protobuf::DescriptorPool.generated_pool.build do
|
8
9
|
add_message "cloud_foundry.perm.protos.HasPermissionRequest" do
|
9
10
|
optional :actor, :message, 1, "cloud_foundry.perm.protos.Actor"
|
10
11
|
optional :action, :string, 2
|
11
12
|
optional :resource, :string, 3
|
13
|
+
repeated :groups, :message, 4, "cloud_foundry.perm.protos.Group"
|
12
14
|
end
|
13
15
|
add_message "cloud_foundry.perm.protos.HasPermissionResponse" do
|
14
16
|
optional :has_permission, :bool, 1
|
data/lib/perm/v1/client.rb
CHANGED
@@ -135,16 +135,20 @@ module CloudFoundry
|
|
135
135
|
raise Errors.from_grpc_error(e)
|
136
136
|
end
|
137
137
|
|
138
|
-
|
138
|
+
# rubocop:disable Metrics/MethodLength
|
139
|
+
def has_permission?(actor_id:, namespace:, action:, resource:, group_ids: [])
|
139
140
|
actor = Protos::Actor.new(id: actor_id, namespace: namespace)
|
141
|
+
|
142
|
+
groups = []
|
143
|
+
group_ids.each do |group_id|
|
144
|
+
groups.push(Protos::Group.new(id: group_id))
|
145
|
+
end
|
146
|
+
|
140
147
|
request = Protos::HasPermissionRequest.new(
|
141
|
-
actor: actor,
|
142
|
-
action: action,
|
143
|
-
resource: resource
|
148
|
+
actor: actor, action: action, resource: resource, groups: groups
|
144
149
|
)
|
145
150
|
|
146
|
-
|
147
|
-
response.has_permission
|
151
|
+
grpc_permission_service.has_permission(request).has_permission
|
148
152
|
rescue GRPC::BadStatus => e
|
149
153
|
raise Errors.from_grpc_error(e)
|
150
154
|
end
|
data/lib/perm/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cf-perm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- CloudFoundry Permissions Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-04-
|
11
|
+
date: 2018-04-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: grpc
|