Skip to content
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

New System App Module for easy file systems access #663

Open
wants to merge 58 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 32 commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
3d52a6a
Move to BCApps
IceOnly Feb 29, 2024
62b73a7
Upgrade to BC24
IceOnly Feb 29, 2024
c0276ff
Add Interface changes
IceOnly Mar 1, 2024
7945909
Fix Account Browser
IceOnly Mar 1, 2024
692b8b7
Change application are to new logic
IceOnly Mar 1, 2024
1277528
Fix first batch of code review suggestions
IceOnly Mar 1, 2024
ca7455a
Add File Pagination Facade
IceOnly Mar 1, 2024
ae719dd
Reduce code in file browser page
IceOnly Mar 1, 2024
8d8eee9
Use only test lib for internal access
IceOnly Mar 1, 2024
4258a0b
Fix variable names
IceOnly Mar 1, 2024
30a0622
Add review suggestions
IceOnly Apr 10, 2024
5b3228a
Solve name and id conflicts
IceOnly Apr 10, 2024
0cfd765
Fix test
IceOnly Apr 10, 2024
0327220
Fix application areas
IceOnly Jun 10, 2024
0ec94d8
Remove unused label
IceOnly Jun 10, 2024
6f742e4
Simplify integer incrementation
IceOnly Jun 10, 2024
33afd83
Sort variables
IceOnly Jun 10, 2024
f701d9f
Add Init to AddEntry
IceOnly Jun 10, 2024
c3cd8b5
Change tooltip to code review suggestion
IceOnly Jun 10, 2024
a53d936
Solve code review comments
IceOnly Aug 23, 2024
e6bf344
Solve code review suggestions 2
IceOnly Aug 23, 2024
e077767
Use labels for telemetry
IceOnly Aug 23, 2024
f1c251a
Fix code review suggestions
IceOnly Aug 26, 2024
73ed292
Remove useless internal attributes
IceOnly Aug 27, 2024
017b7d0
Refactored to media only
IceOnly Aug 30, 2024
4e5968e
Fix tooltips
IceOnly Sep 17, 2024
5fd8fc8
Revert GetIsLegacyActionBarEnabled change
IceOnly Sep 17, 2024
ecf81b5
Renumber Test Lib
IceOnly Sep 19, 2024
0746146
Bump version and platform to 26.0.0.0 in app.json files
IceOnly Nov 15, 2024
ca63fcf
Bump version and platform to 26.0.0.0 in app.json
IceOnly Nov 15, 2024
997988d
Merge branch 'main' of https://github.com/IceOnly/BCApps into module/…
IceOnly Nov 15, 2024
c3f3b99
Bump version and platform to 26.0.0.0 in app.json for File System module
IceOnly Nov 15, 2024
63452f1
Small Fixes
StefanSosic Nov 16, 2024
93edfcf
Usings sort
StefanSosic Nov 16, 2024
33b84fb
Brief in app.json
StefanSosic Nov 16, 2024
49c0b7b
README
StefanSosic Nov 16, 2024
63e15eb
Description
StefanSosic Nov 16, 2024
7977397
Fixing english
StefanSosic Nov 16, 2024
d368497
Fix tests
StefanSosic Nov 16, 2024
55265be
Fix
StefanSosic Nov 16, 2024
ed3b042
Fix
StefanSosic Nov 16, 2024
252a4b5
Improvements
StefanSosic Nov 16, 2024
12de1df
Merge pull request #1 from StefanSosic/dev/sso/moduleFileSytem
IceOnly Nov 16, 2024
b3bb20d
Revert renaming of codeunit "File Scenario"
IceOnly Nov 16, 2024
ba7e6e8
Add review suggestions from StefanSosic
IceOnly Nov 16, 2024
f71d12f
Fix execution permission
IceOnly Nov 21, 2024
b507a1e
Fix namespace
IceOnly Nov 22, 2024
60a7043
Fix id range
IceOnly Nov 22, 2024
7685987
Add AddNewAccountTest, media fields seems to make trouble
IceOnly Nov 26, 2024
83ec1ff
Fix codereview suggestions from StefanMaron
IceOnly Dec 12, 2024
3f59121
Fix spelling errors in group names and enum references across multipl…
IceOnly Dec 12, 2024
eb1c518
Update src/System Application/App/File System/src/Account/FileAccount…
IceOnly Dec 15, 2024
d81716b
Update src/System Application/App/File System/src/Account/FileAccount…
IceOnly Dec 15, 2024
8f5fc54
Rename FileAccountBrowser to StorageBrowser and update related refere…
IceOnly Dec 15, 2024
3f8fff0
Update src/System Application/App/File System/src/Account/FileAccount…
IceOnly Dec 17, 2024
82fe7b9
Refactor permission set and update label names for clarity; streamlin…
IceOnly Dec 17, 2024
b7f7503
Rename File System to External File Storage and update related descri…
IceOnly Dec 17, 2024
449f813
Rename File System to External File Storage and update related namesp…
IceOnly Dec 17, 2024
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: 6 additions & 0 deletions src/System Application/App/File System/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Provides an API that lets you connect file system accounts to Business Central so that people can access files outside BC. The file system module consists of the following main entities:

