User story #9232
closedUser story #9211: Add Directive field with a graphical File Explorer for shared files
Add an API to list shared files properties
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" }}
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
Updated by Vincent MEMBRÉ about 8 years ago
- Status changed from New to In progress
- Assignee set to Vincent MEMBRÉ
Updated by Vincent MEMBRÉ about 8 years ago
Work in progess here: https://github.com/VinceMacBuche/rudder/commit/1be78dc8fa20522183eb086b2e4f890a1d633184
Updated by Vincent MEMBRÉ about 8 years ago
Work in progess here: https://github.com/VinceMacBuche/rudder/commit/ae05e3170e49916bbdd290e8fbb7674b0bc52a1e
Updated by Vincent MEMBRÉ about 8 years ago
Work in progess here: https://github.com/VinceMacBuche/rudder/commit/90135db64d79b1ee590058cdedb8d7aed11a4d74
Updated by Vincent MEMBRÉ about 8 years ago
Work in progess here: https://github.com/VinceMacBuche/rudder/commit/7122af6c3f83e08891f01bb46e2a5a9653457a8d
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
Updated by Vincent MEMBRÉ about 8 years ago
- Status changed from Pending technical review to Pending release
- % Done changed from 0 to 100
Applied in changeset rudder|6626333a4ca376a16d312296b7c398f4b4f4a916.
Updated by Benoît PECCATTE about 8 years ago
- Target version changed from 4.0.0~rc2 to 318
Updated by Vincent MEMBRÉ about 8 years ago
- Target version changed from 318 to 4.0.0~rc2
Updated by Vincent MEMBRÉ about 8 years ago
- Target version changed from 4.0.0~rc2 to 4.0.0~rc1
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.