Skip to content

Commit

Permalink
Merge branch 'main' into dev
Browse files Browse the repository at this point in the history
* main:
  website/docs: update 2024.6 release notes with latest changes (#10174)
  core: fix error when raising SkipObject in mapping (#10153)
  website/docs: 2024.6 release notes: add note about group names (#10170)
  website/docs: update 2024.6 release notes with latest changes (#10167)
  core: bump twilio from 9.1.1 to 9.2.0 (#10162)
  web: bump chromedriver from 126.0.1 to 126.0.2 in /tests/wdio (#10161)
  web: bump the wdio group in /tests/wdio with 4 updates (#10160)
  website/integrations: jellyfin: add OIDC configuration (#9538)
  website/docs: Describe where to apply the auto setup env vars (#9863)
  website/integrations: gitlab: better service description (#9923)
  web: fix docker build for non-release versions (#10154)
  root: makefile: add codespell to make-website (#10116)
  • Loading branch information
kensternberg-authentik committed Jun 19, 2024
2 parents 7b208d9 + c7c7e28 commit 75b605f
Show file tree
Hide file tree
Showing 12 changed files with 215 additions and 101 deletions.
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ RUN npm run build-bundled
# Stage 2: Build webui
FROM --platform=${BUILDPLATFORM} docker.io/node:22 as web-builder

ARG GIT_BUILD_HASH
ENV GIT_BUILD_HASH=$GIT_BUILD_HASH
ENV NODE_ENV=production

WORKDIR /work/web
Expand Down
6 changes: 4 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,11 @@ test: ## Run the server tests and produce a coverage report (locally)
coverage html
coverage report

lint-fix: ## Lint and automatically fix errors in the python source code. Reports spelling errors.
lint-fix: lint-codespell ## Lint and automatically fix errors in the python source code. Reports spelling errors.
black $(PY_SOURCES)
ruff check --fix $(PY_SOURCES)

lint-codespell: ## Reports spelling errors.
codespell -w $(CODESPELL_ARGS)

lint: ## Lint the python and golang sources
Expand Down Expand Up @@ -239,7 +241,7 @@ website: website-lint-fix website-build ## Automatically fix formatting issues
website-install:
cd website && npm ci

website-lint-fix:
website-lint-fix: lint-codespell
cd website && npm run prettier

website-build:
Expand Down
7 changes: 5 additions & 2 deletions authentik/core/expression/evaluator.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,11 @@ def handle_error(self, exc: Exception, expression_source: str):
)
if "request" in self._context:
req: PolicyRequest = self._context["request"]
event.from_http(req.http_request, req.user)
return
if req.http_request:
event.from_http(req.http_request, req.user)
return
elif req.user:
event.set_user(req.user)
event.save()

def evaluate(self, *args, **kwargs) -> Any:
Expand Down
4 changes: 4 additions & 0 deletions authentik/core/expression/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,7 @@ class SkipObjectException(PropertyMappingExpressionException):
"""Exception which can be raised in a property mapping to skip syncing an object.
Only applies to Property mappings which sync objects, and not on mappings which transitively
apply to a single user"""

def __init__(self) -> None:
# For this class only, both of these are set by the function evaluating the property mapping
super().__init__(exc=None, mapping=None)
9 changes: 8 additions & 1 deletion authentik/lib/sync/mapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
from django.http import HttpRequest

from authentik.core.expression.evaluator import PropertyMappingEvaluator
from authentik.core.expression.exceptions import PropertyMappingExpressionException
from authentik.core.expression.exceptions import (
PropertyMappingExpressionException,
SkipObjectException,
)
from authentik.core.models import PropertyMapping, User


Expand Down Expand Up @@ -57,6 +60,10 @@ def iter_eval(
mapping.set_context(user, request, **kwargs)
try:
value = mapping.evaluate(mapping.model.expression)
except SkipObjectException as exc:
exc.exc = exc
exc.mapping = mapping
raise exc from exc
except PropertyMappingExpressionException as exc:
raise exc from exc
except Exception as exc:
Expand Down
6 changes: 3 additions & 3 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 75b605f

Please sign in to comment.