Skip to content

Commit c348547

Browse files
authored
Merge pull request #765 from code0-tech/763-move-abilities-from-query-to-application
Move exposed global abilities from QueryType to ApplicationType
2 parents 06e25cf + 430d9b3 commit c348547

File tree

7 files changed

+19
-19
lines changed

7 files changed

+19
-19
lines changed

app/graphql/types/application_type.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,15 @@ class ApplicationType < Types::BaseObject
1010
field :settings, Types::ApplicationSettingsType, null: true,
1111
description: 'Global application settings'
1212

13+
expose_abilities %i[
14+
create_organization
15+
create_runtime
16+
delete_runtime
17+
update_runtime
18+
rotate_runtime_token
19+
update_application_setting
20+
], subject_resolver: -> { :global }
21+
1322
def metadata
1423
{}
1524
end

app/graphql/types/query_type.rb

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -52,15 +52,6 @@ class QueryType < Types::BaseObject
5252

5353
field :global_runtimes, Types::RuntimeType.connection_type, null: false, description: 'Find runtimes'
5454

55-
expose_abilities %i[
56-
create_organization
57-
create_runtime
58-
delete_runtime
59-
update_runtime
60-
rotate_runtime_token
61-
update_application_setting
62-
], entity_name: 'Instance', subject_resolver: -> { :global }
63-
6455
def node(id:)
6556
context.schema.object_from_id(id, context)
6657
end

docs/graphql/object/application.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@ Represents the application instance
1010
|------|------|-------------|
1111
| `metadata` | [`Metadata!`](../object/metadata.md) | Metadata about the application |
1212
| `settings` | [`ApplicationSettings`](../object/applicationsettings.md) | Global application settings |
13+
| `userAbilities` | [`ApplicationUserAbilities!`](../object/applicationuserabilities.md) | Abilities for the current user on this Application |
1314

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
---
2-
title: InstanceUserAbilities
2+
title: ApplicationUserAbilities
33
---
44

5-
Abilities for the current user on this Instance
5+
Abilities for the current user on this Application
66

77
## Fields without arguments
88

99
| Name | Type | Description |
1010
|------|------|-------------|
11-
| `createOrganization` | [`Boolean!`](../scalar/boolean.md) | Shows if the current user has the `create_organization` ability on this Instance |
12-
| `createRuntime` | [`Boolean!`](../scalar/boolean.md) | Shows if the current user has the `create_runtime` ability on this Instance |
13-
| `deleteRuntime` | [`Boolean!`](../scalar/boolean.md) | Shows if the current user has the `delete_runtime` ability on this Instance |
14-
| `rotateRuntimeToken` | [`Boolean!`](../scalar/boolean.md) | Shows if the current user has the `rotate_runtime_token` ability on this Instance |
15-
| `updateApplicationSetting` | [`Boolean!`](../scalar/boolean.md) | Shows if the current user has the `update_application_setting` ability on this Instance |
16-
| `updateRuntime` | [`Boolean!`](../scalar/boolean.md) | Shows if the current user has the `update_runtime` ability on this Instance |
11+
| `createOrganization` | [`Boolean!`](../scalar/boolean.md) | Shows if the current user has the `create_organization` ability on this Application |
12+
| `createRuntime` | [`Boolean!`](../scalar/boolean.md) | Shows if the current user has the `create_runtime` ability on this Application |
13+
| `deleteRuntime` | [`Boolean!`](../scalar/boolean.md) | Shows if the current user has the `delete_runtime` ability on this Application |
14+
| `rotateRuntimeToken` | [`Boolean!`](../scalar/boolean.md) | Shows if the current user has the `rotate_runtime_token` ability on this Application |
15+
| `updateApplicationSetting` | [`Boolean!`](../scalar/boolean.md) | Shows if the current user has the `update_application_setting` ability on this Application |
16+
| `updateRuntime` | [`Boolean!`](../scalar/boolean.md) | Shows if the current user has the `update_runtime` ability on this Application |
1717

docs/graphql/object/query.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ Root Query type
1313
| `currentUser` | [`User`](../object/user.md) | Get the currently logged in user |
1414
| `globalRuntimes` | [`RuntimeConnection!`](../object/runtimeconnection.md) | Find runtimes |
1515
| `organizations` | [`OrganizationConnection!`](../object/organizationconnection.md) | Find organizations |
16-
| `userAbilities` | [`InstanceUserAbilities!`](../object/instanceuserabilities.md) | Abilities for the current user on this Instance |
1716
| `users` | [`UserConnection!`](../object/userconnection.md) | Find users |
1817

1918
## Fields with arguments

spec/graphql/types/application_type_spec.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
%w[
88
settings
99
metadata
10+
user_abilities
1011
]
1112
end
1213

spec/graphql/types/query_type_spec.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
user
1616
global_runtimes
1717
namespace
18-
userAbilities
1918
node
2019
nodes
2120
]

0 commit comments

Comments
 (0)