Upload permission
this plugin gives the possibility to protect the file download route which is normally public
Strapi plugin upload-permission
A plugin for Strapi that provides the ability to secure the public route upload/(*)
🚀 Overview
this plugin gives the possibility to protect the file download route which is normally public.
Test : 4.25.1 => ok | 4.3.6 => ok (node18 | node16)
⏳ Installation
With npm:
npm install strapi-upload-permission
With yarn:
yarn add strapi-upload-permission
✨ Getting Started
1// config/plugins.js
2'upload-permission': {
3 enabled: true,
4 config: {
5 "content-manager-visible": { // tab "Content Manager" @optionnal
6 'file': true, // add the file collection
7 'folder': true, // add the folder collection
8 },
9 "content-type-builder": { // tab "Content-Type Builder" @optionnal
10 'file': true, // add the file collection
11 'folder': true, // add the folder collection
12 },
13 "downloadCallback": async (ctx, next) => {
14 // callback from middleware on /upload/(*)
15 // you have a full access like a normal middleware
16 if (ctx.state.user) { // you have the user in ctx.state.user (if token)
17 return await next(); // return this to accept the download
18 }
19 return ctx.unauthorized('You are not allowed to download this file'); // denied
20 }
21 }
22 },
🐛 Bugs
If any bugs are found please report them as a Github Issue
Install now
npm install strapi-upload-permission
Create your own plugin
Check out the available plugin resources that will help you to develop your plugin or provider and get it listed on the marketplace.