This commit is contained in:
Your Name 2021-08-04 00:56:18 +02:00
parent 51941b88ee
commit f01509cab1
12 changed files with 112 additions and 139 deletions

View File

@ -14,10 +14,9 @@ class Authentication
public function handle($request, Closure $next) public function handle($request, Closure $next)
{ {
if ($request->input('gql_session') === 'SUPER_SECRET_TOKEN') { if ($request->input('gql_session') === 'SUPER_SECRET_TOKEN') {
return "false"; return 'false';
} } else {
else { return 'true';
return "true";
} }
return $next($request); return $next($request);

View File

@ -43,8 +43,11 @@ class Plugin extends PluginBase
$this->app->singleton(DatabaseManager::class, function ($app) { $this->app->singleton(DatabaseManager::class, function ($app) {
return $app->make('db'); return $app->make('db');
}); });
\Illuminate\Support\Facades\Broadcast::routes(['prefix' => '', 'middleware' => 'GermanAirlinesVA\\Graphql\\Classes\\Authentication']); \Illuminate\Support\Facades\Broadcast::routes([
require("channels/channels.php"); 'prefix' => '',
'middleware' => 'GermanAirlinesVA\\Graphql\\Classes\\Authentication',
]);
require 'channels/channels.php';
Config::set('database.connections.germanairlinesva_graphql', Config::get('germanairlinesva.graphql::connection')); Config::set('database.connections.germanairlinesva_graphql', Config::get('germanairlinesva.graphql::connection'));
} }

View File

@ -15,10 +15,9 @@ class Authentication
public function handle($request, Closure $next) public function handle($request, Closure $next)
{ {
if ($request->header('Gql-Session') === 'SUPER_SECRET_KEY_HEADER') { if ($request->header('Gql-Session') === 'SUPER_SECRET_KEY_HEADER') {
return ""; return '';
} } else {
else { throw new AccessDeniedHttpException();
throw new AccessDeniedHttpException;
} }
return $next($request); return $next($request);

View File

@ -69,6 +69,6 @@ class Dummy extends GraphQLSubscription
*/ */
public function resolve($root, array $args, GraphQLContext $context, ResolveInfo $resolveInfo): array public function resolve($root, array $args, GraphQLContext $context, ResolveInfo $resolveInfo): array
{ {
return array($root); return [$root];
} }
} }

View File

@ -5,12 +5,12 @@ use BackendMenu;
class GraphqlKey extends Controller class GraphqlKey extends Controller
{ {
public $implement = [ 'Backend\Behaviors\ListController' ]; public $implement = ['Backend\Behaviors\ListController'];
public $listConfig = 'config_list.yaml';
public function __construct() public $listConfig = 'config_list.yaml';
{
parent::__construct(); public function __construct()
} {
parent::__construct();
}
} }

View File

@ -1,17 +1,18 @@
<div data-control="toolbar"> <div data-control="toolbar">
<button <button
class="btn btn-default oc-icon-trash-o" class="btn btn-default oc-icon-trash-o"
disabled="disabled" disabled="disabled"
onclick="$(this).data('request-data', { onclick="$(this).data('request-data', {
checked: $('.control-list').listWidget('getChecked') checked: $('.control-list').listWidget('getChecked')
})" })"
data-request="onDelete" data-request="onDelete"
data-request-confirm="<?= e(trans('backend::lang.list.delete_selected_confirm')) ?>" data-request-confirm="<?= e(trans('backend::lang.list.delete_selected_confirm')) ?>"
data-trigger-action="enable" data-trigger-action="enable"
data-trigger=".control-list input[type=checkbox]" data-trigger=".control-list input[type=checkbox]"
data-trigger-condition="checked" data-trigger-condition="checked"
data-request-success="$(this).prop('disabled', true)" data-request-success="$(this).prop('disabled', true)"
data-stripe-load-indicator> data-stripe-load-indicator
<?= e(trans('backend::lang.list.delete_selected')) ?> >
</button> <?= e(trans('backend::lang.list.delete_selected')) ?>
</button>
</div> </div>

View File

@ -6,6 +6,6 @@ showSetup: true
showCheckboxes: true showCheckboxes: true
recordsPerPage: 20 recordsPerPage: 20
toolbar: toolbar:
buttons: list_toolbar buttons: list_toolbar
search: search:
prompt: 'backend::lang.list.search_prompt' prompt: 'backend::lang.list.search_prompt'

View File

@ -1,5 +1,4 @@
title = "CMS" title = "CMS" ==
==
<?php <?php
use Cms\Classes\Theme; use Cms\Classes\Theme;
use Cms\Classes\Content; use Cms\Classes\Content;
@ -12,12 +11,6 @@ function resolveCmsContent($root, $args) {
return Content::loadCached($theme, $args['name']); return Content::loadCached($theme, $args['name']);
} }
?> ?>
== == # Content extend type Query { cmsContent(name: String!): CmsContent! } type CmsContent { fileName: String! content:
# Content String markup: String parsedMarkup: String } # CMS-wide types # Backend\Models\User type BackendUser { id: ID! }
extend type Query { cmsContent(name: String!): CmsContent! } #System\Models\File type SystemFile { id: ID path: String title: String description: String }
type CmsContent { fileName: String! content: String markup: String parsedMarkup: String }
# CMS-wide types
# Backend\Models\User
type BackendUser { id: ID! }
#System\Models\File
type SystemFile { id: ID path: String title: String description: String }

View File

