Skip to content

[FIX] ModuleADSS - Make new site link page works#78

Open
mmarsac wants to merge 5 commits into
mainfrom
make-new-site-link-page-works
Open

[FIX] ModuleADSS - Make new site link page works#78
mmarsac wants to merge 5 commits into
mainfrom
make-new-site-link-page-works

Conversation

@mmarsac
Copy link
Copy Markdown
Collaborator

@mmarsac mmarsac commented May 19, 2026

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.

@mmarsac mmarsac requested a review from osvegn May 19, 2026 12:49
@mmarsac mmarsac self-assigned this May 19, 2026
@mmarsac mmarsac linked an issue May 19, 2026 that may be closed by this pull request
@mmarsac mmarsac force-pushed the make-new-site-link-page-works branch from 719b2f9 to 843778c Compare May 19, 2026 12:55
Comment thread packages/OpenRSATGUI/ufrmnewsitelink.pas Outdated
Comment thread packages/OpenRSATGUI/ufrmnewsitelink.pas Outdated
Comment thread packages/OpenRSATGUI/ufrmnewsitelink.pas Outdated
Comment thread packages/OpenRSATGUI/ufrmnewsitelink.pas Outdated
Comment thread packages/OpenRSATGUI/ufrmnewsitelink.pas Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make new Site Link page works

2 participants