Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
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;
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 src/Apps/W1/External File Storage - SFTP Connector/App/app.json
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"
]
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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;
}
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;
}
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;
}
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";
}
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";
}
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;
}
Loading
Loading