Skip to content

Commit

Permalink
chore: update changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
smotornyuk committed Nov 26, 2023
1 parent 2d3cfe7 commit 77645c6
Show file tree
Hide file tree
Showing 3 changed files with 150 additions and 2 deletions.
12 changes: 10 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,21 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
<!-- insertion marker -->
## Unreleased

<small>[Compare with latest](https://github.com/DataShades/ckanext-drupal-idp/compare/v0.4.6a0...HEAD)</small>
<small>[Compare with latest](https://github.com/DataShades/ckanext-drupal-idp/compare/v0.4.6a1...HEAD)</small>

### Features

- kick_user option; config declarations ([2d3cfe7](https://github.com/DataShades/ckanext-drupal-idp/commit/2d3cfe72b83d2644aef5f751118c2960c81a1f6e) by Sergey Motornyuk).

<!-- insertion marker -->
## [v0.4.6a1](https://github.com/DataShades/ckanext-drupal-idp/releases/tag/v0.4.6a1) - 2023-11-22

<small>[Compare with v0.4.6a0](https://github.com/DataShades/ckanext-drupal-idp/compare/v0.4.6a0...v0.4.6a1)</small>

### Bug Fixes

- synchronize fails when plugin extras is missing from user object ([fc87940](https://github.com/DataShades/ckanext-drupal-idp/commit/fc879400a00a71ed498100768112680840404f3d) by Sergey Motornyuk).

<!-- insertion marker -->
## [v0.4.6a0](https://github.com/DataShades/ckanext-drupal-idp/releases/tag/v0.4.6a0) - 2023-11-15

<small>[Compare with v0.4.5](https://github.com/DataShades/ckanext-drupal-idp/compare/v0.4.5...v0.4.6a0)</small>
Expand Down
76 changes: 76 additions & 0 deletions ckanext/drupal_idp/config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
from __future__ import annotations

import ckan.plugins.toolkit as tk

CONFIG_ADMIN_ROLE_NAME = "ckanext.drupal_idp.admin_role.name"
CONFIG_DB_URL = "ckanext.drupal_idp.db_url"
CONFIG_DRUPAL_VERSION = "ckanext.drupal_idp.drupal.version"
CONFIG_EXTRA_FIELDS = "ckanext.drupal_idp.extra_fields"
CONFIG_FOCE_SYNC = "ckanext.drupal_idp.synchronization.force"

CONFIG_INHERIT_ADMIN_ROLE = "ckanext.drupal_idp.admin_role.inherit"
CONFIG_KICK_MISSING_SESSION = "ckanext.drupal_idp.kick_missing_session"
CONFIG_PUBLIC_PATH = "ckanext.drupal_idp.public_path"
CONFIG_SAME_ID = "ckanext.drupal_idp.same_id"
CONFIG_SKIP_STATIC = "ckanext.drupal_idp.skip_static"

CONFIG_STATIC_HOST = "ckanext.drupal_idp.host"
CONFIG_SYNCHRONIZATION_ENABLED = "ckanext.drupal_idp.synchronization.enabled"

DEFAULT_ADMIN_ROLE = "administrator"
DEFAULT_DRUPAL_VERSION = "9"
DEFAULT_EXTRA_FIELDS = []
DEFAULT_FORCE_SYNC = False
DEFAULT_KICK_MISSING_SESSION = False
DEFAULT_PUBLIC_PATH = "/sites/default/files/"
DEFAULT_SKIP_STATIC = False


def kick_missing_session() -> bool:
return tk.asbool(
tk.config.get(CONFIG_KICK_MISSING_SESSION, DEFAULT_KICK_MISSING_SESSION)
)


def skip_static() -> bool:
return tk.asbool(tk.config.get(CONFIG_SKIP_STATIC, DEFAULT_SKIP_STATIC))


def force_sync() -> bool:
return tk.asbool(tk.config.get(CONFIG_FOCE_SYNC, DEFAULT_FORCE_SYNC))


def public_path() -> str:
return tk.config.get(CONFIG_PUBLIC_PATH, DEFAULT_PUBLIC_PATH)


def drupal_version() -> str:
return tk.config.get(CONFIG_DRUPAL_VERSION, DEFAULT_DRUPAL_VERSION)


def extra_fields() -> list[str]:
return tk.aslist(tk.config.get(CONFIG_EXTRA_FIELDS, DEFAULT_EXTRA_FIELDS))


def same_id() -> bool:
return tk.asbool(tk.config.get(CONFIG_SAME_ID))


def synchronization_enabled() -> bool:
return tk.asbool(tk.config.get(CONFIG_SYNCHRONIZATION_ENABLED))


def static_host() -> str | None:
return tk.config.get(CONFIG_STATIC_HOST)


def inherit_admin_role() -> bool:
return tk.asbool(tk.config.get(CONFIG_INHERIT_ADMIN_ROLE))


def admin_role_name() -> str:
return tk.config.get(CONFIG_ADMIN_ROLE_NAME, DEFAULT_ADMIN_ROLE)


def db_url() -> str:
return tk.config.get(CONFIG_DB_URL)
64 changes: 64 additions & 0 deletions ckanext/drupal_idp/config_declaration.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
version: 1
groups:
- annotation: ckanext-drupal-idp
options:
- key: ckanext.drupal_idp.admin_role.inherit
type: bool
description: |
Grant CKAN sysadmin role to Drupal user with
`ckanext.drupal_idp.admin_role.name` role
- key: ckanext.drupal_idp.admin_role.name
default: administrator
description: |
Name of Drupal role that grants syadmin permissions.
- key: ckanext.drupal_idp.db_url
required: true
description: |
Connetions string for Drupal's DB
- key: ckanext.drupal_idp.drupal.version
default: "9"
description: |
Version of Drupal used by application.
- key: ckanext.drupal_idp.extra_fields
type: list
description: |
Additional user's fields from Drupal that must be stored on CKAN side
- key: ckanext.drupal_idp.host
description: |
Drupal's host. Use this option if CKAN and Drupal application are
serverd on different URLs
- key: ckanext.drupal_idp.kick_missing_session
type: bool
description: |
Sign out CKAN user if there are no active sessions for him on Drupal side
- key: ckanext.drupal_idp.public_path
default: "/sites/default/files/"
description: |
Public path of Drupal's static files.
- key: ckanext.drupal_idp.same_id
type: bool
description: |
Grant CKAN user the same ID as one used by Drupal.
- key: ckanext.drupal_idp.skip_static
type: bool
description: |
Skip authentication during serving static files.
- key: ckanext.drupal_idp.synchronization.force
type: bool
description: |
Enforce user details synchronization during each request.
- key: ckanext.drupal_idp.synchronization.enabled
type: bool
description: |
Allow user details synchronization

0 comments on commit 77645c6

Please sign in to comment.