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#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么
  • ¥15 banner广告展示设置多少时间不怎么会消耗用户价值
  • ¥16 mybatis的代理对象无法通过@Autowired装填
  • ¥15 可见光定位matlab仿真
  • ¥15 arduino 四自由度机械臂
  • ¥15 wordpress 产品图片 GIF 没法显示
  • ¥15 求三国群英传pl国战时间的修改方法
  • ¥15 matlab代码代写,需写出详细代码,代价私
  • ¥15 ROS系统搭建请教(跨境电商用途)
  • ¥15 AIC3204的示例代码有吗,想用AIC3204测量血氧,找不到相关的代码。