Skip to content

Commit c2dbef0

Browse files
authored
Merge pull request #753 from code0-tech/fix-polices-and-graphql-types
Fix some policies and graphql types
2 parents 6aebea1 + 42b724b commit c2dbef0

13 files changed

+56
-5
lines changed

app/graphql/types/data_type_type.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ module Types
44
class DataTypeType < Types::BaseObject
55
description 'Represents a DataType'
66

7-
authorize :read_datatype
7+
authorize :read_data_type
88

99
field :aliases, Types::TranslationType.connection_type, null: true, description: 'Name of the function'
1010
field :display_messages, Types::TranslationType.connection_type, null: true,

app/graphql/types/runtime_function_definition_type.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ module Types
44
class RuntimeFunctionDefinitionType < Types::BaseObject
55
description 'Represents a runtime function definition'
66

7-
authorize :read_flow
7+
authorize :read_runtime_function_definition
88

99
field :runtime, Types::RuntimeType,
1010
null: false, description: 'The runtime this runtime function definition belongs to'

app/graphql/types/runtime_parameter_definition_type.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,12 @@ module Types
44
class RuntimeParameterDefinitionType < Types::BaseObject
55
description 'Represents a runtime parameter definition'
66

7-
authorize :read_flow
7+
authorize :read_runtime_parameter_definition
8+
9+
field :identifier, String,
10+
null: false,
11+
description: 'Identifier of the runtime parameter definition',
12+
method: :runtime_name
813

914
id_field RuntimeParameterDefinition
1015
timestamps

app/graphql/types/runtime_type.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ class RuntimeType < Types::BaseObject
1313
field :namespace, Types::NamespaceType, null: true, description: 'The parent namespace for the runtime'
1414
field :projects, Types::NamespaceProjectType.connection_type, null: false,
1515
description: 'Projects associated with the runtime'
16+
field :runtime_function_definitions, Types::RuntimeFunctionDefinitionType.connection_type,
17+
null: false,
18+
description: 'Functions of the runtime'
1619
field :status, Types::RuntimeStatusType, null: false, description: 'The status of the runtime'
1720

1821
field :token, String, null: true, description: 'Token belonging to the runtime, only present on creation'
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# frozen_string_literal: true
2+
3+
class RuntimeParameterDefinitionPolicy < BasePolicy
4+
delegate { subject.runtime_function_definition }
5+
end

app/policies/runtime_policy.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,10 @@
22

33
class RuntimePolicy < BasePolicy
44
delegate { subject.namespace || :global }
5+
6+
rule { can?(:read_runtime) }.policy do
7+
enable :read_data_type
8+
enable :read_runtime_function_definition
9+
enable :read_runtime_parameter_definition
10+
end
511
end

docs/graphql/object/runtime.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ Represents a runtime
1616
| `name` | [`String!`](../scalar/string.md) | The name for the runtime |
1717
| `namespace` | [`Namespace`](../object/namespace.md) | The parent namespace for the runtime |
1818
| `projects` | [`NamespaceProjectConnection!`](../object/namespaceprojectconnection.md) | Projects associated with the runtime |
19+
| `runtimeFunctionDefinitions` | [`RuntimeFunctionDefinitionConnection!`](../object/runtimefunctiondefinitionconnection.md) | Functions of the runtime |
1920
| `status` | [`RuntimeStatusType!`](../enum/runtimestatustype.md) | The status of the runtime |
2021
| `token` | [`String`](../scalar/string.md) | Token belonging to the runtime, only present on creation |
2122
| `updatedAt` | [`Time!`](../scalar/time.md) | Time when this Runtime was last updated |
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
title: RuntimeFunctionDefinitionConnection
3+
---
4+
5+
The connection type for RuntimeFunctionDefinition.
6+
7+
## Fields without arguments
8+
9+
| Name | Type | Description |
10+
|------|------|-------------|
11+
| `count` | [`Int!`](../scalar/int.md) | Total count of collection. |
12+
| `edges` | [`[RuntimeFunctionDefinitionEdge]`](../object/runtimefunctiondefinitionedge.md) | A list of edges. |
13+
| `nodes` | [`[RuntimeFunctionDefinition]`](../object/runtimefunctiondefinition.md) | A list of nodes. |
14+
| `pageInfo` | [`PageInfo!`](../object/pageinfo.md) | Information to aid in pagination. |
15+
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
title: RuntimeFunctionDefinitionEdge
3+
---
4+
5+
An edge in a connection.
6+
7+
## Fields without arguments
8+
9+
| Name | Type | Description |
10+
|------|------|-------------|
11+
| `cursor` | [`String!`](../scalar/string.md) | A cursor for use in pagination. |
12+
| `node` | [`RuntimeFunctionDefinition`](../object/runtimefunctiondefinition.md) | The item at the end of the edge. |
13+

docs/graphql/object/runtimeparameterdefinition.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,6 @@ Represents a runtime parameter definition
1010
|------|------|-------------|
1111
| `createdAt` | [`Time!`](../scalar/time.md) | Time when this RuntimeParameterDefinition was created |
1212
| `id` | [`RuntimeParameterDefinitionID!`](../scalar/runtimeparameterdefinitionid.md) | Global ID of this RuntimeParameterDefinition |
13+
| `identifier` | [`String!`](../scalar/string.md) | Identifier of the runtime parameter definition |
1314
| `updatedAt` | [`Time!`](../scalar/time.md) | Time when this RuntimeParameterDefinition was last updated |
1415

0 commit comments

Comments
 (0)