Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions ballerina/Ballerina.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
org = "ballerina"
name = "ldap"
version = "1.3.0"
version = "1.3.1"
authors = ["Ballerina"]
export=["ldap"]
keywords = ["ldap"]
Expand All @@ -15,8 +15,8 @@ graalvmCompatible = true
[[platform.java21.dependency]]
groupId = "io.ballerina.lib"
artifactId = "ldap-native"
version = "1.3.0"
path = "../native/build/libs/ldap-native-1.3.0.jar"
version = "1.3.1-SNAPSHOT"
path = "../native/build/libs/ldap-native-1.3.1-SNAPSHOT.jar"

[[platform.java21.dependency]]
groupId = "com.unboundid"
Expand Down
4 changes: 2 additions & 2 deletions ballerina/Dependencies.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ distribution-version = "2201.12.0"
[[package]]
org = "ballerina"
name = "crypto"
version = "2.9.0"
version = "2.9.3"
dependencies = [
{org = "ballerina", name = "jballerina.java"},
{org = "ballerina", name = "time"}
Expand Down Expand Up @@ -65,7 +65,7 @@ scope = "testOnly"
[[package]]
org = "ballerina"
name = "ldap"
version = "1.3.0"
version = "1.3.1"
dependencies = [
{org = "ballerina", name = "crypto"},
{org = "ballerina", name = "jballerina.java"},
Expand Down
51 changes: 27 additions & 24 deletions ballerina/client.bal
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public isolated client class Client {
} external;

# Creates an entry in a directory server.
#
#
# ```ballerina
# anydata user = {
# "objectClass": "user",
Expand All @@ -41,7 +41,7 @@ public isolated client class Client {
# };
# ldap:LdapResponse result = check ldapClient->add(userDN, user);
# ```
#
#
# + dN - The distinguished name of the entry
# + entry - The information to add
# + return - A `ldap:Error` if the operation fails or `ldap:LdapResponse` if successfully created
Expand All @@ -50,19 +50,19 @@ public isolated client class Client {
} external;

# Removes an entry in a directory server.
#
#
# ```ballerina
# ldap:LdapResponse result = check ldapClient->delete(userDN);
# ```
#
#
# + dN - The distinguished name of the entry to remove
# + return - A `ldap:Error` if the operation fails or `ldap:LdapResponse` if successfully removed
remote isolated function delete(string dN) returns LdapResponse|Error = @java:Method {
'class: "io.ballerina.lib.ldap.Client"
} external;

# Updates information of an entry.
#
#
# ```ballerina
# anydata user = {
# "sn": "User",
Expand All @@ -71,7 +71,7 @@ public isolated client class Client {
# };
# ldap:LdapResponse result = check ldapClient->modify(userDN, user);
# ```
#
#
# + dN - The distinguished name of the entry
# + entry - The information to update
# + return - A `ldap:Error` if the operation fails or `LdapResponse` if successfully updated
Expand All @@ -80,11 +80,11 @@ public isolated client class Client {
} external;

# Renames an entry in a directory server.
#
#
# ```ballerina
# ldap:LdapResponse modifyDN = check ldapClient->modifyDn(userDN, "CN=Test User2", true);
# ```
#
#
# + currentDn - The current distinguished name of the entry
# + newRdn - The new relative distinguished name
# + deleteOldRdn - A boolean value to determine whether to delete the old RDN
Expand All @@ -95,11 +95,11 @@ public isolated client class Client {
} external;

# Determines whether a given entry has a specified attribute value.
#
#
# ```ballerina
# boolean compare = check ldapClient->compare(userDN, "givenName", "New User");
# ```
#
#
# + dN - The distinguished name of the entry
# + attributeName - The name of the target attribute for which the comparison is to be performed
# + assertionValue - The assertion value to verify within the entry
Expand All @@ -110,67 +110,70 @@ public isolated client class Client {
} external;

# Gets information of an entry.
#
#
# ```ballerina
# anydata value = check ldapClient->getEntry(userDN);
# ```
#
#
# + dN - The distinguished name of the entry
# + attributes - Optional array of attribute names to retrieve. If not provided, attributes are determined based on the target type
# + targetType - Default parameter use to infer the user specified type
# + return - An entry result with the given type or else `ldap:Error`
remote isolated function getEntry(string dN, typedesc<anydata> targetType = <>)
remote isolated function getEntry(string dN, string[]? attributes = (), typedesc<Entry> targetType = <>)
returns targetType|Error = @java:Method {
'class: "io.ballerina.lib.ldap.Client"
} external;

# Returns a list of entries that match the given search parameters.
#
#
# ```ballerina
# anydata[] value = check ldapClient->searchWithType("DC=ldap,DC=com", "(givenName=New User)", ldap:SUB);
# ```
#
#
# + baseDn - The base distinguished name of the entry
# + filter - The filter to be used in the search
# + scope - The scope of the search
# + attributes - Optional array of attribute names to retrieve. If not provided, attributes are determined based on the target type
# + targetType - Default parameter use to infer the user specified type
# + return - An array of entries with the given type or else `ldap:Error`
remote isolated function searchWithType(string baseDn, string filter,
SearchScope scope, typedesc<record{}[]> targetType = <>)
remote isolated function searchWithType(string baseDn, string filter,
SearchScope scope, string[]? attributes = (), typedesc<record {}[]> targetType = <>)
returns targetType|Error = @java:Method {
'class: "io.ballerina.lib.ldap.Client"
} external;

# Returns a record containing search result entries and references that match the given search parameters.
#
#
# ```ballerina
# ldap:SearchResult value = check ldapClient->search("DC=ldap,DC=windows", "(givenName=New User)", ldap:SUB);
# ```
#
#
# + baseDn - The base distinguished name of the entry
# + filter - The filter to be used in the search
# + scope - The scope of the search
# + attributes - Optional array of attribute names to retrieve. If not provided, all attributes are retrieved
# + return - An `ldap:SearchResult` if successful, or else `ldap:Error`
remote isolated function search(string baseDn, string filter, SearchScope scope)
remote isolated function search(string baseDn, string filter, SearchScope scope, string[]? attributes = ())
returns SearchResult|Error = @java:Method {
'class: "io.ballerina.lib.ldap.Client"
} external;

# Unbinds from the server and closes the LDAP connection.
#
#
# ```ballerina
# ldapClient->close();
# ```
#
#
remote isolated function close() = @java:Method {
'class: "io.ballerina.lib.ldap.Client"
} external;

# Determines whether the client is connected to the server.
#
#
# ```ballerina
# boolean isConnected = ldapClient->isConnected();
# ```
#
#
# + return - A boolean value indicating the connection status
remote isolated function isConnected() returns boolean = @java:Method {
'class: "io.ballerina.lib.ldap.Client"
Expand Down
Loading