-
Notifications
You must be signed in to change notification settings - Fork 318
Add SFTP Connector functionality and related components #5930
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
IceOnly
wants to merge
11
commits into
microsoft:main
Choose a base branch
from
IceOnly:issue/5928
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
5dd02ce
Add SFTP Connector functionality and related components
IceOnly 7e658dc
Remove unused local procedures for path handling in SFTP Connector im…
IceOnly 52e5c91
Update documentation and references from SharePoint to SFTP in connec…
IceOnly 0c15b11
Fix platform issue with Stream handling in GetFileAsStream and update…
IceOnly 8a43784
Refactor authentication handling in SFTP account management to unify …
IceOnly 753e4c5
Remove unnecessary pragma warnings in SFTP Account table procedures
IceOnly 7ec63cc
Enhance SFTP account table with port validation and update SFTP conne…
IceOnly 53b900c
Refactor SFTP account handling to unify password and certificate mana…
IceOnly a4949f4
Add code review suggestions
IceOnly 363cb4c
Fix #6086
IceOnly 8dff828
Add code review suggestions
IceOnly File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
13 changes: 13 additions & 0 deletions
13
...1/External File Storage - SFTP Connector/App/Entitlements/ExtSFTPConnector.Entitlement.al
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| // ------------------------------------------------------------------------------------------------ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. See License.txt in the project root for license information. | ||
| // ------------------------------------------------------------------------------------------------ | ||
|
|
||
| namespace System.ExternalFileStorage; | ||
|
|
||
| entitlement "Ext. SFTP Connector" | ||
| { | ||
|
|
||
| ObjectEntitlements = "Ext. SFTP - Edit"; | ||
| Type = Implicit; | ||
| } |
Binary file added
BIN
+4.57 KB
src/Apps/W1/External File Storage - SFTP Connector/App/ExtensionLogo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions
2
src/Apps/W1/External File Storage - SFTP Connector/App/README.md
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| # External File Storage - SFTP Connector | ||
| This connector allows access to SFTP Server Files and Folder. |
43 changes: 43 additions & 0 deletions
43
src/Apps/W1/External File Storage - SFTP Connector/App/app.json
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| { | ||
| "id": "e0df20ef-75a2-4fae-8e3a-88140ab29507", | ||
| "name": "External File Storage - SFTP Connector", | ||
| "publisher": "Microsoft", | ||
| "brief": "Enables file and folder operations for SFTP folders and files via the External File Storage Module with Business Central.", | ||
| "description": "This app enables file and folder operations for SFTP folders and files via the External File Storage Module with Business Central.", | ||
| "version": "28.0.0.0", | ||
| "privacyStatement": "https://go.microsoft.com/fwlink/?linkid=724009", | ||
| "EULA": "https://go.microsoft.com/fwlink/?linkid=2009120", | ||
| "help": "https://go.microsoft.com/fwlink/?linkid=2134520", | ||
| "url": "https://go.microsoft.com/fwlink/?linkid=724011", | ||
| "logo": "ExtensionLogo.png", | ||
| "application": "28.0.0.0", | ||
| "platform": "28.0.0.0", | ||
| "internalsVisibleTo": [ | ||
| { | ||
| "id": "87c3fa98-904d-452d-95fe-5de2c7f0b624", | ||
| "name": "External File Storage - SFTP Connector Tests", | ||
| "publisher": "Microsoft" | ||
| } | ||
| ], | ||
| "dependencies": [], | ||
| "screenshots": [], | ||
| "idRanges": [ | ||
| { | ||
| "from": 4621, | ||
| "to": 4629 | ||
| } | ||
| ], | ||
| "resourceExposurePolicy": { | ||
| "allowDebugging": true, | ||
| "allowDownloadingSource": true, | ||
| "includeSourceInSymbolFile": true | ||
| }, | ||
| "contextSensitiveHelpUrl": "https://go.microsoft.com/fwlink/?linkid=2134520", | ||
| "resourceFolders": [ | ||
| "data" | ||
| ], | ||
| "target": "Cloud", | ||
| "features": [ | ||
| "TranslationFile" | ||
| ] | ||
| } | ||
Binary file added
BIN
+34.6 KB
src/Apps/W1/External File Storage - SFTP Connector/App/data/connector-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 17 additions & 0 deletions
17
...ps/W1/External File Storage - SFTP Connector/App/permissions/ExtSFTPEdit.PermissionSet.al
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| // ------------------------------------------------------------------------------------------------ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. See License.txt in the project root for license information. | ||
| // ------------------------------------------------------------------------------------------------ | ||
|
|
||
| namespace System.ExternalFileStorage; | ||
|
|
||
| permissionset 4621 "Ext. SFTP - Edit" | ||
| { | ||
| Access = Public; | ||
| Assignable = false; | ||
| Caption = 'SFTP - Edit'; | ||
| IncludedPermissionSets = "Ext. SFTP - Read"; | ||
|
|
||
| Permissions = | ||
| tabledata "Ext. SFTP Account" = imd; | ||
| } |
17 changes: 17 additions & 0 deletions
17
...W1/External File Storage - SFTP Connector/App/permissions/ExtSFTPObjects.PermissionSet.al
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| // ------------------------------------------------------------------------------------------------ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. See License.txt in the project root for license information. | ||
| // ------------------------------------------------------------------------------------------------ | ||
|
|
||
| namespace System.ExternalFileStorage; | ||
|
|
||
| permissionset 4622 "Ext. SFTP - Objects" | ||
| { | ||
| Access = Public; | ||
| Assignable = false; | ||
| Caption = 'SFTP - Objects'; | ||
| Permissions = | ||
| table "Ext. SFTP Account" = X, | ||
| page "Ext. SFTP Account Wizard" = X, | ||
| page "Ext. SFTP Account" = X; | ||
| } |
17 changes: 17 additions & 0 deletions
17
...ps/W1/External File Storage - SFTP Connector/App/permissions/ExtSFTPRead.PermissionSet.al
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| // ------------------------------------------------------------------------------------------------ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. See License.txt in the project root for license information. | ||
| // ------------------------------------------------------------------------------------------------ | ||
|
|
||
| namespace System.ExternalFileStorage; | ||
|
|
||
| permissionset 4623 "Ext. SFTP - Read" | ||
| { | ||
| Access = Public; | ||
| Assignable = false; | ||
| Caption = 'SFTP - Read'; | ||
| IncludedPermissionSets = "Ext. SFTP - Objects"; | ||
|
|
||
| Permissions = | ||
| tabledata "Ext. SFTP Account" = r; | ||
| } |
11 changes: 11 additions & 0 deletions
11
...File Storage - SFTP Connector/App/permissions/FileStorageAdminExtSFTP.PermissionSetExt.al
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| // ------------------------------------------------------------------------------------------------ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. See License.txt in the project root for license information. | ||
| // ------------------------------------------------------------------------------------------------ | ||
|
|
||
| namespace System.ExternalFileStorage; | ||
|
|
||
| permissionsetextension 4621 "File Storage - Admin - Ext. SFTP" extends "File Storage - Admin" | ||
| { | ||
| IncludedPermissionSets = "Ext. SFTP - Edit"; | ||
| } |
11 changes: 11 additions & 0 deletions
11
... File Storage - SFTP Connector/App/permissions/FileStorageEditExtSFTP.PermissionSetExt.al
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| // ------------------------------------------------------------------------------------------------ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. See License.txt in the project root for license information. | ||
| // ------------------------------------------------------------------------------------------------ | ||
|
|
||
| namespace System.ExternalFileStorage; | ||
|
|
||
| permissionsetextension 4622 "File Storage - Edit - Ext. SFTP" extends "File Storage - Edit" | ||
| { | ||
| IncludedPermissionSets = "Ext. SFTP - Read"; | ||
| } |
161 changes: 161 additions & 0 deletions
161
src/Apps/W1/External File Storage - SFTP Connector/App/src/ExtSFTPAccount.Page.al
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,161 @@ | ||
| // ------------------------------------------------------------------------------------------------ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. See License.txt in the project root for license information. | ||
| // ------------------------------------------------------------------------------------------------ | ||
|
|
||
| namespace System.ExternalFileStorage; | ||
|
|
||
| /// <summary> | ||
| /// Displays an account that was registered via the SFTP connector. | ||
| /// </summary> | ||
| page 4621 "Ext. SFTP Account" | ||
| { | ||
| ApplicationArea = All; | ||
| Caption = 'SFTP Account'; | ||
| DataCaptionExpression = Rec.Name; | ||
| Extensible = false; | ||
| InsertAllowed = false; | ||
| PageType = Card; | ||
| Permissions = tabledata "Ext. SFTP Account" = rimd; | ||
| SourceTable = "Ext. SFTP Account"; | ||
| UsageCategory = None; | ||
|
|
||
| layout | ||
| { | ||
| area(Content) | ||
| { | ||
| field(NameField; Rec.Name) | ||
| { | ||
| NotBlank = true; | ||
| ShowMandatory = true; | ||
| } | ||
| field(Hostname; Rec.Hostname) { } | ||
| field(Port; Rec.Port) { } | ||
| field(Fingerprints; Rec.Fingerprints) { } | ||
| field("Base Relative Folder Path"; Rec."Base Relative Folder Path") { } | ||
| field("Authentication Type"; Rec."Authentication Type") | ||
| { | ||
| trigger OnValidate() | ||
| begin | ||
| MaskSensitiveFields(); | ||
| UpdateAuthTypeVisibility(); | ||
| CurrPage.Update(true); | ||
| end; | ||
| } | ||
| field(Username; Rec.Username) { } | ||
| group(Credentials) | ||
| { | ||
| Caption = 'Credentials'; | ||
| Editable = PageEditable; | ||
|
|
||
| group(SFTPPasswordGroup) | ||
| { | ||
| ShowCaption = false; | ||
| Visible = PasswordVisible; | ||
|
|
||
| field(PasswordField; Password) | ||
| { | ||
| Caption = 'Password'; | ||
| ExtendedDatatype = Masked; | ||
| ToolTip = 'Specifies the Password to access the SFTP Server.'; | ||
| trigger OnValidate() | ||
| begin | ||
| Rec.SetPassword(Password); | ||
| end; | ||
| } | ||
| } | ||
| group(SFTPCertificateGroup) | ||
| { | ||
| ShowCaption = false; | ||
| Visible = CertificateVisible; | ||
|
|
||
| field(CertificateUploadStatus; CertificateStatusText) | ||
| { | ||
| Caption = 'Certificate'; | ||
| Editable = false; | ||
| ToolTip = 'Specifies the key file used for authentication. Click here to upload a key file (.pk, .ppk, or .pub).'; | ||
|
|
||
| trigger OnDrillDown() | ||
| begin | ||
| Certificate := Rec.UploadCertificateFile(); | ||
| Rec.SetCertificate(Certificate); | ||
| UpdateCertificateStatus(); | ||
| end; | ||
| } | ||
|
|
||
| field(CertificatePasswordField; CertificatePassword) | ||
| { | ||
| Caption = 'Certificate Password'; | ||
| ExtendedDatatype = Masked; | ||
| ToolTip = 'Specifies the password used to protect the private key in the certificate. Leave empty if the certificate is not password-protected.'; | ||
|
|
||
| trigger OnValidate() | ||
| begin | ||
| Rec.SetCertificatePassword(CertificatePassword); | ||
| end; | ||
| } | ||
| } | ||
| } | ||
| field(Disabled; Rec.Disabled) { } | ||
| } | ||
| } | ||
|
|
||
| var | ||
| PageEditable: Boolean; | ||
| PasswordVisible: Boolean; | ||
| CertificateVisible: Boolean; | ||
| [NonDebuggable] | ||
| Password: Text; | ||
| [NonDebuggable] | ||
| CertificatePassword, Certificate : Text; | ||
| CertificateStatusText: Text; | ||
|
|
||
| trigger OnOpenPage() | ||
| begin | ||
| Rec.SetCurrentKey(Name); | ||
| UpdateAuthTypeVisibility(); | ||
| end; | ||
|
|
||
| trigger OnAfterGetCurrRecord() | ||
| begin | ||
| PageEditable := CurrPage.Editable(); | ||
|
|
||
| MaskSensitiveFields(); | ||
| UpdateAuthTypeVisibility(); | ||
| UpdateCertificateStatus(); | ||
| end; | ||
|
|
||
| local procedure MaskSensitiveFields() | ||
| begin | ||
| Clear(Password); | ||
| Clear(Certificate); | ||
| Clear(CertificatePassword); | ||
|
|
||
| if not IsNullGuid(Rec."Password Key") then | ||
| Password := '***'; | ||
|
|
||
| if not IsNullGuid(Rec."Certificate Password Key") then | ||
| CertificatePassword := '***'; | ||
| end; | ||
|
|
||
| local procedure UpdateAuthTypeVisibility() | ||
| begin | ||
| PasswordVisible := Rec."Authentication Type" = Enum::"Ext. SFTP Auth Type"::Password; | ||
| CertificateVisible := Rec."Authentication Type" = Enum::"Ext. SFTP Auth Type"::Certificate; | ||
|
|
||
|
|
||
| if CertificateVisible then | ||
| UpdateCertificateStatus(); | ||
| end; | ||
|
|
||
| local procedure UpdateCertificateStatus() | ||
| var | ||
| NoCertificateLbl: Label 'No certificate (click to upload)'; | ||
| CertificateUploadedLbl: Label 'Certificate uploaded (click to change)'; | ||
| begin | ||
| if IsNullGuid(Rec."Certificate Key") then | ||
| CertificateStatusText := NoCertificateLbl | ||
| else | ||
| CertificateStatusText := CertificateUploadedLbl; | ||
| end; | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.