Using gallery's user authentication in a custom app?

falz

Joined: 2002-08-17
Posts: 12
Posted: Wed, 2003-11-26 21:23

I searched over the forum, and was unable to find what I was looking for. I see a few tutorials on swapping out gallery's auth system with another, but what I would like to do is to tap into it. I haven't studied the gallery code and whatever functions do this, but if I have to I will.

What I'm looking to do is set up a single gallery which is going to be used by one person. I would like to use the login/session/cookie from gallery to allow them to another part of the site that simply lets them edit a few text boxes and such. Is there just a simple funciton that may be called to ensure the user is authenticated, before allowing them to do 'foo' (ie, submit form X)?

It sounds imple enough, but I want to make sure I have the auth correct so it's not easily backdoored.

Thanks!

--falz

 
marshal4him

Joined: 2002-10-01
Posts: 14
Posted: Fri, 2004-04-16 20:26

I am needing the same thing. I want to be able for admins to the gallery also be admins to the calendar I have set up. A reply (and/or solution) would be greatly appreciated!! :D

-MP

 
marshal4him

Joined: 2002-10-01
Posts: 14
Posted: Mon, 2004-04-19 15:43

*bump*

 
marshal4him

Joined: 2002-10-01
Posts: 14
Posted: Fri, 2004-04-30 21:11

I really need a solution to this. If anyone could poiny me in the right direction, i would appreciate it.

 
boss

Joined: 2003-05-28
Posts: 26
Posted: Sat, 2004-05-01 22:54

I also want to combine the login system of my app with gallery's. I'm not using PHP, which might make it a little more complicated? I don't want people to have to log in twice, so I want to either have my app access the login info of gallery, or the other way round.

Because G1 lacks groups, this isn't as important/urgent as it will be when G2 is no longer pre-alpha: I cannot create many new users and then painstakingly give them access to all the albums they should be able to access, so I have one user for gallery, which I give access to to many people. For my app, they log in each into their own user though, so two login systems are fine for now. (Or ... might it be possible that if they log in to my app, that my app could then automatically log them into gallery as whatever user they should be using, thereby simulating a kind of "group"? That might be very useful.) In either case, this question also applies to G2, probably more so.

Thanks!

 
marshal4him

Joined: 2002-10-01
Posts: 14
Posted: Tue, 2004-05-11 08:01

I am totally freaking out. I was looking at the albums.php file and found out how to do some simple authentication for what I need! Here we go:

<?php
require(dirname(__FILE__) . '/gallery/init.php');

if ($gallery->user->isLoggedIn()) {
	$displayName = $gallery->user->getFullname();
	if (empty($displayName)) {
		$displayName = $gallery->user->getUsername();
	}
	$adminCommands .= sprintf(_("Welcome, %s"), $displayName) . "&amp;&amp;<br>";
	print $adminCommands;
}

else {
  print "you are not logged in!";
}
?>
<?
if ($gallery->user->isAdmin()) {
  print "hello admin!";

	}
	?>

You can show things if they are just plain users that are logged in, or for admin users...etc you get the idea. BTW, I am using version v1.4.3-RC3