Backdoor for creating new users

zelf

Joined: 2005-03-07
Posts: 37
Posted: Wed, 2005-03-16 01:30

I'm looking for a how to on setting up a backdoor to creating new user accounts other than having to login as an admin in gallery.

Reason: Gallery is just part of the access that my users gain when they sign up for an account on my site. Currently, using cURL an email account is automatically created during signup and I would like to use cURL to also create a gallery account during the initial sign up process that would be totally transparent to the end user without even having to go to my Gallery site.

How can I create a backdoor to Gallery? Now that it is database driven I suppose I could just write a script to dump data into gallery's user database, but I would like to use Gallery's User Module that automatically creates a new album for the user and sets permissions when the new user is created.

Simple? I just need some way to access Gallery's existing user creation functions without having to login as an admin.
----

Gallery version: Dark Fibre
PHP version (eg 4.2.1): 4.3.10

 
bharat
bharat's picture

Joined: 2002-05-21
Posts: 7994
Posted: Wed, 2005-03-16 06:37

We will eventually have an XML API that will let you do this. But in the meantime, you can use our embedded API (read docs/EMBEDDING) to get access to an API so that you can create your own user accounts...

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Wed, 2005-03-16 06:46
 
zelf

Joined: 2005-03-07
Posts: 37
Posted: Wed, 2005-03-16 17:15
bharat wrote:
We will eventually have an XML API that will let you do this. But in the meantime, you can use our embedded API (read docs/EMBEDDING) to get access to an API so that you can create your own user accounts...

Actually, gallery will be standalone. The actual gallery site is on a completely different server than my main site, so sessions will not be shared between servers.

Can I still use embedding in this scenario and just call GalleryEmbed::createUser(), ::updateUser() and ::deleteUser()?

I just need some way to pass $_POST data from my main app on server A to gallery's create user, update user, delete user functions on server B.

This doesn't seem possible with embedding on a different server. Correct me if I am wrong, but could I develop my own create, update, delete user functions to deal with mysql directly and not have to go through G2 functions?

 
mindless
mindless's picture

Joined: 2004-01-04
Posts: 8601
Posted: Wed, 2005-03-16 17:43

you can use interaction mode #2 described at the top of embed.php
if you need to access from another server you can make your own php file on server B that uses GalleryEmbed.. you'll have to handle authentication to use that php file though..

 
bharat
bharat's picture

Joined: 2002-05-21
Posts: 7994
Posted: Wed, 2005-03-16 18:47

You can create your own functions to deal with the MySQL directly, but be aware that G2 is a complex system and if you bypass our APIs then things may not function as you expect (and we can't provide much support if things go wrong).

 
zelf

Joined: 2005-03-07
Posts: 37
Posted: Wed, 2005-03-16 20:03
mindless wrote:
you can use interaction mode #2 described at the top of embed.php
if you need to access from another server you can make your own php file on server B that uses GalleryEmbed.. you'll have to handle authentication to use that php file though..

bharat wrote:
You can create your own functions to deal with the MySQL directly, but be aware that G2 is a complex system and if you bypass our APIs then things may not function as you expect (and we can't provide much support if things go wrong).

First of all thanks for the replies. The work you do is amazing. I am not looking to bypass G2's APIs at all because I do realize that there is a lot going on when creating a user.

So if I understand mindless correctly I have a form on server A, which is my main app, that collects for Gallery the:
Username
Full Name
Email Address
Language
Password
Verify Password

And sends it to server B where I have a embed.php file that gathers the form data and creates a new user using the embed interaction mode, which I assume still lets Gallery run as a standalone?

I am totally lost when it comes to the interaction mode? I'm referring to the examples for embedding into other applications, but I don't see any examples for interaction mode. I'm sure I am making this more difficult than it is. Please provide me with a conceptual example of sending data from server A to server B's Gallery in interactive mode.

Thanks for all your help. Also, I just donated to the gallery. Really appreciate your work.

 
mindless
mindless's picture

Joined: 2004-01-04
Posts: 8601
Posted: Wed, 2005-03-16 21:46

look for "Three interaction modes" in embed.php.. you'll want the 2nd one. it just tells you to call init() first and done() last..