Skip to content

Commit

Permalink
Merge branch 'master' into prevent-self-actions
Browse files Browse the repository at this point in the history
  • Loading branch information
Samk13 authored Sep 13, 2024
2 parents 1c0db76 + 1943393 commit 37d80fb
Show file tree
Hide file tree
Showing 16 changed files with 806 additions and 99 deletions.
64 changes: 9 additions & 55 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# This file is part of Invenio.
# Copyright (C) 2020 CERN.
# Copyright (C) 2022 Graz University of Technology.
# Copyright (C) 2024 KTH Royal Institute of Technology.
#
# Invenio is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
Expand All @@ -11,9 +12,11 @@ name: CI

on:
push:
branches: master
branches:
- master
pull_request:
branches: master
branches:
- master
schedule:
# * is a special character in YAML so you have to quote this string
- cron: "0 3 * * 6"
Expand All @@ -25,56 +28,7 @@ on:
default: "Manual trigger"

jobs:
Tests:
runs-on: ubuntu-20.04
strategy:
matrix:
# You can add/remove combinations e.g. `dev` requirements or `postgresql13` by adding
# a new item to the following lists.
# You can see the complete list of services and versions that are available at:
# https://docker-services-cli.readthedocs.io/en/latest/configuration.html
python-version: [3.8, 3.9]
requirements-level: [pypi]
cache-service: [redis]
db-service: [postgresql14]
mq-service: [rabbitmq]
search-service: [opensearch2]

env:
CACHE: ${{ matrix.cache-service }}
DB: ${{ matrix.db-service }}
MQ: ${{ matrix.mq-service }}
SEARCH: ${{ matrix.search-service }}
EXTRAS: tests,${{matrix.search-service}}

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Generate dependencies
run: |
pip install wheel requirements-builder
requirements-builder -e "$EXTRAS" --level=${{ matrix.requirements-level }} setup.py > .${{ matrix.requirements-level }}-${{ matrix.python-version }}-requirements.txt
- name: Cache pip
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('.${{ matrix.requirements-level }}-${{ matrix.python-version }}-requirements.txt') }}

- name: Install dependencies
run: |
pip install -r .${{matrix.requirements-level}}-${{ matrix.python-version }}-requirements.txt
pip install ".[$EXTRAS]"
pip freeze
docker --version
docker-compose --version
- name: Run tests
run: |
./run-tests.sh
Python:
uses: inveniosoftware/workflows/.github/workflows/tests-python.yml@master
with:
extras: "tests"
17 changes: 17 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,23 @@
Changes
=======

Version 6.0.0 (released 2024-08-22)

- mappings: add analyzers and filters to improve results when searching users

Version 5.4.0 (released 2024-08-09)

- resources: use and adjust vnd.inveniordm.v1+json http accept header

Version 5.3.1 (released 2024-07-30)

- config: Update records_html link
- moderation: fix admin record / draft links

Version 5.3.0 (released 2024-06-04)

- installation: bump invenio-records-resources

Version 5.2.0 (released 2024-05-07)

- groups: add permissions and config to control groups feature flag
Expand Down
3 changes: 2 additions & 1 deletion invenio_users_resources/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@
#
# Copyright (C) 2022-2024 CERN.
# Copyright (C) 2022-2023 TU Wien.
# Copyright (C) 2024 Graz University of Technology.
#
# Invenio-Users-Resources is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see LICENSE file for more
# details.

"""Invenio module providing management APIs for users and roles/groups."""

__version__ = "5.2.0"
__version__ = "6.0.0"

__all__ = ("__version__",)
2 changes: 1 addition & 1 deletion invenio_users_resources/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
),
"username": dict(
title=_("Username"),
fields=["username", "-created"],
fields=["username.keyword", "-created"],
),
"email": dict(
title=_("Email"),
Expand Down
2 changes: 1 addition & 1 deletion invenio_users_resources/records/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ class UserAggregate(BaseAggregate):
)
"""Search dumper with configured extensions."""