### File Account
An file account holds the information needed to access a file system from Business Central.

...
70 changes: 70 additions & 0 deletions src/System Application/App/File System/app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
{
"id": "c9c54414-80c3-4cc9-98c6-589158882774",
"name": "File System",
Copy link
Contributor

@JesperSchulz JesperSchulz Dec 15, 2024

Choose a reason for hiding this comment

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

I'm still not sure about the module name. It's not a file system. It's a way to use different cloud file service providers through a unified API. Maybe we should ask Copilot for fitting name ;-)

Copy link
Author

Choose a reason for hiding this comment

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

What do you think of File Service or File Storage Service?

Copy link
Contributor

Choose a reason for hiding this comment

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

I do like the ring of File Storage Service, but in reality it's not a service. It's a framework to leverage services. The module itself doesn't connect to any service itself. It helps you organize your file services. It's too early to be creative, but I'll get back to you later with a suggested name or two 😊

But maybe you're on to something. Also considering how you right now would call the module:

FileSystem.Initialize(Enum::"File Scenario"::"Order Confirmation");
FilePath := FileSystem.CombinePath(FSSetup."Folder to Store", StrSubstNo(PDFNameLbl, SalesHeader."No."));       
if not FileSystem.FileExists(FilePath) then
    FileSystem.CreateFile(FilePath, Stream);

It kind of makes sense to call it FileStorageService! Maybe I'll come around 😊

Copy link
Contributor

@JesperSchulz JesperSchulz Dec 17, 2024

Choose a reason for hiding this comment

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

I discussed the name with @darjoo, who suggested to maybe just call the module File Storage. To me that would make sense, as this isn't a file system nor service, but it's an API to access storage systems. The code would then look like this:

FileStorage.Initialize(Enum::"File Scenario"::"Order Confirmation");
if not FileStorage.FileExists(FilePath) then
    FileStorage.CreateFile(FilePath, Stream);

I like that! What do you think, @IceOnly?

I had one more thought though: the storage systems you add here are not BC native and are hence not part of our backup strategy. These are customer owned and maintained storages. I was thinking maybe to make that very clear already in the naming of the module. So, maybe we could call it "External File Storage"?

Darrick, IceOnly, how do you like that idea?

Copy link
Author

Choose a reason for hiding this comment

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

I would prefer FileStorage. If there is a native BC solution such as One Drive or something similar in the future, it can also provide an interface.

But in the end you are the ones responsible for the product. Just give me a module name and a namespace and I'll rename everything.

Copy link
Contributor

Choose a reason for hiding this comment

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

When we add a native storage service, it will go through the platform in one way or another. I'd like to be explicit here, that this module is for external providers. Let's go with "External File Storage".

Copy link
Author

Choose a reason for hiding this comment

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

In some cases, 30 characters were simply not enough.
I tried Ext. as preifx if > 30 characters. But even that wasn't always possible, I hope it fits thanks to the namespace.

"publisher": "Microsoft",
"brief": "Enables access to external file systems from Business Central.",
"description": "Enables access to external file systems from Business Central.",
"version": "26.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=2103698",
"url": "https://go.microsoft.com/fwlink/?linkid=724011",
"logo": "",
"dependencies": [
{
"id": "7e3b999e-1182-45d2-8b82-d5127ddba9b2",
"name": "DotNet Aliases",
"publisher": "Microsoft",
"version": "26.0.0.0"
},
{
"id": "872fe7e8-9893-40ae-ab94-c123ed30fdbd",
"name": "Extension Management",
"publisher": "Microsoft",
"version": "26.0.0.0"
},
{
"id": "de35f591-7216-4e60-8be1-1911d71a7fc2",
"name": "Telemetry",
"publisher": "Microsoft",
"version": "26.0.0.0"
},
{
"id": "0846d207-5dec-4c1b-afd8-6a25e1e14b9d",
"name": "Base64 Convert",
"publisher": "Microsoft",
"version": "26.0.0.0"
},
{
"id": "a4584a53-9345-458a-af20-d1df2fab7bd8",
"name": "Confirm Management",
"publisher": "Microsoft",
"version": "26.0.0.0"
},
{
"id": "e31ad830-3d46-472e-afeb-1d3d35247943",
"name": "BLOB Storage",
"publisher": "Microsoft",
"version": "26.0.0.0"
}
],
"internalsVisibleTo": [
{
"id": "f188754b-3ffb-443a-9507-f5fbdae3af2c",
"name": "File System Test Library",
"publisher": "Microsoft"
}
],
"screenshots": [

],
"platform": "26.0.0.0",
"idRanges": [
{
"from": 9450,
"to": 9459
}
],
"target": "OnPrem",
"contextSensitiveHelpUrl": "https://go.microsoft.com/fwlink/?linkid=2134520"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// ------------------------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
// ------------------------------------------------------------------------------------------------

namespace System.FileSystem;

permissionset 9450 "File System - Admin"
{
Access = Public;
Assignable = true;
Caption = 'File System - Admin';

IncludedPermissionSets = "File System - Edit";

Permissions =
tabledata "File System Connector" = RIMD,
tabledata "File System Connector Logo" = RIMD,
tabledata "File Account Scenario" = RIMD,
tabledata "File Scenario" = RIMD,
tabledata "File Account Content" = RIMD;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// ------------------------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
// ------------------------------------------------------------------------------------------------

namespace System.FileSystem;

using System.Environment;

permissionset 9453 "File System - Edit"
{
Access = Public;
Assignable = false;
Caption = 'File System - Edit';

IncludedPermissionSets = "File System - Read";

Permissions = tabledata "File System Connector Logo" = imd,
tabledata "Tenant Media" = imd;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// ------------------------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
// ------------------------------------------------------------------------------------------------

namespace System.FileSystem;

using System.Environment;

permissionset 9451 "File System - Read"
{
Access = Internal;
Assignable = false;

Permissions =
tabledata "File System Connector" = r,
tabledata "File System Connector Logo" = r,
tabledata "File Account Scenario" = r,
tabledata "File Scenario" = r,
tabledata "File Account Content" = r,
tabledata Media = r; // File System Account Wizard requires this
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
// ------------------------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
// ------------------------------------------------------------------------------------------------

namespace System.FileSystem;

/// <summary>
/// Provides functionality to work with file accounts.
/// </summary>

codeunit 9450 "File Account"
{
Access = Public;
InherentPermissions = X;
InherentEntitlements = X;

/// <summary>
/// Gets all of the file accounts registered in Business Central.
/// </summary>
/// <param name="LoadLogos">Flag, used to determine whether to load the logos for the accounts.</param>
/// <param name="TempFileAccount">Out parameter holding the file accounts.</param>
procedure GetAllAccounts(LoadLogos: Boolean; var TempFileAccount: Record "File Account" temporary)
IceOnly marked this conversation as resolved.
Show resolved Hide resolved
begin
FileAccountImpl.GetAllAccounts(LoadLogos, TempFileAccount);
end;

/// <summary>
/// Gets all of the file accounts registered in Business Central.
/// </summary>
/// <param name="TempFileAccount">Out parameter holding the file accounts.</param>
procedure GetAllAccounts(var TempFileAccount: Record "File Account" temporary)
begin
FileAccountImpl.GetAllAccounts(false, TempFileAccount);
end;

/// <summary>
/// Checks if there is at least one file account registered in Business Central.
/// </summary>
/// <returns>True if there is any account registered in the system, otherwise - false.</returns>
procedure IsAnyAccountRegistered(): Boolean
begin
exit(FileAccountImpl.IsAnyAccountRegistered());
end;

var
FileAccountImpl: Codeunit "File Account Impl.";
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
// ------------------------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
// ------------------------------------------------------------------------------------------------

namespace System.FileSystem;

/// <summary>
/// A common representation of an file account.
/// </summary>
table 9450 "File Account"
{
Extensible = false;
TableType = Temporary;
IceOnly marked this conversation as resolved.
Show resolved Hide resolved

fields
{
field(1; "Account Id"; Guid)
{
DataClassification = SystemMetadata;
IceOnly marked this conversation as resolved.
Show resolved Hide resolved
}

field(2; Name; Text[250])
{
DataClassification = SystemMetadata; // Field only in Memory
IceOnly marked this conversation as resolved.
Show resolved Hide resolved
}

field(4; Connector; Enum "File System Connector")
{
DataClassification = SystemMetadata;
}

field(5; Logo; Media)
{
Access = Internal;
DataClassification = SystemMetadata;
}
}

keys
{
key(PK; "Account Id", Connector)
{
Clustered = true;
}

key(Name; Name)
{
Description = 'Used for sorting';
}
}

fieldgroups
{
fieldgroup(Brick; Logo, Name)
{

}
}

}
Loading
Loading