Skip to content

Commit

Permalink
Update description in LDAP BBEs
Browse files Browse the repository at this point in the history
  • Loading branch information
Nuvindu committed Aug 13, 2024
1 parent d3abec7 commit 3a43320
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 12 deletions.
13 changes: 8 additions & 5 deletions examples/ldap-add-remove-entry/ldap_add_remove_entry.bal
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
import ballerina/ldap;
import ballerina/io;
import ballerina/ldap;

public function main() returns error? {
ldap:Client ldap = check new({
// Initializes a new LDAP client with credentials.
ldap:Client ldapClient = check new ({
hostName: "localhost",
port: 389,
domainName: "cn=admin,dc=example,dc=com",
password: "adminpassword"
});

ldap:LdapResponse addResponse = check ldap->add(
"cn=user,dc=example,dc=com",
// Adds an entry to the directory server.
ldap:LdapResponse addResponse = check ldapClient->add(
"cn=user,dc=example,dc=com",
{
"objectClass": ["top", "person"],
"sn": "user",
Expand All @@ -19,6 +21,7 @@ public function main() returns error? {
);
io:println("Add Response: ", addResponse.resultCode);

ldap:LdapResponse deleteResponse = check ldap->delete("cn=user,dc=example,dc=com");
// Deletes an entry from the directory server.
ldap:LdapResponse deleteResponse = check ldapClient->delete("cn=user,dc=example,dc=com");
io:println("Delete Response: ", deleteResponse.resultCode);
}
2 changes: 1 addition & 1 deletion examples/ldap-add-remove-entry/ldap_add_remove_entry.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# LDAP Client - Add/Remove entries
# LDAP client - Add/Remove entries

The `ldap:Client` connects to a directory server and performs various operations on directories. Currently, it supports the generic LDAP operations; `add`, `modify`, `modifyDN`, `compare`, `search`, `searchWithType`, `delete`, and `close`.

Expand Down
11 changes: 6 additions & 5 deletions examples/ldap-search-entry copy/ldap_search_entry.bal
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
import ballerina/ldap;
import ballerina/io;
import ballerina/ldap;

public function main() returns error? {
ldap:Client ldap = check new({
// Initialized a new LDAP client.
ldap:Client ldapClient = check new ({
hostName: "localhost",
port: 389,
domainName: "cn=admin,dc=example,dc=com",
password: "adminpassword"
});

ldap:SearchResult searchResult = check ldap->search(
"cn=user,dc=example,dc=com",
// Searches for an entry in the directory server.
ldap:SearchResult searchResult = check ldapClient->search(
"cn=user,dc=example,dc=com",
"(sn=user)",
ldap:SUB
);

io:println("Search Response: ", searchResult.resultCode);
}
2 changes: 1 addition & 1 deletion examples/ldap-search-entry copy/ldap_search_entry.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# LDAP Client - Seacrh for an entry
# LDAP client - Seacrh for an entry

The `ldap:Client` connects to a directory server and performs various operations on directories. Currently, it supports the main LDAP operations; `add`, `modify`, `modifyDN`, `compare`, `search`, `searchWithType`, `delete`, and `close`.

Expand Down

0 comments on commit 3a43320

Please sign in to comment.