Protected Directories Question

Matthew B

New member
Joined
Apr 27, 2023
Messages
2
Hello community!

Several pages of my website are password protected and I'm trying to find a more easy way of adding and removing users (a few hundred users are granted and revoked access on a regular basis).

Is there a way to add users to a database within Direct Admin or third party software that has a checkbox feature allowing me to turn access on or off for users easily?

Please bare with me, I'm not a programmer but can work with one if it's necessary.

Many thanks!
Matthew
 
I don't understand your question.
Within Control Panel, there already have some GUI for easy ADD or DELETE users.
1682659215147.png


Still not easily for you ?
What do you want to do ?

if you want to write script to execute some api to add or remove user, you can open the developer tools in a browser and see what's payload execute when add or delete users in DA "Protected Directory" page.

Example: Add users API
URL: /CMD_FILE_MANAGER?json=yes
METHOD: POST
PAYLOAD:{"name":"Memory Area","path":"/domains/mydomain/public_html/need_protect_dir","user":"test2","passwd":"test2","passwd2":"test2","json":"yes","action":"protect","enabled":"yes"}:

Example: Delete users API
URL: /CMD_FILE_MANAGER?json=yes
METHOD: POST
PAYLOAD: {"path":"/domains/mydomain/public_html/need_protect_dir","json":"yes","action":"delete","select0":"test2"}
 
Thank you for your reply!

I have hundreds or users, the GUI is easy if you have few users. Right now I must add usernames and passwords in a text field one at a time. This is a long process, everyday copying and pasting usernames and passwords for my clients.

Currently it is like this:

Screenshot VO-1.jpg


Your solution is maybe good but I am not proficient in programming so I don't know.
I want to add all users to all protected directories in a batch process, then have two checkboxes for ACCESS="yes" or "no"

Something like this:

Screenshot VO.jpg
 
Back
Top