@ -1,32 +1,8 @@
title = "Fleet" title = "Fleet" == == # Content extend type Query { aircraft: [Aircraft] @all(model:
== "GermanAirlinesVa\\Fleet\\Models\\Aircraft") aircraftType: [AircraftType] @all(model:
== "GermanAirlinesVa\\Fleet\\Models\\AircraftType") } extend type Subscription { aircraftAdded: Aircraft
# Content @subscription(class: "GermanAirlinesVa\\Fleet\\Classes\\AircraftAdded") } extend type Mutation { addAircraft(
extend type Query { aircraft_type_id: ID!, home_airport_id: ID!, name: String!, registration: String! ): Aircraft @create(model:
aircraft: [Aircraft] @all(model: "GermanAirlinesVa\\Fleet\\Models\\Aircraft") "GermanAirlinesVa\\Fleet\\Models\\Aircraft") @broadcast(subscription: "aircraftAdded") } type Aircraft { id: ID!
aircraftType: [AircraftType] @all(model: "GermanAirlinesVa\\Fleet\\Models\\AircraftType") aircraft_type_id: ID! home_airport_id: ID! name: String! registration: String! } type AircraftType { type: String!
} aircrafts: [Aircraft] @hasMany }
extend type Subscription {
aircraftAdded: Aircraft @subscription(class: "GermanAirlinesVa\\Fleet\\Classes\\AircraftAdded")
}
extend type Mutation {
addAircraft(
aircraft_type_id: ID!,
home_airport_id: ID!,
name: String!,
registration: String!
): Aircraft
@create(model: "GermanAirlinesVa\\Fleet\\Models\\Aircraft")
@broadcast(subscription: "aircraftAdded")
}
type Aircraft {
id: ID!
aircraft_type_id: ID!
home_airport_id: ID!
name: String!
registration: String!
}
type AircraftType { type: String! aircrafts: [Aircraft] @hasMany }

View File

@ -1,33 +1,35 @@
<?php return [ <?php return [
'plugin' => [ 'plugin' => [
'name' => 'GA GraphQL', 'name' => 'GA GraphQL',
'description' => '', 'description' => '',
],
'menu' => [
'main' => 'GA GraphQL',
'keys' => 'GraphQL Keys',
'playground' => 'GraphiQL',
],
'permission' => [
'tab' => [
'schemas' => 'German Airlines VA - GraphQL',
], ],
'menu' => [ 'label' => [
'main' => 'GA GraphQL', 'schemas' => 'Access GraphiQL',
'keys' => 'GraphQL Keys',
'playground' => 'GraphiQL',
], ],
'permission' => [ ],
'tab' => [ 'settings' => [
'schemas' => 'German Airlines VA - GraphQL', 'label' => 'German Airlines VA - GraphQL',
], 'description' => 'Configure GrapQL',
'label' => [ 'general' => 'General',
'schemas' => 'Access GraphiQL', 'engine' => 'Engine',
], 'enable_cache' => [
'label' => 'Enable Schema Cache',
'comment' =>
'A large part of the Schema generation is parsing the various graph definition into an AST. These operations are pretty expensive so it is recommended to enable caching in production mode.',
], ],
'settings' => [ 'batched_queries' => [
'label' => 'German Airlines VA - GraphQL', 'label' => 'Batched Queries',
'description' => 'Configure GrapQL', 'comment' =>
'general' => 'General', 'GraphQL query batching means sending multiple queries to the server in one request. You may set this flag to process/deny batched queries.',
'engine' => 'Engine',
'enable_cache' => [
'label' => 'Enable Schema Cache',
'comment' => 'A large part of the Schema generation is parsing the various graph definition into an AST. These operations are pretty expensive so it is recommended to enable caching in production mode.',
],
'batched_queries' => [
'label' => 'Batched Queries',
'comment' => 'GraphQL query batching means sending multiple queries to the server in one request. You may set this flag to process/deny batched queries.',
],
], ],
]; ],
];

View File

@ -1,13 +1,13 @@
columns: columns:
id: id:
label: id label: id
type: number type: number
member_id: member_id:
label: member_id label: member_id
type: number type: number
valid_from: valid_from:
label: valid_from label: valid_from
type: datetime type: datetime
key: key:
label: key label: key
type: text type: text

View File

@ -1,26 +1,26 @@
plugin: plugin:
name: 'germanairlinesva.graphql::lang.plugin.name' name: 'germanairlinesva.graphql::lang.plugin.name'
description: 'germanairlinesva.graphql::lang.plugin.description' description: 'germanairlinesva.graphql::lang.plugin.description'
author: 'German Airlines VA' author: 'German Airlines VA'
icon: oc-icon-database icon: oc-icon-database
homepage: '' homepage: ''
permissions: permissions:
schemas: schemas:
tab: 'germanairlinesva.graphql::lang.permission.tab.schemas' tab: 'germanairlinesva.graphql::lang.permission.tab.schemas'
label: 'germanairlinesva.graphql::lang.permission.label.schemas' label: 'germanairlinesva.graphql::lang.permission.label.schemas'
navigation: navigation:
menu: menu:
label: 'germanairlinesva.graphql::lang.menu.main' label: 'germanairlinesva.graphql::lang.menu.main'
url: / url: /
icon: icon-database
permissions:
- schemas
sideMenu:
side-menu-item:
label: 'germanairlinesva.graphql::lang.menu.playground'
url: germanairlinesva/graphql/playground
icon: icon-database icon: icon-database
permissions: side-menu-item2:
- schemas label: 'germanairlinesva.graphql::lang.menu.keys'
sideMenu: url: germanairlinesva/graphql/graphqlkey
side-menu-item: icon: icon-key
label: 'germanairlinesva.graphql::lang.menu.playground'
url: germanairlinesva/graphql/playground
icon: icon-database
side-menu-item2:
label: 'germanairlinesva.graphql::lang.menu.keys'
url: germanairlinesva/graphql/graphqlkey
icon: icon-key