chore: Rename syncGroups policy to externalGroupSync

This commit is contained in:
Tom Moor committed 2026-10-07 19:15:45 -04:00
1 parent cdc8d17b9b
commit 8f6fcc3c2e
4 files changed
+4 -21

No files matched your search

+1 -1
View File
@@ -200,7 +200,7 @@ function Authentication() {
const showGroupSync =
provider.isActive &&
provider.groupSyncSupported &&
(!!can.syncGroups || !!provider.settings?.groupSyncEnabled);
(!!can.externalGroupSync || !!provider.settings?.groupSyncEnabled);
return (
<React.Fragment key={provider.name}>
+1 -1
View File
@@ -59,7 +59,7 @@ allow(User, "audit", Team, (actor, team) =>
)
);
allow(User, "syncGroups", Team, (actor, team) =>
allow(User, "externalGroupSync", Team, (actor, team) =>
and(
//
isTeamAdmin(actor, team),
@@ -1,10 +1,8 @@
import { vi } from "vitest";
import { Plan } from "@shared/types";
import {
AuthenticationProvider,
Group,
GroupUser,
Team,
UserAuthentication,
} from "@server/models";
import { buildUser } from "@server/test/factories";
@@ -40,10 +38,6 @@ async function setup() {
describe("SyncUserGroupsTask", () => {
const schedule = mockTaskSchedule();
beforeEach(() => {
vi.spyOn(Team.prototype, "plan", "get").mockReturnValue(Plan.Business);
});
afterEach(() => {
vi.restoreAllMocks();
});
@@ -110,17 +104,6 @@ describe("SyncUserGroupsTask", () => {
expect(fetchUserGroups).not.toHaveBeenCalled();
});
it("should not sync groups when the team is not entitled to group sync", async () => {
const { authentication, fetchUserGroups } = await setup();
vi.spyOn(Team.prototype, "plan", "get").mockReturnValue(Plan.Community);
await new SyncUserGroupsTask().perform({
userAuthenticationId: authentication.id,
});
expect(fetchUserGroups).not.toHaveBeenCalled();
});
it("should throw when the provider fails so the task is retried", async () => {
const { authentication, fetchUserGroups } = await setup();
fetchUserGroups.mockRejectedValue(new Error("provider unavailable"));
@@ -57,7 +57,7 @@ router.post(
settings?.groupSyncEnabled === true &&
!authenticationProvider.settings?.groupSyncEnabled
) {
authorize(user, "syncGroups", user.team);
authorize(user, "externalGroupSync", user.team);
const groupSyncProvider = PluginManager.getGroupSyncProvider(
authenticationProvider.name
@@ -108,7 +108,7 @@ router.post(
ctx.input.body.id
);
authorize(user, "update", authenticationProvider);
authorize(user, "syncGroups", user.team);
authorize(user, "externalGroupSync", user.team);
const groupSyncProvider = PluginManager.getGroupSyncProvider(
authenticationProvider.name