[FIX] ModuleADSS - Make new site link page works#78
Open
mmarsac wants to merge 5 commits into
Open
Conversation
719b2f9 to
843778c
Compare
osvegn
requested changes
May 19, 2026
Contributor
There was a problem hiding this comment.
A good practice is to split your code in different kind of function / procedure:
- Logical: Takes arguments and does some modification / check.
- Integration: Call that requires an established connection.
- UI: Get / Set information to UI.
It will help to provide tests.
For example (pseudocode):
/// Retrieve information from UI. -> UI tests
function GetDistinguishedName: RawUtf8;
begin
result := Edit1.Text;
end;
/// Use LDAP protocol to retrieve data -> Integration tests
function RetrieveObjectClassAttribute(ADistinguishedName: RawUtf8): TLdapAttribute;
begin
result := TLdapAttribute(LdapClient.SearchObject(ADistinguishedName, '', 'objectClass').clone);
end;
/// Only check data -> Unit tests
function IsObjectUser(AAttribute: TLdapAttribute): Boolean;
begin
result := AAttribute.GetReadable(Pred(AAttribute.Count)) = 'user';
end;
/// Helper function that does all in one.
function IsSelectedObjectUser(): Boolean
begin
result := IsObjectUser(RetrieveObjectClassAttribute(GetDistinguishedName));
end;
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Make new site link page works
Using an LDAP search, retrieve all available sites in order to build a new site link.
A minimum of two sites is required to create a site link. If fewer than two sites are found, an error message is displayed instead of the standard constructor page.
If exactly two sites are available, they are automatically added to the new site link. Otherwise, the user can select the desired sites from a list of all available sites.
By default, the cost value is set to 100, and the replication interval is set to 180.