How exactly would Droogle be used for an organization, and can it be? Instead of a per user per group basis, it would be nice to tie it in with a google apps domain and the domain users for SSO, Docs integration, etc.

Comments

barnettech’s picture

Status: Active » Needs review

Sorry I'm not following you. Each group can be assigned a google user account and it can be a user from a google apps domain -- this is how we're using it actually. And what is SSO? Single sign on? If you are looking for single sign on you need to do your own backend work for this. I provided the apis in the appsapis.inc file and we are using these apis to create users dynamically and assign users dynamically as we create groups in an automated way. Droogle is just the front end, the apis provided let you do quite a few things if you are a programmer.

I do consulting work on the side if your company is interested or I can just try my best to answer any questions you have here in the forums.

TravisJohnston’s picture

Thanks for the help,

I have been having a hard time finding just the right module, and the right documentation to get me started since this is the first Google Integration that I have ever done.

I can see how Droogle should work great for the docs end of it and I am still working out the kinks with that, as you saw in my other post.

The SSO is not entirely needed, more so I was talking about something like Grupal which allows you to tie in your Google Apps users into Drupal, so they all have accounts right off instead of individually creating them, and it syncs with Apps if a user is deleted, changed, etc. Though it worries me how Grupal hasn't been touched since 2009...

I saw your APIs doc, thank you for that, but simply changing the username@email.com and password, as well as domain, doesn't make them work, So I am looking for how to work that out as well. I know I am probably missing a "duh" step, but haven't found it yet.

barnettech’s picture

Yes we are using the apis I created in appsapis.inc to automatically add users to google apps. I just checked the appsapis does include code to add and delete users.

https://developers.google.com/google-apps/provisioning/
If you want to use Droogles apis to learn to create your own.

Here is some of my own sample code that works with my apis.

NOTE: for droogle_retrieve_user the username and password are hard coded so you would need to change the lines:

 function droogle_retrieve_user($username) {
  $client = Zend_Gdata_ClientLogin::getHttpClient('username@domain.edu', 'password', Zend_Gdata_Gapps::AUTH_SERVICE_NAME);
 

* replace username@domain.edu and password with the google apps username and password of an admin enabled account.

<?php
include 'appsapis.inc';

/*THESE FIRST FEW TESTS TEST INTERRACTING WITH GOOGLE DOCUMENTS
*THE file appsapis.inc has the functions being called here and the exceptions should be made to write to a log file or database to log the exceptions
*USAGE:  TO use this test file just uncomment the lines you would like to test and from the command line type php google_tests.php
*/


//droogle_add_permission() below worked on 10/5/11
//droogle_add_permission();

//droogle_create_collection() test below worked on 10/5/11
//$result = droogle_create_collection('happy_folder3');
//echo $result;

//droogle_add_to_collection test below worked on 10/5/11
//$result = droogle_add_to_collection('0B-a-StXYm5kcNDEwZGQ2ZWItZGY2YS00YTk0LWIxYTUtMGJhZGRjNjU1NDA3','14arxRyvD7-fWyMNsLr7-nWUYL66GFZqib_4ba83b-zs');
//echo $result;

//droogle_get_a_collection_id() to get a list of user's collections
//Test worked on 10/26/2011, returns a google collection id (string)
//$result = droogle_get_a_collection_id('2011Fall-EPS7517-B71@babson.edu','bl@hbl@h','2011Fall-EPS7517-B71');
//echo $result;

//droogle_print_collection2('2011Fall-EPS7517-B71@babson.edu','password');

/*USER TESTS ARE BELOW*/


//http://framework.zend.com/manual/en/zend.gdata.gapps.html for info on interracting with users
//worked on 10/18/2011
//retuns an associative array of basic user information if successful or 
//"Caught exception: ERROR: The user object has no data" if the user object does not get set successfully
//this is the best function to run to just test connectivity to google
$result = droogle_retrieve_user('testusername');
print_r($result);  //to view what's in the array

//worked on 10/18/2011
//result is a boolean and returns true if it works, returns an exception message if false
//$result = droogle_change_password('jbttest','jbtest123456');
//if($result){echo 'password was changed';}else{echo 'there was an error '.$result;}


//worked on 10/18/2011
//result is a boolean and returns true if successful otherwise an exception message is thrown
//$result = droogle_create_user('jbtest', 'testfirstname', 'testlastname', 'jbtest212345');
//if($result){echo 'User was created successfully';}else{echo 'there was an error '.$result;}

//worked on 10/18/2011
//result is a boolean and returns true if it works, and returns an exception message if false
//$result = droogle_delete_user('jbtest');
//if($result){echo 'User was deleted successfully';}else{echo 'there was an error '.$result;}




?>

just comment and uncomment the lines appropriately to run whatever code you want in this file.

TravisJohnston’s picture

Thanks James,

I will try this out later today. So do I need to hardcode each user I want to pull in or just the admin account for the domain and then I'm good to go to pull in all users and create, delete, etc.?

barnettech’s picture

yeah for those functions like adding users, retrieving user info, or deleting users just hard code your admin account details one time and you will be good to go. At some point I'll update the apis to pass in this information as a variable so it's more intuitive.

TravisJohnston’s picture

Hello James,

Thanks for the help, again i'll check this out later.

If you do go through with making it a variable, I would suggest doing it through the database for security reasons, since admins may be reluctant to place the domain password in plain text in the file. Perhaps adding another section to the admin/settings/droogle page would work out.

TravisJohnston’s picture

Alright, so I got to this point before, where I filled in the apis doc with my information, though I guess I am missing the in-between step to make it work though. You provided some code above, though what is that file from? Are you making a separate module or anything that access the api and make it "come to life" sort of speak?

barnettech’s picture

it is just a file I use to test my apis from the command line. It is sample code. put the code in filename.php and then run the file with php filename.php Made sure the file is in the root of the module or the line include 'appsapis.inc'; will not work ... or you can just change the path to be correct relative to where you decide to put your file.

TravisJohnston’s picture

Thanks James, I will test the api changes I made later on.

Though just testing them will not make them work in Drupal, there must be another step needed in order to connect Google with Drupal Users. The api doesn't appear to do that out-of-box, or at least it isn't doing it for me. But perhaps thats where https://developers.google.com/google-apps/provisioning/ comes into play?

barnettech’s picture

Yeah you have to click a button logged into the google admin interface and enable the api, then make sure the api user you connect as has admin privileges.

TravisJohnston’s picture

Thanks James, you've been a huge help so far and I can't wait to get this working, hopefully the server I am working with will be available tonight so I can try this out.