Fileshare: Hostname-Aufloesung fuer UNC-Pfade + Zuordnungen bearbeitbar
- Freigabe-Hostnamen (statt nur IP) werden jetzt unterstuetzt: mount.cifs
bekommt die tatsaechliche Ziel-IP gezielt per "ip="-Option mitgegeben,
aufgeloest ueber _resolve_unc_host_ip(). Deckt zwei reale Faelle ab, die
beim Live-Test mit einem echten Server (Kurzname "s2025") auftraten:
1. Ein bloer Kurzname ohne DNS-Suffixsuche loest auf diesem Server gar
nicht auf -- Fallback probiert zusaetzlich den aus der LDAP-Server-
Einstellung abgeleiteten AD-Domaenensuffix (a la ".ad.eertmoed.net").
2. IPv4 wird bevorzugt aufgeloest, IPv6 nur als Fallback genutzt, falls
fuer den Hostnamen keine IPv4-Adresse existiert.
Der Hostname bleibt dabei unveraendert in der UNC sichtbar/gespeichert.
- AD-Gruppenzuordnungen (App-Rechte) und Fileshare-Gruppen sind jetzt per
Bearbeiten-Button (Stift-Icon) direkt aenderbar statt nur loeschen+neu
anlegen zu koennen -- neue edit_ldap_group_mapping/edit_fileshare_mapping
POST-Routen (UPDATE per id), Bearbeiten-Modals vorbefuellt inkl.
AD-Gruppen-Dropdown (gleiches Lade-Muster wie beim Anlegen).
- UX: "Erforderliche AD-Gruppe fuer Login" ist jetzt ein Dropdown mit
"Gruppen laden" (identisches Muster wie die anderen AD-Gruppenfelder)
statt eines Freitextfelds, in das der volle DN von Hand einzutragen war.
- _normalize_share_unc()-Hilfsfunktion aus dem Add-Handler herausgezogen,
jetzt auch vom Edit-Handler genutzt (kein duplizierter Code).
Live auf POETEST verifiziert: Hostname-Mount ("s2025") erfolgreich nach
Fix, Bearbeiten-Modals korrekt vorbefuellt und persistiert, Dropdown laedt
55 AD-Gruppen und behaelt die aktuelle Auswahl beim Neuladen bei.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
+111
-3
@@ -1688,6 +1688,16 @@ def _ldap_resolve_app_groups(service_conn, user_dn):
|
|||||||
return matched
|
return matched
|
||||||
|
|
||||||
|
|
||||||
|
def _normalize_share_unc(raw):
|
||||||
|
"""Normalisiert einen vom Formular übergebenen Freigabe-Pfad auf das
|
||||||
|
von mount.cifs benötigte "//server/freigabe"-Format -- ein
|
||||||
|
Windows-Admin gibt naturgemäß "\\\\server\\freigabe" ein."""
|
||||||
|
unc = raw.strip().replace("\\", "/")
|
||||||
|
if unc and not unc.startswith("//"):
|
||||||
|
unc = "//" + unc.lstrip("/")
|
||||||
|
return unc
|
||||||
|
|
||||||
|
|
||||||
def _ldap_fileshare_mappings():
|
def _ldap_fileshare_mappings():
|
||||||
conn = get_db_connection()
|
conn = get_db_connection()
|
||||||
rows = conn.execute(
|
rows = conn.execute(
|
||||||
@@ -1876,6 +1886,60 @@ if _IS_WEB_PROCESS:
|
|||||||
_fileshare_cleanup_all_on_startup()
|
_fileshare_cleanup_all_on_startup()
|
||||||
|
|
||||||
|
|
||||||
|
def _resolve_host_preferring_ipv4(hostname):
|
||||||
|
"""Löst EINEN Hostnamen auf -- IPv4-Adresse wenn vorhanden, sonst
|
||||||
|
IPv6, sonst None. IPv4 wird bevorzugt, weil sie in der Praxis
|
||||||
|
zuverlässiger durchgeroutet ist als in DNS eingetragene IPv6-Adressen
|
||||||
|
(siehe _resolve_unc_host_ip); eine funktionierende IPv6-Route wird
|
||||||
|
aber genutzt, wenn es keine IPv4-Adresse gibt, statt komplett
|
||||||
|
aufzugeben."""
|
||||||
|
try:
|
||||||
|
infos = socket.getaddrinfo(hostname, None, socket.AF_UNSPEC, socket.SOCK_STREAM)
|
||||||
|
except socket.gaierror:
|
||||||
|
return None
|
||||||
|
if not infos:
|
||||||
|
return None
|
||||||
|
ipv4 = next((i for i in infos if i[0] == socket.AF_INET), None)
|
||||||
|
return (ipv4 or infos[0])[4][0]
|
||||||
|
|
||||||
|
|
||||||
|
def _resolve_unc_host_ip(unc):
|
||||||
|
"""Löst den Host-Teil einer "//host/share"-UNC auf eine IP-Adresse
|
||||||
|
auf, oder gibt None zurück (Host ist bereits eine IP-Literal, oder es
|
||||||
|
lässt sich nichts ermitteln). Zwei Probleme werden hier abgefangen,
|
||||||
|
die beide dazu führen, dass eine Freigabe per IP klappt, per Hostname
|
||||||
|
aber nicht:
|
||||||
|
1. Ein reiner Kurzname (z.B. "s2025" statt "s2025.ad.eertmoed.net")
|
||||||
|
löst über die konfigurierte DNS des Servers oft GAR NICHT auf, weil
|
||||||
|
hier (anders als bei einem domänenbeigetretenen Windows-Client)
|
||||||
|
keine DNS-Suffixsuche eingerichtet ist. Als Fallback wird deshalb
|
||||||
|
zusätzlich mit dem aus der LDAP-Servereinstellung abgeleiteten
|
||||||
|
AD-Domänensuffix versucht (die dortige AD-DNS-Zone enthält
|
||||||
|
erfahrungsgemäß auch die Datei-Server).
|
||||||
|
2. Manche interne DNS-Zonen liefern für Server-Hostnamen NUR
|
||||||
|
AAAA-Einträge (siehe ad.eertmoed.net) -- IPv4 wird bevorzugt
|
||||||
|
verwendet, falls zusätzlich vorhanden, s.o.
|
||||||
|
Der Hostname bleibt in jedem Fall unverändert in der UNC stehen --
|
||||||
|
nur die tatsächliche Verbindung wird per "ip="-Mount-Option gezielt
|
||||||
|
auf die ermittelte Adresse gelenkt."""
|
||||||
|
host = unc[2:].split("/", 1)[0] if unc.startswith("//") else ""
|
||||||
|
if not host:
|
||||||
|
return None
|
||||||
|
try:
|
||||||
|
socket.inet_aton(host)
|
||||||
|
return None # Host ist bereits eine IPv4-Literal, nichts zu tun
|
||||||
|
except OSError:
|
||||||
|
pass
|
||||||
|
ip = _resolve_host_preferring_ipv4(host)
|
||||||
|
if ip:
|
||||||
|
return ip
|
||||||
|
if "." not in host:
|
||||||
|
domain = get_setting("ldap_server", "")
|
||||||
|
if domain and "." in domain:
|
||||||
|
ip = _resolve_host_preferring_ipv4(f"{host}.{domain}")
|
||||||
|
return ip
|
||||||
|
|
||||||
|
|
||||||
def _mount_one_fileshare(mount_root, label, unc, username, password):
|
def _mount_one_fileshare(mount_root, label, unc, username, password):
|
||||||
"""Mountet EINE Freigabe unter mount_root/label per mount.cifs. Das
|
"""Mountet EINE Freigabe unter mount_root/label per mount.cifs. Das
|
||||||
Passwort wird bewusst über die PASSWD-Umgebungsvariable übergeben statt
|
Passwort wird bewusst über die PASSWD-Umgebungsvariable übergeben statt
|
||||||
@@ -1890,6 +1954,9 @@ def _mount_one_fileshare(mount_root, label, unc, username, password):
|
|||||||
except OSError as e:
|
except OSError as e:
|
||||||
return False, str(e)
|
return False, str(e)
|
||||||
options = f"username={username},vers=3.0,uid=0,gid=0,file_mode=0770,dir_mode=0770,iocharset=utf8"
|
options = f"username={username},vers=3.0,uid=0,gid=0,file_mode=0770,dir_mode=0770,iocharset=utf8"
|
||||||
|
resolved_ip = _resolve_unc_host_ip(unc)
|
||||||
|
if resolved_ip:
|
||||||
|
options += f",ip={resolved_ip}"
|
||||||
env = dict(os.environ)
|
env = dict(os.environ)
|
||||||
env["PASSWD"] = password
|
env["PASSWD"] = password
|
||||||
try:
|
try:
|
||||||
@@ -4769,6 +4836,27 @@ def settings_ldap():
|
|||||||
log_action("settings.update", "LDAP-Gruppenzuordnung", f"{ad_group_name or ad_group_dn} → {app_group_id}")
|
log_action("settings.update", "LDAP-Gruppenzuordnung", f"{ad_group_name or ad_group_dn} → {app_group_id}")
|
||||||
flash("Gruppenzuordnung gespeichert.", "success")
|
flash("Gruppenzuordnung gespeichert.", "success")
|
||||||
|
|
||||||
|
elif "edit_ldap_group_mapping" in request.form:
|
||||||
|
mapping_id = request.form.get("edit_ldap_group_mapping")
|
||||||
|
ad_group_dn = request.form.get("ad_group_dn", "").strip()
|
||||||
|
ad_group_name = request.form.get("ad_group_name", "").strip()
|
||||||
|
app_group_id = request.form.get("app_group_id", "").strip()
|
||||||
|
if not ad_group_dn or not app_group_id:
|
||||||
|
flash("AD-Gruppe und Rechtegruppe müssen ausgewählt werden.", "danger")
|
||||||
|
else:
|
||||||
|
conn = get_db_connection()
|
||||||
|
try:
|
||||||
|
conn.execute(
|
||||||
|
"UPDATE ldap_group_mappings SET ad_group_dn=?, ad_group_name=?, app_group_id=? WHERE id=?",
|
||||||
|
(ad_group_dn, ad_group_name or ad_group_dn, app_group_id, mapping_id),
|
||||||
|
)
|
||||||
|
conn.commit()
|
||||||
|
log_action("settings.update", "LDAP-Gruppenzuordnung geändert", f"{ad_group_name or ad_group_dn} → {app_group_id}")
|
||||||
|
flash("Gruppenzuordnung aktualisiert.", "success")
|
||||||
|
except sqlite3.IntegrityError:
|
||||||
|
flash("Diese AD-Gruppe ist bereits einer anderen Rechtegruppe zugeordnet.", "danger")
|
||||||
|
conn.close()
|
||||||
|
|
||||||
elif "delete_ldap_group_mapping" in request.form:
|
elif "delete_ldap_group_mapping" in request.form:
|
||||||
mapping_id = request.form.get("delete_ldap_group_mapping")
|
mapping_id = request.form.get("delete_ldap_group_mapping")
|
||||||
conn = get_db_connection()
|
conn = get_db_connection()
|
||||||
@@ -4783,9 +4871,7 @@ def settings_ldap():
|
|||||||
ad_group_dn = request.form.get("fs_ad_group_dn", "").strip()
|
ad_group_dn = request.form.get("fs_ad_group_dn", "").strip()
|
||||||
ad_group_name = request.form.get("fs_ad_group_name", "").strip()
|
ad_group_name = request.form.get("fs_ad_group_name", "").strip()
|
||||||
share_label = request.form.get("fs_share_label", "").strip()
|
share_label = request.form.get("fs_share_label", "").strip()
|
||||||
share_unc = request.form.get("fs_share_unc", "").strip().replace("\\", "/")
|
share_unc = _normalize_share_unc(request.form.get("fs_share_unc", ""))
|
||||||
if share_unc and not share_unc.startswith("//"):
|
|
||||||
share_unc = "//" + share_unc.lstrip("/")
|
|
||||||
if not ad_group_dn or not share_label or not share_unc:
|
if not ad_group_dn or not share_label or not share_unc:
|
||||||
flash("AD-Gruppe, Bezeichnung und Freigabe-Pfad müssen angegeben werden.", "danger")
|
flash("AD-Gruppe, Bezeichnung und Freigabe-Pfad müssen angegeben werden.", "danger")
|
||||||
else:
|
else:
|
||||||
@@ -4801,6 +4887,28 @@ def settings_ldap():
|
|||||||
log_action("settings.update", "Fileshare-Gruppenzuordnung", f"{ad_group_name or ad_group_dn} → {share_label} ({share_unc})")
|
log_action("settings.update", "Fileshare-Gruppenzuordnung", f"{ad_group_name or ad_group_dn} → {share_label} ({share_unc})")
|
||||||
flash("Fileshare-Zuordnung gespeichert.", "success")
|
flash("Fileshare-Zuordnung gespeichert.", "success")
|
||||||
|
|
||||||
|
elif "edit_fileshare_mapping" in request.form:
|
||||||
|
mapping_id = request.form.get("edit_fileshare_mapping")
|
||||||
|
ad_group_dn = request.form.get("fs_ad_group_dn", "").strip()
|
||||||
|
ad_group_name = request.form.get("fs_ad_group_name", "").strip()
|
||||||
|
share_label = request.form.get("fs_share_label", "").strip()
|
||||||
|
share_unc = _normalize_share_unc(request.form.get("fs_share_unc", ""))
|
||||||
|
if not ad_group_dn or not share_label or not share_unc:
|
||||||
|
flash("AD-Gruppe, Bezeichnung und Freigabe-Pfad müssen angegeben werden.", "danger")
|
||||||
|
else:
|
||||||
|
conn = get_db_connection()
|
||||||
|
try:
|
||||||
|
conn.execute(
|
||||||
|
"UPDATE ldap_fileshare_mappings SET ad_group_dn=?, ad_group_name=?, share_label=?, share_unc=? WHERE id=?",
|
||||||
|
(ad_group_dn, ad_group_name or ad_group_dn, share_label, share_unc, mapping_id),
|
||||||
|
)
|
||||||
|
conn.commit()
|
||||||
|
log_action("settings.update", "Fileshare-Gruppenzuordnung geändert", f"{ad_group_name or ad_group_dn} → {share_label} ({share_unc})")
|
||||||
|
flash("Fileshare-Zuordnung aktualisiert.", "success")
|
||||||
|
except sqlite3.IntegrityError:
|
||||||
|
flash("Diese Kombination aus AD-Gruppe und Freigabe-Pfad existiert bereits.", "danger")
|
||||||
|
conn.close()
|
||||||
|
|
||||||
elif "delete_fileshare_mapping" in request.form:
|
elif "delete_fileshare_mapping" in request.form:
|
||||||
mapping_id = request.form.get("delete_fileshare_mapping")
|
mapping_id = request.form.get("delete_fileshare_mapping")
|
||||||
conn = get_db_connection()
|
conn = get_db_connection()
|
||||||
|
|||||||
@@ -135,12 +135,18 @@
|
|||||||
<td>{{ m.app_group_name or '—' }}</td>
|
<td>{{ m.app_group_name or '—' }}</td>
|
||||||
<td>
|
<td>
|
||||||
{% if can_edit %}
|
{% if can_edit %}
|
||||||
<form method="post" data-confirm="Zuordnung „{{ m.ad_group_name }} → {{ m.app_group_name }}“ löschen?">
|
<div class="row-actions">
|
||||||
<input type="hidden" name="delete_ldap_group_mapping" value="{{ m.id }}">
|
<button type="button" class="icon-btn" title="Bearbeiten"
|
||||||
<button type="submit" class="icon-btn" style="color:var(--danger);" title="Löschen">
|
onclick="openEditLdapMappingModal('{{ m.id }}','{{ m.ad_group_dn|e }}','{{ m.ad_group_name|e }}','{{ m.app_group_id }}')">
|
||||||
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M3 6h18M8 6V4a2 2 0 012-2h4a2 2 0 012 2v2m3 0l-1 14a2 2 0 01-2 2H7a2 2 0 01-2-2L4 6"/></svg>
|
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 20h9"/><path d="M16.5 3.5a2.1 2.1 0 013 3L7 19l-4 1 1-4z"/></svg>
|
||||||
</button>
|
</button>
|
||||||
</form>
|
<form method="post" data-confirm="Zuordnung „{{ m.ad_group_name }} → {{ m.app_group_name }}“ löschen?">
|
||||||
|
<input type="hidden" name="delete_ldap_group_mapping" value="{{ m.id }}">
|
||||||
|
<button type="submit" class="icon-btn" style="color:var(--danger);" title="Löschen">
|
||||||
|
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M3 6h18M8 6V4a2 2 0 012-2h4a2 2 0 012 2v2m3 0l-1 14a2 2 0 01-2 2H7a2 2 0 01-2-2L4 6"/></svg>
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -186,12 +192,18 @@
|
|||||||
<td class="mono" style="font-size:12px;">{{ m.share_unc }}</td>
|
<td class="mono" style="font-size:12px;">{{ m.share_unc }}</td>
|
||||||
<td>
|
<td>
|
||||||
{% if can_edit %}
|
{% if can_edit %}
|
||||||
<form method="post" data-confirm="Fileshare-Zuordnung „{{ m.ad_group_name }} → {{ m.share_label }}“ löschen?">
|
<div class="row-actions">
|
||||||
<input type="hidden" name="delete_fileshare_mapping" value="{{ m.id }}">
|
<button type="button" class="icon-btn" title="Bearbeiten"
|
||||||
<button type="submit" class="icon-btn" style="color:var(--danger);" title="Löschen">
|
onclick="openEditFileshareMappingModal('{{ m.id }}','{{ m.ad_group_dn|e }}','{{ m.ad_group_name|e }}','{{ m.share_label|e }}','{{ m.share_unc|e }}')">
|
||||||
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M3 6h18M8 6V4a2 2 0 012-2h4a2 2 0 012 2v2m3 0l-1 14a2 2 0 01-2 2H7a2 2 0 01-2-2L4 6"/></svg>
|
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 20h9"/><path d="M16.5 3.5a2.1 2.1 0 013 3L7 19l-4 1 1-4z"/></svg>
|
||||||
</button>
|
</button>
|
||||||
</form>
|
<form method="post" data-confirm="Fileshare-Zuordnung „{{ m.ad_group_name }} → {{ m.share_label }}“ löschen?">
|
||||||
|
<input type="hidden" name="delete_fileshare_mapping" value="{{ m.id }}">
|
||||||
|
<button type="submit" class="icon-btn" style="color:var(--danger);" title="Löschen">
|
||||||
|
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M3 6h18M8 6V4a2 2 0 012-2h4a2 2 0 012 2v2m3 0l-1 14a2 2 0 01-2 2H7a2 2 0 01-2-2L4 6"/></svg>
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -283,6 +295,77 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="modal-overlay" id="editLdapMappingModal">
|
||||||
|
<div class="modal">
|
||||||
|
<form method="post">
|
||||||
|
<input type="hidden" name="edit_ldap_group_mapping" id="editLdapMappingId" value="">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h3>AD-Gruppenzuordnung bearbeiten</h3>
|
||||||
|
<button type="button" class="modal-close" data-close-modal>×</button>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<div class="field">
|
||||||
|
<label>AD-Gruppe</label>
|
||||||
|
<div class="flex gap-2">
|
||||||
|
<select name="ad_group_dn" id="editLdapMappingAdGroup" required style="flex:1;"></select>
|
||||||
|
<button type="button" class="btn btn-secondary btn-sm" id="editLdapMappingLoadGroupsBtn">Gruppen laden</button>
|
||||||
|
</div>
|
||||||
|
<input type="hidden" name="ad_group_name" id="editLdapMappingAdGroupName">
|
||||||
|
<div class="field-hint" id="editLdapMappingLoadStatus">Fragt live per Bind-Konto alle Gruppen aus dem Verzeichnis ab.</div>
|
||||||
|
</div>
|
||||||
|
<div class="field"><label>App-Rechtegruppe</label>
|
||||||
|
<select name="app_group_id" id="editLdapMappingAppGroup" required>
|
||||||
|
<option value="">— auswählen —</option>
|
||||||
|
<option value="admin">Admin (alle Rechte)</option>
|
||||||
|
{% for g in ldap_groups %}
|
||||||
|
<option value="{{ g['id'] }}">{{ g['name'] }}</option>
|
||||||
|
{% endfor %}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="button" class="btn btn-secondary" data-close-modal>Abbrechen</button>
|
||||||
|
<button type="submit" class="btn btn-primary">Speichern</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="modal-overlay" id="editFileshareMappingModal">
|
||||||
|
<div class="modal">
|
||||||
|
<form method="post">
|
||||||
|
<input type="hidden" name="edit_fileshare_mapping" id="editFsMappingId" value="">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h3>Fileshare-Zuordnung bearbeiten</h3>
|
||||||
|
<button type="button" class="modal-close" data-close-modal>×</button>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<div class="field">
|
||||||
|
<label>AD-Gruppe</label>
|
||||||
|
<div class="flex gap-2">
|
||||||
|
<select name="fs_ad_group_dn" id="editFsMappingAdGroup" required style="flex:1;"></select>
|
||||||
|
<button type="button" class="btn btn-secondary btn-sm" id="editFsMappingLoadGroupsBtn">Gruppen laden</button>
|
||||||
|
</div>
|
||||||
|
<input type="hidden" name="fs_ad_group_name" id="editFsMappingAdGroupName">
|
||||||
|
<div class="field-hint" id="editFsMappingLoadStatus">Fragt live per Bind-Konto alle Gruppen aus dem Verzeichnis ab.</div>
|
||||||
|
</div>
|
||||||
|
<div class="field"><label>Bezeichnung</label>
|
||||||
|
<input type="text" name="fs_share_label" id="editFsMappingLabel" placeholder="z.B. Vertrieb" required>
|
||||||
|
<div class="field-hint">Anzeigename in der Freigaben-Auswahl — auch Ordnername unter dem Mount-Punkt.</div>
|
||||||
|
</div>
|
||||||
|
<div class="field"><label>Freigabe-Pfad (UNC)</label>
|
||||||
|
<input type="text" name="fs_share_unc" id="editFsMappingUnc" placeholder="//fileserver/freigabe" required>
|
||||||
|
<div class="field-hint">Beide Schreibweisen funktionieren — <code>\\server\freigabe</code> wird automatisch in das von Linux benötigte <code>//server/freigabe</code> umgewandelt.</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="button" class="btn btn-secondary" data-close-modal>Abbrechen</button>
|
||||||
|
<button type="submit" class="btn btn-primary">Speichern</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
(function () {
|
(function () {
|
||||||
function wireAdGroupLoader(btnId, selectId, nameFieldId, statusId, includeEmptyOption) {
|
function wireAdGroupLoader(btnId, selectId, nameFieldId, statusId, includeEmptyOption) {
|
||||||
@@ -342,7 +425,44 @@
|
|||||||
wireAdGroupLoader('ldapMappingLoadGroupsBtn', 'ldapMappingAdGroup', 'ldapMappingAdGroupName', 'ldapMappingLoadStatus', false);
|
wireAdGroupLoader('ldapMappingLoadGroupsBtn', 'ldapMappingAdGroup', 'ldapMappingAdGroupName', 'ldapMappingLoadStatus', false);
|
||||||
wireAdGroupLoader('fsMappingLoadGroupsBtn', 'fsMappingAdGroup', 'fsMappingAdGroupName', 'fsMappingLoadStatus', false);
|
wireAdGroupLoader('fsMappingLoadGroupsBtn', 'fsMappingAdGroup', 'fsMappingAdGroupName', 'fsMappingLoadStatus', false);
|
||||||
wireAdGroupLoader('requiredGroupLoadBtn', 'requiredGroupSelect', null, 'requiredGroupLoadStatus', true);
|
wireAdGroupLoader('requiredGroupLoadBtn', 'requiredGroupSelect', null, 'requiredGroupLoadStatus', true);
|
||||||
|
wireAdGroupLoader('editLdapMappingLoadGroupsBtn', 'editLdapMappingAdGroup', 'editLdapMappingAdGroupName', 'editLdapMappingLoadStatus', false);
|
||||||
|
wireAdGroupLoader('editFsMappingLoadGroupsBtn', 'editFsMappingAdGroup', 'editFsMappingAdGroupName', 'editFsMappingLoadStatus', false);
|
||||||
})();
|
})();
|
||||||
|
|
||||||
|
// Bearbeiten-Modals vorbefuellen -- die AD-Gruppe steht dabei zunaechst nur
|
||||||
|
// als DN+Name aus der Datenbank zur Verfuegung (ohne erneute LDAP-Abfrage);
|
||||||
|
// "Gruppen laden" ersetzt die Auswahlliste bei Bedarf durch die vollstaendige,
|
||||||
|
// aktuelle AD-Gruppenliste und behaelt den bisherigen Wert dabei bei (siehe
|
||||||
|
// wireAdGroupLoader oben).
|
||||||
|
function seedMappingSelect(selectId, dn, name) {
|
||||||
|
var select = document.getElementById(selectId);
|
||||||
|
select.innerHTML = '';
|
||||||
|
var opt = document.createElement('option');
|
||||||
|
opt.value = dn;
|
||||||
|
opt.textContent = name || dn;
|
||||||
|
opt.dataset.name = name || dn;
|
||||||
|
opt.selected = true;
|
||||||
|
select.appendChild(opt);
|
||||||
|
}
|
||||||
|
|
||||||
|
function openEditLdapMappingModal(id, dn, name, appGroupId) {
|
||||||
|
document.getElementById('editLdapMappingId').value = id;
|
||||||
|
seedMappingSelect('editLdapMappingAdGroup', dn, name);
|
||||||
|
document.getElementById('editLdapMappingAdGroupName').value = name;
|
||||||
|
document.getElementById('editLdapMappingAppGroup').value = appGroupId;
|
||||||
|
document.getElementById('editLdapMappingLoadStatus').textContent = 'Fragt live per Bind-Konto alle Gruppen aus dem Verzeichnis ab.';
|
||||||
|
PoeUI.openModal('editLdapMappingModal');
|
||||||
|
}
|
||||||
|
|
||||||
|
function openEditFileshareMappingModal(id, dn, name, label, unc) {
|
||||||
|
document.getElementById('editFsMappingId').value = id;
|
||||||
|
seedMappingSelect('editFsMappingAdGroup', dn, name);
|
||||||
|
document.getElementById('editFsMappingAdGroupName').value = name;
|
||||||
|
document.getElementById('editFsMappingLabel').value = label;
|
||||||
|
document.getElementById('editFsMappingUnc').value = unc;
|
||||||
|
document.getElementById('editFsMappingLoadStatus').textContent = 'Fragt live per Bind-Konto alle Gruppen aus dem Verzeichnis ab.';
|
||||||
|
PoeUI.openModal('editFileshareMappingModal');
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
Reference in New Issue
Block a user