cf-perm 0.0.1 → 0.0.2

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
  SHA1:
3
- metadata.gz: c7125e6f9fded928fc9d49e833237643482d998e
4
- data.tar.gz: 93406093631ca371dbaa93c4292be9bab1faa00f
3
+ metadata.gz: f8ae07f41dee2d41aa95de0b87105c783b76102c
4
+ data.tar.gz: c1ce90a2aaba29725755ad76756e7260db8dd42c
5
5
  SHA512:
6
- metadata.gz: 1e880c39115b70254c856b5fb0967f36bbd101ca1ebb0a252f1ac0b4e521d9f47adf784b3716efe6a509c6d18b5821a4ffca317aa9c815d0b7ce09d5ff8f068a
7
- data.tar.gz: f374e854a82c72a19278c410d1618aab0d2dedabba1fff5cd21880ec24ad243fc6c006469297f4c977222e755a22aea858ea7e7a0495907eee2ef12079e6b7eb
6
+ metadata.gz: b065adafe1f306cdeeda521f198bfd701addddffb44b69ac4230de9dc81c2667b3229bd2972a24c2454065f6df1e79ff72c7ad3e869ea16ade5cd751282d63ee
7
+ data.tar.gz: 695a179eb9123d0e73c07cb82bf249d4801422ff4767d28a0d74384f7f515914fb7d4729e435f2036546e428ba077dedde96473b1e57aa1fc19f665b5d796a29
@@ -5,7 +5,7 @@ require 'google/protobuf'
5
5
 
6
6
  Google::Protobuf::DescriptorPool.generated_pool.build do
7
7
  add_message "cloud_foundry.perm.protos.Permission" do
8
- optional :name, :string, 1
8
+ optional :action, :string, 1
9
9
  optional :resource_pattern, :string, 2
10
10
  end
11
11
  end
@@ -7,15 +7,15 @@ require 'actor_pb'
7
7
  Google::Protobuf::DescriptorPool.generated_pool.build do
8
8
  add_message "cloud_foundry.perm.protos.HasPermissionRequest" do
9
9
  optional :actor, :message, 1, "cloud_foundry.perm.protos.Actor"
10
- optional :permission_name, :string, 2
11
- optional :resource_id, :string, 3
10
+ optional :action, :string, 2
11
+ optional :resource, :string, 3
12
12
  end
13
13
  add_message "cloud_foundry.perm.protos.HasPermissionResponse" do
14
14
  optional :has_permission, :bool, 1
15
15
  end
16
16
  add_message "cloud_foundry.perm.protos.ListResourcePatternsRequest" do
17
17
  optional :actor, :message, 1, "cloud_foundry.perm.protos.Actor"
18
- optional :permission_name, :string, 2
18
+ optional :action, :string, 2
19
19
  end
20
20
  add_message "cloud_foundry.perm.protos.ListResourcePatternsResponse" do
21
21
  repeated :resource_patterns, :string, 1
@@ -21,7 +21,7 @@ module CloudFoundry
21
21
 
22
22
  def create_role(role_name:, permissions: [])
23
23
  permission_protos = permissions.map do |p|
24
- Protos::Permission.new(name: p.name, resource_pattern: p.resource_pattern)
24
+ Protos::Permission.new(action: p.action, resource_pattern: p.resource_pattern)
25
25
  end
26
26
  request = Protos::CreateRoleRequest.new(name: role_name, permissions: permission_protos)
27
27
 
@@ -108,18 +108,18 @@ module CloudFoundry
108
108
  permissions = response.permissions
109
109
 
110
110
  permissions.map do |permission|
111
- Models::Permission.new(name: permission.name, resource_pattern: permission.resource_pattern)
111
+ Models::Permission.new(action: permission.action, resource_pattern: permission.resource_pattern)
112
112
  end
113
113
  rescue GRPC::BadStatus => e
114
114
  raise Errors.from_grpc_error(e)
115
115
  end
116
116
 
117
- def has_permission?(actor_id:, namespace:, permission_name:, resource_id:)
117
+ def has_permission?(actor_id:, namespace:, action:, resource:)
118
118
  actor = Protos::Actor.new(id: actor_id, namespace: namespace)
119
119
  request = Protos::HasPermissionRequest.new(
120
120
  actor: actor,
121
- permission_name: permission_name,
122
- resource_id: resource_id
121
+ action: action,
122
+ resource: resource
123
123
  )
124
124
 
125
125
  response = grpc_permission_service.has_permission(request)
@@ -128,11 +128,11 @@ module CloudFoundry
128
128
  raise Errors.from_grpc_error(e)
129
129
  end
130
130
 
131
- def list_resource_patterns(actor_id:, namespace:, permission_name:)
131
+ def list_resource_patterns(actor_id:, namespace:, action:)
132
132
  actor = Protos::Actor.new(id: actor_id, namespace: namespace)
133
133
  request = Protos::ListResourcePatternsRequest.new(
134
134
  actor: actor,
135
- permission_name: permission_name
135
+ action: action
136
136
  )
137
137
 
138
138
  response = grpc_permission_service.list_resource_patterns(request)
@@ -5,10 +5,10 @@ module CloudFoundry
5
5
  module V1
6
6
  module Models
7
7
  class Permission < BaseModel
8
- attr_reader :name, :resource_pattern
8
+ attr_reader :action, :resource_pattern
9
9
 
10
- def initialize(name:, resource_pattern:)
11
- @name = name
10
+ def initialize(action:, resource_pattern:)
11
+ @action = action
12
12
  @resource_pattern = resource_pattern
13
13
  end
14
14
  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.1'
5
+ VERSION = '0.0.2'
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.1
4
+ version: 0.0.2
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 00:00:00.000000000 Z
11
+ date: 2018-04-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: grpc