擴充 LDAP 和 FreeIPA

擴充 LDAP 和 FreeIPA

我正在使用 FreeIPA,並且已成功擴展其屬性,但注意到添加到 FreeIPA 的 Python 插件中的驗證功能僅適用於透過命令列輸入的值。透過 Web UI 輸入的值將按原樣存儲,無需驗證。

因此,我想知道是否要為伺服器添加以下修改:

  1. 啟用 FreeIPA Web UI 以在儲存屬性值之前進行驗證。
  2. 建立 LDAP 使用的新語法類型(例如血型語法)。
  3. 將 Web UI 中屬性的文字方塊變更為下拉清單。

答案1

  1. 為了讓 WebUI 能夠驗證使用者輸入,這不是必需的,因為驗證可以透過 FreeIPA Python 插件中的驗證功能來完成(我只需要重新啟動伺服器即可使變更生效)。
  2. 我不需要創建新的語法,我希望它作為驗證過程的替代,並且由於它正在工作,所以沒有必要。
  3. 若要變更屬性欄位類型,您需要在 javascript 檔案中建立新屬性欄位時新增「$type」:

建立一個文字區域:

section.fields.push({
     $type:'textarea',
     name: 'ldap_attribute_name',
     label: 'some label name'
});

建立一個下拉式選單:

section.fields.push({
     $type:'entity_select',
     other_entity:'user',         // get the users list
     other_field:'uid',           // get the user IDs and display them in the list
     name: 'ldap_attribute_name',
     label: 'some label name'
});

建立一個單選按鈕:

section.fields.push({
     $type:'radio',
     options:[          // create the new radio buttons
       {label:'first button label',value:'first button value'},
       {label:'second button label',value:'second button value'}
     ],
     name: 'ldap_attribute_name',
     label: 'some label name'
});

您可以透過挖掘文件來檢查更多選項/usr/share/ipa/ui/js/freeipa/app.js

相關內容