index = IndexField("users-user-v2.0.0", search_alias="users")
index = IndexField("users-user-v3.0.0", search_alias="users")
"""The search engine index to use."""

id = ModelField("id", dump_type=int)
Expand Down
225 changes: 225 additions & 0 deletions invenio_users_resources/records/mappings/os-v1/users/user-v3.0.0.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,225 @@
{
"settings": {
"analysis": {
"char_filter": {
"strip_special_chars": {
"type": "pattern_replace",
"pattern": "[\\p{Punct}\\p{S}]",
"replacement": ""
}
},
"analyzer": {
"edge_analyzer": {
"tokenizer": "uax_url_email",
"type": "custom",
"filter": [
"lowercase",
"edgegrams"
]
},
"accent_edge_analyzer": {
"tokenizer": "uax_url_email",
"type": "custom",
"filter": [
"lowercase",
"asciifolding",
"edgegrams"
]
},
"accent_analyzer": {
"tokenizer": "standard",
"type": "custom",
"char_filter": ["strip_special_chars"],
"filter": [
"lowercase",
"asciifolding"
]
}
},
"filter": {
"lowercase": {
"type": "lowercase",
"preserve_original": true
},
"asciifolding": {
"type": "asciifolding",
"preserve_original": true
},
"edgegrams": {
"type": "edge_ngram",
"min_gram": 2,
"max_gram": 20
}
}
}
},
"mappings": {
"dynamic": "strict",
"dynamic_templates": [
{
"profile": {
"path_match": "profile.*",
"mapping": {
"type": "keyword"
}
}
},
{
"preferences": {
"path_match": "preferences.*",
"mapping": {
"type": "keyword"
}
}
},
{
"identities": {
"path_match": "identities.*",
"mapping": {
"type": "keyword"
}
}
}
],
"properties": {
"$schema": {
"type": "keyword",
"index": "false"
},
"id": {
"type": "keyword"
},
"version_id": {
"type": "integer"
},
"uuid": {
"type": "keyword"
},
"created": {
"type": "date"
},
"updated": {
"type": "date"
},
"current_login_at": {
"type": "date"
},
"active": {
"type": "boolean"
},
"confirmed_at": {
"type": "date"
},
"indexed_at": {
"type": "date"
},
"confirmed": {
"type": "boolean"
},
"blocked_at": {
"type": "date"
},
"blocked": {
"type": "boolean"
},
"verified_at": {
"type": "date"
},
"verified": {
"type": "boolean"
},
"username": {
"type": "text",
"analyzer": "accent_edge_analyzer",
"search_analyzer": "accent_analyzer",
"fields": {
"keyword": {
"type": "keyword"
}
}
},
"email": {
"type": "text",
"analyzer": "edge_analyzer",
"search_analyzer": "standard",
"fields": {
"keyword": {
"type": "keyword"
}
}
},
"email_hidden": {
"type": "keyword"
},
"domain": {
"type": "keyword"
},
"domaininfo": {
"properties": {
"status": {
"type": "integer"
},
"flagged": {
"type": "boolean"
},
"category": {
"type": "integer"
},
"tld": {
"type": "keyword"
}
}
},
"identities": {
"type": "object",
"properties": {},
"dynamic": "true"
},
"profile": {
"properties": {
"full_name": {
"type": "text",
"analyzer": "accent_edge_analyzer",
"search_analyzer": "accent_analyzer"
},
"affiliations": {
"type": "text",
"analyzer": "accent_edge_analyzer",
"search_analyzer": "accent_analyzer"
}
},
"dynamic": "true"
},
"preferences": {
"properties": {
"visibility": {
"type": "keyword"
},
"email_visibility": {
"type": "keyword"
},
"locale": {
"type": "keyword"
},
"timezone": {
"type": "keyword"
},
"notifications": {
"properties": {
"enabled": {
"type": "boolean"
}
}
}
},
"dynamic": "true"
},
"status": {
"type": "keyword"
},
"visibility": {
"type": "keyword"
}
}
}
}
Loading

0 comments on commit 37d80fb

Please sign in to comment.