简体   繁体   English

如何使用活动目录中的ldap3将现有条目(用户)添加到现有组

[英]How to add existing entry (user) to an existing group using ldap3 in active directory

I have seen documentation and lot of examples on how to add new entry to a existing group in active directory using LDAP3 but none to add already existing user or entry to another existing group. 我已经看到了有关如何使用LDAP3将新条目添加到活动目录中的现有组的文档和大量示例,但没有用于将现有用户或条目添加到另一个现有组。 (to be clear entry already exists in other groups, just needed to be added to another group). (要明确的条目已经存在于其他组中,只需要添加到另一组)。

I have tried LDAP3 ADD function which is throwing error as entry already exists and only allows new entries as specified in documentation. 我已经尝试过LDAP3 ADD函数,因为条目已存在而抛出错误,并且只允许文档中指定的新条目。

Could you please help me on this. 你能帮帮我吗?

Was able to get it working using below function 能够使用以下功能使其工作

ldap3.extend.microsoft.addMembersToGroups.ad_add_members_to_groups(connection, members_dn, groups_dn, fix=True, raise_error=False)

Documentation link : https://ldap3.readthedocs.io/ldap3.extend.microsoft.addMembersToGroups.html 文档链接: https//ldap3.readthedocs.io/ldap3.extend.microsoft.addMembersToGroups.html

This post helped me : ldap3 python add user to group . 这篇文章帮助我: ldap3 python将用户添加到组中 (not sure if my post will be seen as duplicate as the original post doesn't clearly mention what is the problem. ) (不确定我的帖子是否会被视为重复,因为原始帖子没有明确提到问题是什么。)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM