Login via URL parameters

dgulino

Joined: 2005-07-10
Posts: 2
Posted: Sun, 2005-07-10 20:48

Does anyone know if you can login to Gallery2 via URL parameters?

example:
hppp://test/gallery/gallery2/main.php?username=test

I'm looking into creating virtual gallery sites by creating multiple guest accounts (with no password so no security risk) each in different groups. Then I will create virtual servers or URL rewrite rules that pass this information via a url.

Any ideas?

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Sun, 2005-07-10 21:27

and what do you gain?
what's the user story?

why login a guest user?

 
dgulino

Joined: 2005-07-10
Posts: 2
Posted: Mon, 2005-07-11 21:42

I am trying to create a single gallery instalation that can look like multiple galleries.

By default, unathenticated users are logged in as a guest. They are capable of viewing only public albums.

I could create multiple unuthenticated accounts and add them into different groups, then modify album's rights so only those groups can view them. Then if I can get certain URL to be associated as those guest users, I would be able to simulate seperate albums w/out multiple gallery installations.

Just an idea.

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Mon, 2005-07-11 21:53

a dev already implemented the same idea the same way i guess, don't know why it wasn't committed or what's the status.

 
mindless
mindless's picture

Joined: 2004-01-04
Posts: 8601
Posted: Mon, 2005-07-11 22:56

yes, i did implement pretty much the same thing... i created a new user, setup permissions for what i wanted that "view" to see and then made a wrapper script like this:

<?php
require(dirname(__FILE__) . '/modules/core/classes/GalleryCapabilities.class');
GalleryCapabilities::set('anonymousUserId', 81445);
GalleryCapabilities::set('defaultAlbumId', 297);
GalleryCapabilities::set('cookieSuffix', '_V');
define('GALLERY_MAIN_PHP', basename(__FILE__));
require(dirname(__FILE__) . '/main.php');
?>

Then changed a few key places in the code to use this alternate user as the guest and the given default album. It works pretty well. The problem is there are many places in the code that check for "the" guest user and it isn't always clear how to handle things when there are multiple guests. One big example is fast-download files.. these are completely handled by whether or not "the" guest user has access to an item. Anyway, I think there is some potential to such a setup but it hasn't been fully explored.

A wrapper to simply change the active user and then go through the normal main.php would certainly be easier, but then you'd see a Logout link as you're not "the" guest.