dshxbrzgi090608692 2015-07-08 09:32
浏览 42
已采纳

使用Zend / Ldap将值附加到多值LDAP属性

I want to add a value to an already existing multi-value LDAP attribute (specifically the member attribute) and I am using Zend Framework 2 Zend/Ldap API.

It can easily be done by grabbing the actual value from the LAP server with ->getEntry(), modifying the resulting array with setAttribute() and writing the array back to the LDAP server with ->update(), all ZF2/Ldap functions.

Of course there is a but:
If I do it this way, it might happen that I write a very large array with thousands of entries to the LDAP server. Especially when writing the 'member' attribute to a GroupOfNames object, this may trigger the (in my case openldap's) memberof overlay and it starts to work (update? index?) on all of these thousands of entries.

In my case, I happen to run in a timeout. If I disable the memberof overlay in the openldap server, everything is fine. This might be an openldap bug or problem, but anyway, after this long foreplay, here is my question:

Basic php has a function ldap_mod_add() which adds just a single value to an existing attribute, no matter how many values there already are. CLI's ldapmodify works the same. This way I probably won't overload the memberof overlay.

How would I do something similar with the Zend/Ldap API?

Zend\Ldap\Attribute::setAttribute() knows how to append, but this only works on a local copied array. So how to append a value directly to the LDAP server entry?

  • 写回答

1条回答 默认 最新

  • doujiu8145 2015-07-08 09:51
    关注

    Looking at the Zend Framework source, this is impossible. The Zend\Ldap\Attribute uses the ldap extension; but ldap_mod_add isn't used anywhere.

    You should create a feature-request or even implement this yourself and create a pull-request to implement it.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 #MATLAB仿真#车辆换道路径规划
  • ¥15 java 操作 elasticsearch 8.1 实现 索引的重建
  • ¥15 数据可视化Python
  • ¥15 要给毕业设计添加扫码登录的功能!!有偿
  • ¥15 kafka 分区副本增加会导致消息丢失或者不可用吗?
  • ¥15 微信公众号自制会员卡没有收款渠道啊
  • ¥100 Jenkins自动化部署—悬赏100元
  • ¥15 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条
  • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