I am working on Document Management System in ASP.NET using C#. I store all folders and files on a windows server and save folder and file info in SQL database as well. Everytime, I create a folder or file on server, I append the name with unique id from database. Example: contact~432cace7-a39c-4db5-a38f-9efe5d289bbf.pdf
Now we have different users who have access to same folders and need a way to delete and download based on their access.
Example: I have 2 users, user-1 and user-2. I have a folder-1 which contains 2 files. file-1 is uploaded by user-1 and file-2 by user-2. Now when user-1 views the file in browser page, I show folder-1 and within that file-1 based on database query. But if user one selects folder-1 for download, it will go to the windows server and download both file-1 and file-2 as physically they are within same folder on server. Same is the case with delete too.
How can I handle this scenario?
Basically, handling in SQL is much easy with relational database but I am thinking how can this be done on windows server efficiently?
My Idea: Call a DB stored proc that returns list of ids and based on that generate the download zip or delete. But since there can be nesting of folder and files, how efficient will this be in performance?