From 507c430a48f37722026c056706e25c8f0207a84b Mon Sep 17 00:00:00 2001 From: Lio Novelli Date: Wed, 5 Apr 2023 19:49:58 +0200 Subject: [PATCH 1/3] Remove todo init db import from reamde --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index 36b660d..fc6d85e 100644 --- a/README.md +++ b/README.md @@ -16,8 +16,6 @@ Nato vzpostavimo / poženemo zabojnike z ukazom `ddev start`. Namestimo odvisne PHP pakete z ukazom `ddev composer install`. -@TODO uvoz baze - Osnovne podatke pa vnesemo z ukazuma: `ddev drush site:install --account-name=root --account-pass=toor --existing-config minimal` From 8796997a3707e613e8ede7d17f2d2fd26ae04a42 Mon Sep 17 00:00:00 2001 From: Lio Novelli Date: Thu, 6 Apr 2023 10:28:26 +0200 Subject: [PATCH 2/3] Create yufu_admin module and add view jsonapi output operation to nodes. --- config/sync/core.extension.yml | 1 + config/sync/user.role.authenticated.yml | 2 ++ .../custom/yufu_admin/yufu_admin.info.yml | 5 ++++ .../custom/yufu_admin/yufu_admin.module | 30 +++++++++++++++++++ .../yufu_admin/yufu_admin.permissions.yml | 3 ++ 5 files changed, 41 insertions(+) create mode 100644 web/modules/custom/yufu_admin/yufu_admin.info.yml create mode 100644 web/modules/custom/yufu_admin/yufu_admin.module create mode 100644 web/modules/custom/yufu_admin/yufu_admin.permissions.yml diff --git a/config/sync/core.extension.yml b/config/sync/core.extension.yml index e4565d8..fae8ba6 100644 --- a/config/sync/core.extension.yml +++ b/config/sync/core.extension.yml @@ -47,6 +47,7 @@ module: update: 0 user: 0 views_ui: 0 + yufu_admin: 0 content_translation: 10 views: 10 minimal: 1000 diff --git a/config/sync/user.role.authenticated.yml b/config/sync/user.role.authenticated.yml index 92f67d6..30caa03 100644 --- a/config/sync/user.role.authenticated.yml +++ b/config/sync/user.role.authenticated.yml @@ -4,6 +4,7 @@ status: true dependencies: module: - system + - yufu_admin _core: default_config_hash: dJ0L2DNSj5q6XVZAGsuVDpJTh5UeYkIPwKrUOOpr8YI id: authenticated @@ -12,3 +13,4 @@ weight: 1 is_admin: false permissions: - 'access content' + - 'use jsonapi operation link' diff --git a/web/modules/custom/yufu_admin/yufu_admin.info.yml b/web/modules/custom/yufu_admin/yufu_admin.info.yml new file mode 100644 index 0000000..7a391cc --- /dev/null +++ b/web/modules/custom/yufu_admin/yufu_admin.info.yml @@ -0,0 +1,5 @@ +name: Yufu Admin +type: module +description: Provides admin functionality. +package: Yufu +core_version_requirement: ^9 || ^10 diff --git a/web/modules/custom/yufu_admin/yufu_admin.module b/web/modules/custom/yufu_admin/yufu_admin.module new file mode 100644 index 0000000..7dd23f6 --- /dev/null +++ b/web/modules/custom/yufu_admin/yufu_admin.module @@ -0,0 +1,30 @@ +getEntityType(); + // @todo Only for entity node - should we add other entities as well? + if ($entityType->id() === 'node' && \Drupal::currentUser()->hasPermission('use jsonapi operation link')) { + // Build the url. + $url = Url::fromRoute(sprintf('jsonapi.%s--%s.individual', $entityType->id(), $entity->bundle()), + ['entity' => $entity->uuid()] + ); + $operations['view-jsonapi-output'] = [ + 'title' => t('jsonapi Output'), + 'weight' => 50, + 'url' => $url, + ]; + } + return $operations; +} diff --git a/web/modules/custom/yufu_admin/yufu_admin.permissions.yml b/web/modules/custom/yufu_admin/yufu_admin.permissions.yml new file mode 100644 index 0000000..4e97508 --- /dev/null +++ b/web/modules/custom/yufu_admin/yufu_admin.permissions.yml @@ -0,0 +1,3 @@ +'use jsonapi operation link': + title: 'Use jsonapi operation link' + description: 'Access jsonapi operation link.' From 857208f3b50dedef687f63dd2410b8d115a98b91 Mon Sep 17 00:00:00 2001 From: Lio Novelli Date: Thu, 6 Apr 2023 10:41:59 +0200 Subject: [PATCH 3/3] Add missing dependency. --- web/modules/custom/yufu_admin/yufu_admin.info.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/web/modules/custom/yufu_admin/yufu_admin.info.yml b/web/modules/custom/yufu_admin/yufu_admin.info.yml index 7a391cc..7774559 100644 --- a/web/modules/custom/yufu_admin/yufu_admin.info.yml +++ b/web/modules/custom/yufu_admin/yufu_admin.info.yml @@ -3,3 +3,5 @@ type: module description: Provides admin functionality. package: Yufu core_version_requirement: ^9 || ^10 +dependencies: + - drupal:jsonapi