Project

General

Profile

Actions

User story #9232

closed

User story #9211: Add Directive field with a graphical File Explorer for shared files

Add an API to list shared files properties

Added by François ARMAND about 8 years ago. Updated about 8 years ago.

Status:
Released
Priority:
2
Category:
Web - Config management
Target version:
UX impact:
Suggestion strength:
User visibility:
Effort required:
Name check:
Fix check:
Regression:

Description

For #9211, we need an API that matches angular-filemanger expectation as described here: https://github.com/joni2back/angular-filemanager/blob/master/API.md

The API should be internal, because there is no reason to expose shared-file content until we are able to also modify things in it (i.e until we are able to also upload new shared files). And most likelly, we won't want to have the output required by angular-filemanager, which is not compatible with our format.

So, we have one endpoint: /secure/api/sharedfile

Everything is in POST (yes, yes).

It must accept:

POST /secure/api/sharedfile

{
    "action": "list",
    "path": "/some/path/relative/to/base/directory" 
}

Returns:

{ "result": [ 
    {
        "name": "magento",
        "rights": "drwxr-xr-x",
        "size": "4096",
        "date": "2016-03-03 15:31:40",
        "type": "dir" 
    }, {
        "name": "index.php",
        "rights": "-rw-r--r--",
        "size": "549923",
        "date": "2016-03-03 15:31:40",
        "type": "file" 
    }
]}

It may accepts getting file content:

POST /secure/api/sharedfile
{
    "action": "getContent",
    "item": "/public_html/index.php" 
}

{ "result": "the content of the file" }

Note that for that last method, there is certainly caution to take regarding binary files.

There is an other method for file download:

Download / Preview file (URL: fileManagerConfig.downloadMultipleUrl, Method: GET)

Http query params

[fileManagerConfig.downloadFileUrl]?action=download&path=/public_html/image.jpg

I propose: 

GET /secure/api/sharedfile/download?action=download&path/public_html/impage.jpg

Response

-File content

All other methods must return an error "not supported" (it can also be configured client side). And all error must return a "error 500" status.

{ "result": {
    "success": false,
    "error": "Action not supported" 
}}
Actions #1

Updated by François ARMAND about 8 years ago

  • Description updated (diff)
Actions #2

Updated by François ARMAND about 8 years ago

  • Description updated (diff)
Actions #3

Updated by Vincent MEMBRÉ about 8 years ago

Maybe we can prevent opening file with size > xxx

Are we able to determine if a file is a binary file or a text file easily ?

If i sum up:

all request takes a path as parameters

2 Post requests:

all files => action : list
get a file content => action : getContent

1 get request:

dowload => action=download

Actions #4

Updated by Vincent MEMBRÉ about 8 years ago

  • Status changed from New to In progress
  • Assignee set to Vincent MEMBRÉ
Actions #9

Updated by Vincent MEMBRÉ about 8 years ago

  • Status changed from In progress to Pending technical review
  • Assignee changed from Vincent MEMBRÉ to François ARMAND
  • Pull Request set to https://github.com/Normation/rudder/pull/1256
Actions #10

Updated by Vincent MEMBRÉ about 8 years ago

  • Status changed from Pending technical review to Pending release
  • % Done changed from 0 to 100
Actions #11

Updated by Benoît PECCATTE about 8 years ago

  • Target version changed from 4.0.0~rc2 to 318
Actions #12

Updated by Vincent MEMBRÉ about 8 years ago

  • Target version changed from 318 to 4.0.0~rc2
Actions #13

Updated by Vincent MEMBRÉ about 8 years ago

  • Target version changed from 4.0.0~rc2 to 4.0.0~rc1
Actions #14

Updated by Alexis Mousset about 8 years ago

  • Status changed from Pending release to Released

This bug has been fixed in Rudder 4.0.0 which was released the 10th November 2016.

Actions

Also available in: Atom PDF