Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

providers/sync: update attributes on update #10012

Merged
merged 2 commits into from
Jun 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,14 @@
google_group = self.to_schema(group, connection)
self.check_email_valid(google_group["email"])
try:
return self._request(
response = self._request(

Check warning on line 95 in authentik/enterprise/providers/google_workspace/clients/groups.py

View check run for this annotation

Codecov / codecov/patch

authentik/enterprise/providers/google_workspace/clients/groups.py#L95

Added line #L95 was not covered by tests
self.directory_service.groups().update(
groupKey=connection.google_id,
body=google_group,
)
)
connection.attributes = response
connection.save()

Check warning on line 102 in authentik/enterprise/providers/google_workspace/clients/groups.py

View check run for this annotation

Codecov / codecov/patch

authentik/enterprise/providers/google_workspace/clients/groups.py#L101-L102

Added lines #L101 - L102 were not covered by tests
except NotFoundSyncException:
# Resource missing is handled by self.write, which will re-create the group
raise
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,11 @@
self.check_email_valid(
google_user["primaryEmail"], *[x["address"] for x in google_user.get("emails", [])]
)
self._request(
response = self._request(

Check warning on line 91 in authentik/enterprise/providers/google_workspace/clients/users.py

View check run for this annotation

Codecov / codecov/patch

authentik/enterprise/providers/google_workspace/clients/users.py#L91

Added line #L91 was not covered by tests
self.directory_service.users().update(userKey=connection.google_id, body=google_user)
)
connection.attributes = response
connection.save()

Check warning on line 95 in authentik/enterprise/providers/google_workspace/clients/users.py

View check run for this annotation

Codecov / codecov/patch

authentik/enterprise/providers/google_workspace/clients/users.py#L94-L95

Added lines #L94 - L95 were not covered by tests

def discover(self):
"""Iterate through all users and connect them with authentik users if possible"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,11 @@
microsoft_group = self.to_schema(group, connection)
microsoft_group.id = connection.microsoft_id
try:
return self._request(
response = self._request(

Check warning on line 107 in authentik/enterprise/providers/microsoft_entra/clients/groups.py

View check run for this annotation

Codecov / codecov/patch

authentik/enterprise/providers/microsoft_entra/clients/groups.py#L107

Added line #L107 was not covered by tests
self.client.groups.by_group_id(connection.microsoft_id).patch(microsoft_group)
)
connection.attributes = self.entity_as_dict(response)
connection.save()

Check warning on line 111 in authentik/enterprise/providers/microsoft_entra/clients/groups.py

View check run for this annotation

Codecov / codecov/patch

authentik/enterprise/providers/microsoft_entra/clients/groups.py#L110-L111

Added lines #L110 - L111 were not covered by tests
except NotFoundSyncException:
# Resource missing is handled by self.write, which will re-create the group
raise
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,11 @@
"""Update existing user"""
microsoft_user = self.to_schema(user, connection)
self.check_email_valid(microsoft_user.user_principal_name)
self._request(self.client.users.by_user_id(connection.microsoft_id).patch(microsoft_user))
response = self._request(

Check warning on line 113 in authentik/enterprise/providers/microsoft_entra/clients/users.py

View check run for this annotation

Codecov / codecov/patch

authentik/enterprise/providers/microsoft_entra/clients/users.py#L113

Added line #L113 was not covered by tests
self.client.users.by_user_id(connection.microsoft_id).patch(microsoft_user)
)
connection.attributes = self.entity_as_dict(response)
connection.save()

Check warning on line 117 in authentik/enterprise/providers/microsoft_entra/clients/users.py

View check run for this annotation

Codecov / codecov/patch

authentik/enterprise/providers/microsoft_entra/clients/users.py#L116-L117

Added lines #L116 - L117 were not covered by tests

def discover(self):
"""Iterate through all users and connect them with authentik users if possible"""
Expand Down
7 changes: 4 additions & 3 deletions web/src/flow/FlowInspector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import PFProgressStepper from "@patternfly/patternfly/components/ProgressStepper
import PFStack from "@patternfly/patternfly/layouts/Stack/stack.css";
import PFBase from "@patternfly/patternfly/patternfly-base.css";

import { FlowInspection, FlowsApi, Stage } from "@goauthentik/api";
import { FlowInspection, FlowsApi, ResponseError, Stage } from "@goauthentik/api";

@customElement("ak-flow-inspector")
export class FlowInspector extends AKElement {
Expand All @@ -25,7 +25,7 @@ export class FlowInspector extends AKElement {
state?: FlowInspection;

@property({ attribute: false })
error?: Response;
error?: ResponseError;

static get styles(): CSSResult[] {
return [
Expand Down Expand Up @@ -70,6 +70,7 @@ export class FlowInspector extends AKElement {
flowSlug: this.flowSlug,
})
.then((state) => {
this.error = undefined;
this.state = state;
})
.catch((exc) => {
Expand Down Expand Up @@ -100,7 +101,7 @@ export class FlowInspector extends AKElement {
<div class="pf-l-stack pf-m-gutter">
<div class="pf-l-stack__item">
<div class="pf-c-card">
<div class="pf-c-card__body">${this.error?.statusText}</div>
<div class="pf-c-card__body">${this.error?.message}</div>
</div>
</div>
</div>
Expand Down
Loading