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 +4 -4
- data/lib/perm/protos/permission_pb.rb +1 -1
- data/lib/perm/protos/permission_service_pb.rb +3 -3
- data/lib/perm/v1/client.rb +7 -7
- data/lib/perm/v1/models/permission.rb +3 -3
- data/lib/perm/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f8ae07f41dee2d41aa95de0b87105c783b76102c
|
4
|
+
data.tar.gz: c1ce90a2aaba29725755ad76756e7260db8dd42c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b065adafe1f306cdeeda521f198bfd701addddffb44b69ac4230de9dc81c2667b3229bd2972a24c2454065f6df1e79ff72c7ad3e869ea16ade5cd751282d63ee
|
7
|
+
data.tar.gz: 695a179eb9123d0e73c07cb82bf249d4801422ff4767d28a0d74384f7f515914fb7d4729e435f2036546e428ba077dedde96473b1e57aa1fc19f665b5d796a29
|
@@ -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 :
|
11
|
-
optional :
|
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 :
|
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
|
data/lib/perm/v1/client.rb
CHANGED
@@ -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(
|
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(
|
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:,
|
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
|
-
|
122
|
-
|
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:,
|
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
|
-
|
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 :
|
8
|
+
attr_reader :action, :resource_pattern
|
9
9
|
|
10
|
-
def initialize(
|
11
|
-
@
|
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
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.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
|
+
date: 2018-04-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: grpc
|