1

我正在尝试创建一个自定义的新用户模板,其中包含我需要的所有对象类和字段,但由于某种原因,onchange autoFills 已全部停止工作。我对通用模板没有意见。

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE template SYSTEM "template.dtd">

<template>
<askcontainer>1</askcontainer>
<description>New User Account</description>
<icon>ldap-user.png</icon>
<invalid>0</invalid>
<rdn>uid</rdn>
<regexp>^ou=People,dc=example,c=com</regexp>
<title>Custom: User Account</title>
<visible>1</visible>

<objectClasses>
<objectClass id="inetOrgPerson"></objectClass>
<objectClass id="posixAccount"></objectClass>
<objectClass id="shadowAccount"></objectClass>
<objectClass id="postfixUser"></objectClass>
</objectClasses>

<attributes>
<attribute id="givenName">
    <display>Preferred name</display>
    <icon>ldap-uid.png</icon>
    <onchange>=autoFill(cn;%givenName% %sn%)</onchange>
    <onchange>=autoFill(uid;%givenName%%sn%)</onchange>
    <order>1</order>
    <page>1</page>
</attribute>
<attribute id="sn">
    <display>Last name</display>
    <icon>ldap-uid.png</icon>
    <onchange>=autoFill(cn;%givenName% %sn%)</onchange>
    <onchange>=autoFill(uid;%givenName|0-1/l%%sn/l%)</onchange>
    <!-- <onchange>=autoFill(homeDirectory;/home/users/%uid|0-1/l%/%uid%)</onchange> -->
    <order>2</order>
    <page>1</page>
</attribute>
<attribute id="cn">
    <display>Common Name</display>
    <icon>ldap-uid.png</icon>
    <order>3</order>
    <page>1</page>
    <spacer>1</spacer>
</attribute>
<attribute id="uid">
    <display>User ID</display>
    <onchange>=autoFill(homeDirectory;/home/%uid%)</onchange>
    <onchange>=autoFill(mail;%uid%@example.com)</onchange>
    <order>4</order>
    <page>1</page>
</attribute>
<attribute id="uidNumber">
    <display>UID Number</display>
    <icon>terminal.png</icon>
    <order>4</order>
    <page>1</page>
    <readonly>1</readonly>
    <value>=php.GetNextNumber(/;uidNumber)</value>
    <spacer>1</spacer>
</attribute>
<attribute id="mail">
    <display>Email</display>
    <order>5</order>
    <onchange>=autoFill(maildrop;%mail)</onchange>
    <onchange>=autoFill(mailacceptinggeneralid;%mail)</onchange>
    <page>1</page>
</attribute>
<attribute id="maildrop">
    <display>Email Recipient</display>
    <order>5</order>
    <page>1</page>
</attribute>
<attribute id="mailacceptinggeneralid">
    <display>Alternative Emails</display>
    <order>5</order>
    <page>1</page>
    <spacer>1</spacer>
</attribute>
<attribute id="homeDirectory">
    <display>Home directory</display>
    <!-- <onchange>=autoFill(homeDirectory;/home/users/%gidNumber|0-0/T%/%uid|3-%)</onchange> -->
    <order>6</order>
    <page>1</page>
</attribute>
<attribute id="gidNumber">
    <display>GID Number</display>
    <!-- <onchange>=autoFill(homeDirectory;/home/users/%gidNumber|0-0/T%/%uid|3-%)</onchange> -->
    <order>7</order>
    <page>1</page>
    <value><![CDATA[=php.PickList(/;(&(objectClass=posixGroup));gidNumber;%cn%;;;;cn)]]></value>
</attribute>
<attribute id="loginShell">
    <display>Login shell</display>
    <order>9</order>
    <page>1</page>
    <!-- <value><![CDATA[=php.PickList(/;(&(objectClass=posixAccount));loginShell;%loginShell%;;;;loginShell)]]></value> -->
    <type>select</type>
    <value id="/bin/sh">/bin/sh</value>
    <value id="/bin/bash">/bin/bash</value>
</attribute>
<attribute id="userPassword">
    <display>Password</display>
    <!-- <helper>
        <display>Encryption</display>
        <id>enc</id>
        <value>=php.PasswordEncryptionTypes()</value>
    </helper> -->
    <icon>lock.png</icon>
    <order>10</order>
    <page>1</page>
    <post>=php.PasswordEncrypt(%enc%;%userPassword%)</post>
    <spacer>1</spacer>
    <verify>1</verify>
</attribute>
</attributes>

</template>

我尝试注释掉<regexp>标签,这使得前几个属性的 onchanges 起作用,但进一步尝试让其他任何一个工作再次导致失败,并且恢复到部分工作的版本使所有这些都失败。

模板上的 wiki doco 有点缺乏细节,没有关于级联 onChange 条目有问题的信息。

服务器:phpldapadmin 1.2.2 nginx 1.18.0 Ubuntu 20.4

客户端:Chromium 版本 87.0.4280.66(官方构建)Arch Linux(64 位)

4

0 回答 0