feat: Enforce single team when self-hosted (#1954)
* fix: Enforce single team when self hosting * test: positive case * refactor * fix: Visible error message on login screen for max teams scenario * Update Notices.js * lint
This commit is contained in:
@ -34,6 +34,52 @@ describe("teamCreator", () => {
|
||||
expect(isNewTeam).toEqual(true);
|
||||
});
|
||||
|
||||
it("should now allow creating multiple teams in installation", async () => {
|
||||
await buildTeam();
|
||||
let error;
|
||||
|
||||
try {
|
||||
await teamCreator({
|
||||
name: "Test team",
|
||||
subdomain: "example",
|
||||
avatarUrl: "http://example.com/logo.png",
|
||||
authenticationProvider: {
|
||||
name: "google",
|
||||
providerId: "example.com",
|
||||
},
|
||||
});
|
||||
} catch (err) {
|
||||
error = err;
|
||||
}
|
||||
|
||||
expect(error).toBeTruthy();
|
||||
});
|
||||
|
||||
it("should return existing team when within allowed domains", async () => {
|
||||
const existing = await buildTeam();
|
||||
|
||||
const result = await teamCreator({
|
||||
name: "Updated name",
|
||||
subdomain: "example",
|
||||
domain: "allowed-domain.com",
|
||||
authenticationProvider: {
|
||||
name: "google",
|
||||
providerId: "allowed-domain.com",
|
||||
},
|
||||
});
|
||||
|
||||
const { team, authenticationProvider, isNewTeam } = result;
|
||||
|
||||
expect(team.id).toEqual(existing.id);
|
||||
expect(team.name).toEqual(existing.name);
|
||||
expect(authenticationProvider.name).toEqual("google");
|
||||
expect(authenticationProvider.providerId).toEqual("allowed-domain.com");
|
||||
expect(isNewTeam).toEqual(false);
|
||||
|
||||
const providers = await team.getAuthenticationProviders();
|
||||
expect(providers.length).toEqual(2);
|
||||
});
|
||||
|
||||
it("should return exising team", async () => {
|
||||
const authenticationProvider = {
|
||||
name: "google",
|
||||
|
Reference in New Issue
Block a user