Skip to content

Commit

Permalink
Merge branch 'main' of github.com:outline/outline
Browse files Browse the repository at this point in the history
  • Loading branch information
tommoor committed Jan 24, 2022
2 parents 797e5b6 + cd33935 commit c8a67c3
Show file tree
Hide file tree
Showing 23 changed files with 133 additions and 120 deletions.
8 changes: 0 additions & 8 deletions .env.sample
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
# 👋 Welcome, we're glad you're setting up an installation of Outline. Copy this
# file to .env or set the variables in your local environment manually. For
# development with docker this should mostly work out of the box other than
# setting the Slack keys and the SECRET_KEY.




# –––––––––––––––– REQUIRED ––––––––––––––––

# Generate a hex-encoded 32-byte random key. You should use `openssl rand -hex 32`
Expand Down
8 changes: 4 additions & 4 deletions server/commands/teamCreator.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import invariant from "invariant";
import Logger from "@server/logging/logger";
import { Team, AuthenticationProvider } from "@server/models";
import { getAllowedDomains } from "@server/utils/authentication";
import { isDomainAllowed } from "@server/utils/authentication";
import { generateAvatarUrl } from "@server/utils/avatars";
import { MaximumTeamsError } from "../errors";

Expand Down Expand Up @@ -57,9 +57,9 @@ export default async function teamCreator({
const teamCount = await Team.count();

// If the self-hosted installation has a single team and the domain for the
// new team matches one in the allowed domains env variable then assign the
// authentication provider to the existing team
if (teamCount === 1 && domain && getAllowedDomains().includes(domain)) {
// new team is allowed then assign the authentication provider to the
// existing team
if (teamCount === 1 && domain && isDomainAllowed(domain)) {
const team = await Team.findOne();
invariant(team, "Team should exist");

Expand Down
5 changes: 2 additions & 3 deletions server/routes/auth/providers/google.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,13 @@ import {
GoogleWorkspaceInvalidError,
} from "@server/errors";
import passportMiddleware from "@server/middlewares/passport";
import { getAllowedDomains } from "@server/utils/authentication";
import { isDomainAllowed } from "@server/utils/authentication";
import { StateStore } from "@server/utils/passport";

const router = new Router();
const providerName = "google";
const GOOGLE_CLIENT_ID = process.env.GOOGLE_CLIENT_ID;
const GOOGLE_CLIENT_SECRET = process.env.GOOGLE_CLIENT_SECRET;
const allowedDomains = getAllowedDomains();
const scopes = [
"https://www.googleapis.com/auth/userinfo.profile",
"https://www.googleapis.com/auth/userinfo.email",
Expand Down Expand Up @@ -48,7 +47,7 @@ if (GOOGLE_CLIENT_ID) {
throw GoogleWorkspaceRequiredError();
}

if (allowedDomains.length && !allowedDomains.includes(domain)) {
if (!isDomainAllowed(domain)) {
throw GoogleWorkspaceInvalidError();
}

Expand Down
5 changes: 2 additions & 3 deletions server/routes/auth/providers/oidc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
AuthenticationError,
} from "@server/errors";
import passportMiddleware from "@server/middlewares/passport";
import { getAllowedDomains } from "@server/utils/authentication";
import { isDomainAllowed } from "@server/utils/authentication";
import { StateStore, request } from "@server/utils/passport";

const router = new Router();
Expand All @@ -23,7 +23,6 @@ const OIDC_USERINFO_URI = process.env.OIDC_USERINFO_URI || "";
const OIDC_SCOPES = process.env.OIDC_SCOPES || "";
const OIDC_USERNAME_CLAIM =
process.env.OIDC_USERNAME_CLAIM || "preferred_username";
const allowedDomains = getAllowedDomains();

export const config = {
name: OIDC_DISPLAY_NAME,
Expand Down Expand Up @@ -84,7 +83,7 @@ if (OIDC_CLIENT_ID) {
throw OIDCMalformedUserInfoError();
}

if (allowedDomains.length && !allowedDomains.includes(domain)) {
if (!isDomainAllowed(domain)) {
throw AuthenticationError(
`Domain ${domain} is not on the whitelist`
);
Expand Down
5 changes: 5 additions & 0 deletions server/utils/authentication.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ export function getAllowedDomains(): string[] {
return env ? env.split(",") : [];
}

export function isDomainAllowed(domain: string): boolean {
const allowedDomains = getAllowedDomains();
return allowedDomains.includes(domain) || allowedDomains.length === 0;
}

export async function signIn(
ctx: Context,
user: User,
Expand Down
1 change: 1 addition & 0 deletions shared/i18n/locales/da_DK/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"Dark": "Dark",
"Light": "Light",
"System": "System",
"Appearance": "Appearance",
"Change theme": "Change theme",
"Change theme to": "Change theme to",
"Invite people": "Invite people",
Expand Down
1 change: 1 addition & 0 deletions shared/i18n/locales/de_DE/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"Dark": "Dunkel",
"Light": "Hell",
"System": "System",
"Appearance": "Appearance",
"Change theme": "Theme ändern",
"Change theme to": "Theme ändern zu",
"Invite people": "Personen einladen",
Expand Down
25 changes: 13 additions & 12 deletions shared/i18n/locales/es_ES/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
"Duplicate document": "Duplicar documento",
"Document duplicated": "Documento duplicado",
"Pin to collection": "Fijar a colección",
"Pinned to collection": "Pinned to collection",
"Pin to home": "Pin to home",
"Pinned to team home": "Pinned to team home",
"Pinned to collection": "Fijado a la colección",
"Pin to home": "Fijar a inicio",
"Pinned to team home": "Fijado a inicio de equipo",
"Print": "Imprimir",
"Print document": "Imprimir documento",
"Import document": "Importar documento",
Expand All @@ -40,6 +40,7 @@
"Dark": "Oscuro",
"Light": "Claro",
"System": "Sistema",
"Appearance": "Appearance",
"Change theme": "Cambiar tema",
"Change theme to": "Cambiar tema a",
"Invite people": "Invitar personas",
Expand Down Expand Up @@ -179,7 +180,7 @@
"Delete table": "Eliminar tabla",
"Delete image": "Eliminar imagen",
"Download image": "Descargar imagen",
"Replace image": "Replace image",
"Replace image": "Sustituir imagen",
"Float left": "Flotar a la izquierda",
"Float right": "Flotar a la derecha",
"Center large": "Centrar grande",
Expand Down Expand Up @@ -244,7 +245,7 @@
"Move": "Mover",
"Enable embeds": "Habilitar embeds",
"Disable embeds": "Desactivar embeds",
"Full width": "Full width",
"Full width": "Anchura completa",
"Move {{ documentName }}": "Mover {{ documentName }}",
"Permanently delete {{ documentName }}": "Eliminar permanentemente {{ documentName }}",
"Export options": "Opciones de exportación",
Expand Down Expand Up @@ -379,7 +380,7 @@
"Publish": "Publicar",
"Publishing": "Publicando",
"Sorry, it looks like you don’t have permission to access the document": "Lo sentimos, parece que no tienes permiso para acceder al documento",
"Observing {{ userName }}": "Observing {{ userName }}",
"Observing {{ userName }}": "Observando {{ userName }}",
"Nested documents": "Documentos anidados",
"Referenced by": "Referenciada por",
"Anyone with the link <1></1>can view this document": "Cualquiera con el enlace <1></1> puede ver este documento",
Expand Down Expand Up @@ -500,8 +501,8 @@
"Past week": "Última semana",
"Past month": "Último mes",
"Past year": "Último año",
"Recent searches": "Recent searches",
"Remove search": "Remove search",
"Recent searches": "Búsquedas recientes",
"Remove search": "Eliminar búsqueda",
"Active documents": "Documentos activos",
"Documents in collections you are able to access": "Documentos en colecciones a las que puedes acceder",
"All documents": "Todos los documentos",
Expand All @@ -510,7 +511,7 @@
"Author": "Autor",
"Not Found": "No encontrado",
"We were unable to find the page you’re looking for.": "No pudimos encontrar la página que buscabas.",
"No documents found for your search filters.": "No documents found for your search filters.",
"No documents found for your search filters.": "No se encontraron documentos para sus filtros de búsqueda.",
"Processing": "Procesando",
"Expired": "Expirado",
"Error": "Error",
Expand All @@ -523,10 +524,10 @@
"Last accessed": "Ultimo acceso",
"Add to Slack": "Añadir a Slack",
"Settings saved": "Configuración guardada",
"document published": "document published",
"document updated": "document updated",
"document published": "documento publicado",
"document updated": "documento actualizado",
"Posting to the <em>{{ channelName }}</em> channel on": "Posting to the <em>{{ channelName }}</em> channel on",
"These events should be posted to Slack": "These events should be posted to Slack",
"These events should be posted to Slack": "Estos eventos deben publicarse en Slack",
"Document published": "Documento publicado",
"Document updated": "Documento actualizado",
"Disconnect": "Desconectar",
Expand Down
1 change: 1 addition & 0 deletions shared/i18n/locales/fa_IR/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"Dark": "تیره",
"Light": "روشن",
"System": "سامانه",
"Appearance": "Appearance",
"Change theme": "تغییر پوسته",
"Change theme to": "تغییر پوسته به",
"Invite people": "دعوت از افراد",
Expand Down
19 changes: 10 additions & 9 deletions shared/i18n/locales/fr_FR/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
"Duplicate document": "Dupliquer le document",
"Document duplicated": "Document dupliqué",
"Pin to collection": "Épingler à la collection",
"Pinned to collection": "Pinned to collection",
"Pin to home": "Pin to home",
"Pinned to collection": "Épinglé à la collection",
"Pin to home": "Épingler sur la page d'accueil",
"Pinned to team home": "Pinned to team home",
"Print": "Imprimer",
"Print document": "Imprimer le document",
Expand All @@ -40,6 +40,7 @@
"Dark": "Foncé",
"Light": "Clair",
"System": "Système",
"Appearance": "Appearance",
"Change theme": "Changer le thème",
"Change theme to": "Changer le thème pour",
"Invite people": "Inviter des personnes",
Expand Down Expand Up @@ -179,7 +180,7 @@
"Delete table": "Supprimer ce tableau",
"Delete image": "Supprimer l'image",
"Download image": "Télécharger l’image",
"Replace image": "Replace image",
"Replace image": "Remplacer l'image",
"Float left": "Aligner à gauche",
"Float right": "Aligner à droite",
"Center large": "Centrer en grand",
Expand Down Expand Up @@ -244,7 +245,7 @@
"Move": "Déplacer",
"Enable embeds": "Activer les intégrations",
"Disable embeds": "Désactiver les intégrations",
"Full width": "Full width",
"Full width": "Largeur totale",
"Move {{ documentName }}": "Déplacer {{ documentName }}",
"Permanently delete {{ documentName }}": "Supprimer définitivement {{ documentName }}",
"Export options": "Options d'exportation",
Expand Down Expand Up @@ -500,8 +501,8 @@
"Past week": "La semaine dernière",
"Past month": "Le mois dernier",
"Past year": "L'année dernière",
"Recent searches": "Recent searches",
"Remove search": "Remove search",
"Recent searches": "Recherches récentes",
"Remove search": "Supprimer la recherche",
"Active documents": "Documents actifs",
"Documents in collections you are able to access": "Documents dans les collections auxquelles vous pouvez accéder",
"All documents": "Tous les documents",
Expand All @@ -510,7 +511,7 @@
"Author": "Auteur",
"Not Found": "Non trouvé",
"We were unable to find the page you’re looking for.": "Nous n'avons pas pu trouver la page que vous recherchez.",
"No documents found for your search filters.": "No documents found for your search filters.",
"No documents found for your search filters.": "Aucun document trouvé pour vos critères de recherche.",
"Processing": "Traitement en cours",
"Expired": "Expiré",
"Error": "Erreur",
Expand All @@ -523,8 +524,8 @@
"Last accessed": "Dernier accès",
"Add to Slack": "Ajouter à Slack",
"Settings saved": "Paramètres enregistrés",
"document published": "document published",
"document updated": "document updated",
"document published": "document publié",
"document updated": "document mis à jour",
"Posting to the <em>{{ channelName }}</em> channel on": "Posting to the <em>{{ channelName }}</em> channel on",
"These events should be posted to Slack": "These events should be posted to Slack",
"Document published": "Document publié",
Expand Down
1 change: 1 addition & 0 deletions shared/i18n/locales/it_IT/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"Dark": "Scuro",
"Light": "Chiaro",
"System": "Sistema",
"Appearance": "Appearance",
"Change theme": "Change theme",
"Change theme to": "Change theme to",
"Invite people": "Invita persone",
Expand Down
13 changes: 7 additions & 6 deletions shared/i18n/locales/ja_JP/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
"Duplicate document": "ドキュメントを複製",
"Document duplicated": "ドキュメントの重複",
"Pin to collection": "コレクションに追加",
"Pinned to collection": "Pinned to collection",
"Pin to home": "Pin to home",
"Pinned to team home": "Pinned to team home",
"Pinned to collection": "コレクションに追加",
"Pin to home": "ホームに固定",
"Pinned to team home": "チームホームに固定",
"Print": "プリント",
"Print document": "ドキュメントを印刷する",
"Import document": "ドキュメントのインポート",
Expand All @@ -40,6 +40,7 @@
"Dark": "ダークモード",
"Light": "ライトモード",
"System": "システム",
"Appearance": "Appearance",
"Change theme": "テーマを変更する",
"Change theme to": "Change theme to",
"Invite people": "他の人を招待",
Expand Down Expand Up @@ -492,7 +493,7 @@
"You signed in with {{ authProviderName }} last time.": "You signed in with {{ authProviderName }} last time.",
"Already have an account? Go to <1>login</1>.": "Already have an account? Go to <1>login</1>.",
"Sign In": "ログイン",
"Continue with Email": "Continue with Email",
"Continue with Email": "Eメールで続行",
"Continue with {{ authProviderName }}": "Continue with {{ authProviderName }}",
"Any collection": "コレクション",
"Any time": "いつでも",
Expand All @@ -511,7 +512,7 @@
"Not Found": "見つかりません",
"We were unable to find the page you’re looking for.": "お探しのページが見つかりませんでした。",
"No documents found for your search filters.": "No documents found for your search filters.",
"Processing": "Processing",
"Processing": "処理中",
"Expired": "期限切れ",
"Error": "エラー",
"All collections": "全てのコレクション",
Expand All @@ -528,7 +529,7 @@
"Posting to the <em>{{ channelName }}</em> channel on": "Posting to the <em>{{ channelName }}</em> channel on",
"These events should be posted to Slack": "These events should be posted to Slack",
"Document published": "Document published",
"Document updated": "Document updated",
"Document updated": "文書が更新されました",
"Disconnect": "接続を解除",
"Active": "アクティブ",
"Everyone": "すべてのユーザー",
Expand Down
Loading

0 comments on commit c8a67c3

Please sign in to comment.