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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b18ae8cd46891b427341a9fa8e785a3e0ffd1bd473b669af103320cb88c346e6
4
- data.tar.gz: c7458a6df90d17c5df4247f05c4139d99adcc61072cfa78e0078d45add169ef1
3
+ metadata.gz: c3d438b85d2fa5fee3e8f26986170c9d8f64adf4ad5ca76a9531a4e7f7d25a89
4
+ data.tar.gz: 87fbb221add46447626c3c50c04b69f2540f02beaff8ddec501b5882a7d61bed
5
5
  SHA512:
6
- metadata.gz: 8d248aedcc61fd2c9811ed5505a0f1d39392dda946fa9b135732c3b0e8af003b3589ed65d1b881b152b8a8c76da3a0246d3e1573f2b7ddabc330ec0caf7c14ee
7
- data.tar.gz: 2d0b90af021ea61641010957011028b3060a681e87d1fe50c0828395d891c0313b4c6a1f682b7e3d8ceeb585add2198ada2edeed97b36326e64383fa29d4d90d
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
@@ -135,16 +135,20 @@ module CloudFoundry
135
135
  raise Errors.from_grpc_error(e)
136
136
  end
137
137
 
138
- def has_permission?(actor_id:, namespace:, action:, resource:)
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
- response = grpc_permission_service.has_permission(request)
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
@@ -2,6 +2,6 @@
2
2
 
3
3
  module CloudFoundry
4
4
  module Perm
5
- VERSION = '0.0.7'
5
+ VERSION = '0.0.8'
6
6
  end
7
7
  end
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.7
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-26 00:00:00.000000000 Z
11
+ date: 2018-04-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: grpc