Eine aufbereitete Darstellung der Quelle

 
     
 
 
Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 

Benutzer

Quelle  group-policy.ts

  Sprache: JAVA
 

import { normalizeOptionalLowercaseString } from "openclaw/plugin-sdk/text-runtime";
import type { ZalouserGroupConfig } from "./types.js";

type ZalouserGroups = Record<string, ZalouserGroupConfig>;

function toGroupCandidate(value?: string | null): string {
  return value?.trim() ?? "";
}

export function normalizeZalouserGroupSlug(raw?: string | null): string {
  const trimmed = normalizeOptionalLowercaseString(raw) ?? "";
  if (!trimmed) {
    return "";
  }
  return trimmed
    .replace(/^#/, "")
    .replace(/[^a-z0-9]+/g, "-")
    .replace(/^-+|-+$/g, "");
}

export function buildZalouserGroupCandidates(params: {
  groupId?: string | null;
  groupChannel?: string | null;
  groupName?: string | null;
  includeGroupIdAlias?: boolean;
  includeWildcard?: boolean;
  allowNameMatching?: boolean;
}): string[] {
  const seen = new Set<string>();
  const out: string[] = [];
  const push = (value?: string | null) => {
    const normalized = toGroupCandidate(value);
    if (!normalized || seen.has(normalized)) {
      return;
    }
    seen.add(normalized);
    out.push(normalized);
  };

  const groupId = toGroupCandidate(params.groupId);
  const groupChannel = toGroupCandidate(params.groupChannel);
  const groupName = toGroupCandidate(params.groupName);

  push(groupId);
  if (params.includeGroupIdAlias === true && groupId) {
    push(`group:${groupId}`);
  }
  if (params.allowNameMatching !== false) {
    push(groupChannel);
    push(groupName);
    if (groupName) {
      push(normalizeZalouserGroupSlug(groupName));
    }
  }
  if (params.includeWildcard !== false) {
    push("*");
  }
  return out;
}

export function findZalouserGroupEntry(
  groups: ZalouserGroups | undefined,
  candidates: string[],
): ZalouserGroupConfig | undefined {
  if (!groups) {
    return undefined;
  }
  for (const candidate of candidates) {
    const entry = groups[candidate];
    if (entry) {
      return entry;
    }
  }
  return undefined;
}

export function isZalouserGroupEntryAllowed(entry: ZalouserGroupConfig | undefined): boolean {
  if (!entry) {
    return false;
  }
  const legacyAllow = (entry as ZalouserGroupConfig & { allow?: unknown }).allow;
  return legacyAllow !== false && entry.enabled !== false;
}

Messung V0.5 in Prozent
C=100 H=97 G=98

¤ Dauer der Verarbeitung: 0.10 Sekunden  (vorverarbeitet am  2026-06-07) ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Software

     Quellcodebibliothek
     Eigene Quellcodes
     Fremde Quellcodes
     Suchen

Aktivitäten

     Artikel über Sicherheit
     Anleitung zur Aktivierung von SSL

Muße

     Gedichte
     Musik
     Bilder

Jenseits des Üblichen ....
    

Besucherstatistik

Besucherstatistik