fix: Allow admins to bypass allowed domains (#10290)

This commit is contained in:
Tom Moor authored and GitHub committed 2025-10-02 22:14:59 -04:00
1 parent 9b95a58822
commit bb475f3e4e
2 files changed
+8 -6

No files matched your search

+6 -3
View File
@@ -7,6 +7,7 @@ import { User, Team } from "@server/models";
import { UserFlag } from "@server/models/User";
import { APIContext } from "@server/types";
import { DomainNotAllowedError } from "@server/errors";
import { can } from "@server/policies";
export type Invite = {
name: string;
@@ -43,9 +44,11 @@ export default async function userInviter(
// filter out any existing users in the system
const emails = normalizedInvites.map((invite) => invite.email);
for (const email of emails) {
if (!(await team.isDomainAllowed(email))) {
throw DomainNotAllowedError();
if (!can(user, "update", team)) {
for (const email of emails) {
if (!(await team.isDomainAllowed(email))) {
throw DomainNotAllowedError();
}
}
}
+2 -3
View File
@@ -210,8 +210,6 @@
"Move document": "Move document",
"Moving": "Moving",
"Moving the document <em>{{ title }}</em> to the {{ newCollectionName }} collection will change permission for all workspace members from <em>{{ prevPermission }}</em> to <em>{{ newPermission }}</em>.": "Moving the document <em>{{ title }}</em> to the {{ newCollectionName }} collection will change permission for all workspace members from <em>{{ prevPermission }}</em> to <em>{{ newPermission }}</em>.",
"More options": "More options",
"Submenu": "Submenu",
"Collections could not be loaded, please reload the app": "Collections could not be loaded, please reload the app",
"Start view": "Start view",
"Install now": "Install now",
@@ -484,6 +482,7 @@
"Keep as link": "Keep as link",
"Mention": "Mention",
"Embed": "Embed",
"More options": "More options",
"Rename": "Rename",
"Insert after": "Insert after",
"Insert before": "Insert before",
@@ -1282,4 +1281,4 @@
"Caption": "Caption",
"Open": "Open",
"Error loading data": "Error loading data"
}
}