mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-25 03:45:46 -06:00
test(slack): preserve enterprise user identity scope
This commit is contained in:
@@ -5,6 +5,7 @@ import {
|
||||
normalizeAllowListLower,
|
||||
normalizeSlackSlug,
|
||||
resolveSlackAllowListMatch,
|
||||
resolveSlackUserAllowListForTeam,
|
||||
resolveSlackUserAllowed,
|
||||
} from "./allow-list.js";
|
||||
|
||||
@@ -116,4 +117,13 @@ describe("slack/allow-list", () => {
|
||||
}),
|
||||
).toEqual({ allowed: false });
|
||||
});
|
||||
|
||||
it("preserves org-wide IDs and workspace-qualified user identities", () => {
|
||||
expect(
|
||||
resolveSlackUserAllowListForTeam({
|
||||
allowList: ["W01234567", "team:T11111111:user:U01234567", "team:T22222222:user:U01234567"],
|
||||
teamId: "T11111111",
|
||||
}),
|
||||
).toEqual(["w01234567", "team:t11111111:user:u01234567"]);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -195,13 +195,13 @@ describe("resolveSlackEffectiveAllowFrom", () => {
|
||||
includePairingStore: true,
|
||||
eventScope: { teamId: "T11111111", client: {} as never },
|
||||
}),
|
||||
).resolves.toEqual(["uconfig123", "ulegacy123", "u11111111"]);
|
||||
).resolves.toEqual(["uconfig123", "ulegacy123", "team:t11111111:user:u11111111"]);
|
||||
await expect(
|
||||
resolveSlackEffectiveAllowFrom(ctx, {
|
||||
includePairingStore: true,
|
||||
eventScope: { teamId: "T22222222", client: {} as never },
|
||||
}),
|
||||
).resolves.toEqual(["uconfig123", "ulegacy123", "u22222222"]);
|
||||
).resolves.toEqual(["uconfig123", "ulegacy123", "team:t22222222:user:u22222222"]);
|
||||
await expect(
|
||||
resolveSlackEffectiveAllowFrom(ctx, { includePairingStore: true }),
|
||||
).resolves.toEqual(["uconfig123", "ulegacy123"]);
|
||||
@@ -215,7 +215,7 @@ describe("resolveSlackEffectiveAllowFrom", () => {
|
||||
resolveSlackEffectiveAllowFrom(ctx, {
|
||||
eventScope: { teamId: "T11111111", client: {} as never },
|
||||
}),
|
||||
).resolves.toEqual(["u01234567"]);
|
||||
).resolves.toEqual(["team:t11111111:user:u01234567"]);
|
||||
await expect(
|
||||
resolveSlackEffectiveAllowFrom(ctx, {
|
||||
eventScope: { teamId: "T22222222", client: {} as never },
|
||||
|
||||
@@ -223,7 +223,7 @@ describe("resolveSlackChannelConfig", () => {
|
||||
);
|
||||
});
|
||||
|
||||
it("matches per-channel users only in their selected workspace", () => {
|
||||
it("preserves org-wide and workspace-qualified per-channel user identities", () => {
|
||||
const channels = {
|
||||
"team:T11111111:channel:C01234567": {
|
||||
users: ["team:T11111111:user:U01234567", "team:T22222222:user:U12345678", "U23456789"],
|
||||
@@ -239,14 +239,14 @@ describe("resolveSlackChannelConfig", () => {
|
||||
channelId: "C01234567",
|
||||
channels,
|
||||
})?.users,
|
||||
).toEqual(["u01234567", "team:t22222222:user:u12345678", "u23456789"]);
|
||||
).toEqual(["team:t11111111:user:u01234567", "team:t22222222:user:u12345678", "u23456789"]);
|
||||
expect(
|
||||
resolveSlackChannelConfig({
|
||||
teamId: "T22222222",
|
||||
channelId: "C01234567",
|
||||
channels,
|
||||
})?.users,
|
||||
).toEqual(["team:t11111111:user:u01234567", "u12345678", "u23456789"]);
|
||||
).toEqual(["team:t11111111:user:u01234567", "team:t22222222:user:u12345678", "u23456789"]);
|
||||
});
|
||||
|
||||
it("blocks channel-name route matches by default", () => {
|
||||
|
||||
Reference in New Issue
Block a user