5

i tried to create some code for push data into Active Directory. Btw i'm using Zend Framerowk 2, and for Directory Services i am using Active Directory. I tried to create some function for add data into Active Directory, but i got the problem. The error message always display

Error Messages

0x35 (Server is unwilling to perform; 0000209A: SvcErr: DSID-031A1081, problem 5003 (WILL_NOT_PERFORM)

Here's my code

$ldap = new Ldap($ldap_config);
$ldap->bind();

//add member user into role     
$entry = array();         
Attribute::setAttribute($entry, 'objectclass', 'top');
Attribute::setAttribute($entry, 'objectclass', 'person');
Attribute::setAttribute($entry, 'objectclass', 'organizationalPerson');
Attribute::setAttribute($entry, 'objectclass', 'user');
Attribute::setAttribute($entry, 'cn', '123ABCD');
Attribute::setAttribute($entry, 'distinguishedname', "CN=123ABCD,OU=Staff,DC=project,DC=company,DC=go,DC=id");
Attribute::setAttribute($entry, 'dn', "CN=123ABCD,OU=Staff,DC=project,DC=company,DC=go,DC=id");
Attribute::setAttribute($entry, 'instancetype', 4);
Attribute::setAttribute($entry, 'displayName', "FebryFairuz");
Attribute::setAttribute($entry, 'sAMAccountName', "123ABCD");
Attribute::setAttribute($entry, 'employeeID', "123ABCD");
Attribute::setAttribute($entry, 'givenName', "Febry");
Attribute::setAttribute($entry, 'mail', "febryfairuz@hotmail.com");
Attribute::setAttribute($entry, 'memberOf', "CN=Default,OU=Role,DC=project,DC=company,DC=go,DC=id");
$result_update = $ldap->add("CN=123ABCD,OU=Staff,DC=project,DC=company,DC=go,DC=id", $entry);
var_dump($result_update);

If i remove Attribute::setAttribute($entry, 'memberOf', "CN=Default,OU=Role,DC=project,DC=company,DC=go,DC=id"); it's runing well and also insert into AD. But if i tried to add attribute of memberOf, i got an error like that. So there's something wrong with my code ? Or there's something i can do for fix that problem ? I hope u want to help me..

Community
  • 1
  • 1
Febry Fairuz
  • 521
  • 1
  • 10
  • 27

1 Answers1

6

You cannot modify the memberOf attribute directly, as it is a backlink attribute in AD. What you have to do is modify the member attribute of the group and add the user to that.

ChadSikorra
  • 2,829
  • 2
  • 21
  • 27
  • Thx for u'r explanation, u'r right i cannot modify the `memberOf` so i tried to modify the `member`. Thx u very much for u'r help. – Febry Fairuz Sep 07 '16 at 01:46
  • could you explain how you manage to modify the groups? I tried ***member*** after ***memberof*** showed problem – Michel Ayres Nov 22 '17 at 11:18