Managing Files in the Storage Area

This document describes how to manage files in the storage area in "classic" mode.

Introduction

For safety reasons, the manipulation of files between the client and the server has to apply the following rules:

  • The user has to manually choose the destination of the file generated on the client when executing an operation.
  • The user cannot choose the destination (on the server) of the file required when executing an operation.
  • The user does not have the rights to browse the server file system to set the destination of the file generated when executing an operation.
  • The user does not have the rights to browse the server file system to choose the file required when executing an operation.

Configuring a Sage X3 storage area

A Sage X3 storage area is a limited area of the server file system that manages user files. It is created by an administrator using the volumes management function:

  • The physical path of a storage area is computed by the server by calling the filpath function with the ROOT parameter set by the administrator.
  • Users should not be able to see the physical path of a storage area. These paths are displayed as logical paths whose syntax is [volume]/file.

Example: If the root property of the TMP storage area of MYFOLDER is set to "tmp", and the installation path of the folder is c:\sage\$$prod\mysolutionX3\MYFOLDER:

  • A volume defined by the ROOT parameter equal to "tmp" will correspond to a storage path equal to c:\sage\$$prod\mysolutionX3\MYFOLDER\tmp on a Windows server.
  • If a file.tmp file is created in this storage area, the file will be displayed with the following path: [tmp]/file.tmp. It will be stored with the following path: c:\sage\$$prod\mysolutionX3\MYFOLDER\tmp\file.tmp.

Selecting a file on the server ("classic" pages)

A dedicated DSYRFICREP window was implemented to select a file in a storage area. It is displayed on the select event of the ASTO type, which was created to manage storage area files.

Users can select a file by using the DSYRFICREP window, or by entering paths. In both cases, the logical path can be controlled by using the CTL_VOLFIL function implemented in the ASYRSTO script.

The CTL_VOLFIL function returns a code which can be used to set the mkstat variable. It can receive the following parameters:

Parameter Description Expected values
CLISRV (in) Type of file

1: client.

2: server.

PATH (in) File logical path Syntax = [volume]/file.
FULLPATH (out) File physical path -
TYPE (in) Type of operation

E_TYPE_FILEREAD: controls that the file exists.

E_TYPE_FILEWRITE: controls that the file can be created.

E_TYPE_FOLDER: controls that the folder exists.

MESSAGE (out) Error message Error message set if the function returns a value greater than 0.

Note: A simple way to adapt a mask to use the storage area is to:

  • Hide the FIC field
  • Add a corresponding ASTO field
  • Use the CTL_VOLFIL function to control the contents of the ASTO field and set the physical path in the FIC field.

Example:

#set the 'enum' values (E_TYPE_FILEREAD...)
Gosub ENUM_VOLFIL_TYPE  From ASYRSTO
# control the logical path set in VALEUR and set the physical path in [M]FICHIER
mkstat = func ASYRSTO.CTL_VOLFIL([M]TYPEXP,VALEUR,[M]FICHIER,E_TYPE_FILEREAD,GMESSAGE)

Downloading a file on the client

Download operations are automatically managed by the ORDSYS COPCLI function. Because the user cannot select the destination of the downloaded file, the ASTO field has to be grayed out.

Uploading a file from the client

Upload operations are automatically managed by the ORDSYS COPSRV function. Because users cannot select the destination, files are uploaded in the TMP storage area, where they are stored as temporary files.

As a consequence, the behavior of the second parameter was changed to return the physical path of the file uploaded on the server. Scripts may have to be slightly changed to prevent users from seeing the physical path. Because the user cannot enter the origin of the field to upload, the ASTO field has to be grayed out.