Search…

X3 Photo Gallery Support Forums

Search…
 
traxnamibia
Experienced
Topic Author
Posts: 36
Joined: 17 May 2021, 08:16

View without logging in

16 Nov 2021, 02:22

I am not really sure whether this is an Embed question or a Files question, but what I would like to be able to do is this:

1. I would like to have a gallery using Embed, but if I create a user and password, viewing ALSO requires a login.
2. Ideally I would like to protect the folder so that the user can login and upload image content, but the folder should also be viewable by the public.

Or to put it another way, is there a way to only allow a logged in user to upload, but allow the public to view?
 
User avatar
mjau-mjau
X3 Wizard
Posts: 13993
Joined: 30 Sep 2006, 03:37

Re: View without logging in

16 Nov 2021, 06:44

These questions kinda cascade across both apps in different ways. Speaking on behalf of Files app, I am looking forward to work with multi-users login, so that one can assign different permission levels (access, view, filemanager etc). Right now, there is either login or not, and filemanager or not, nothing in between. As a current "workaround" solution, if you want one public view and one filemanager, you can create a subdir /_filesadmin/ and set it's config 'root' to point to parent dir, set login, and enable filemanager options. Basically two url's, one that can view, and one with filemanager permissions.

As for Embed, it will always have to access a Files app WITHOUT login. If login is enabled, all Files app functions are protected, and you wouldn't then be able to use Embed in a public view. What you might be looking for, is a future option 'api_mode'=>true, which would block direct access to the Files app (without enabling username/password), but allowing it to function as API only. If you wanted to achieve this now, you could edit Files app index.php around line 1724, adding exit() function:
Code
// main document
} else {
exit();
The above would keep API as an API, but block direct access to the Files app.

As for combining all the above into a single Files app index.php file, I'm not 100% sure that is logical, although it will be looked into. For now, you can achieve what you want by creating multiple files app dirs with different configurations, pointing them all to the same 'root' path and using the same 'storage_path'.
traxnamibia wrote:1. I would like to have a gallery using Embed, but if I create a user and password, viewing ALSO requires a login.
Yep, so the Files app that Embed uses can't be password-protected, but if you want to block access to this files app via URL, you can use the exit() fix suggested above.
traxnamibia wrote:2. Ideally I would like to protect the folder so that the user can login and upload image content, but the folder should also be viewable by the public.
If you want one public access and one password-protected access with filemanager, you would use the workaround solution above with two files apps, pointing to same 'root'.

On a side-note, if you want it "viewable by the public", then why do you need to set a username/password as in question #1? Or did you mean viewable by the public only through Embed, and editable only with Files app with login? That would be two Files apps with different configs.
traxnamibia wrote:Or to put it another way, is there a way to only allow a logged in user to upload, but allow the public to view?
Two files apps, pointing to the same 'root'.
 
traxnamibia
Experienced
Topic Author
Posts: 36
Joined: 17 May 2021, 08:16

Re: View without logging in

16 Nov 2021, 13:18

That's quite a lot to digest!

I think I get the gist of it - I was actually thinking of using TinyFileManager a while ago as the uploader, but while not perfect, using two instances of the files app will be more elegant.

I'll provide feedback in due course.