Login or Register

RSS IconRecent posts in this topic

avatar
Ilija Studen on Nov 28. 2007. 8:32 am
Hi Casper,

Have you checked out Overriding / Extending activeCollab Authentication knowledge base entry? In code examples you have a peace that create a new user in activeCollab database. It works - tested.
activeCollab team member
avatar
Valdemar on Nov 28. 2007. 8:37 am
I completely missed that part :) Guess I need glasses. Looks the same as what I've already tried, after looking in UserProfileController.class.php. I created the User object fine, but then tried doing a ->save(), but nothing was written to the db, not even an error. I'll look into it when I get the time.
Casper Valdemar
avatar
Ilija Studen on Nov 28. 2007. 8:45 am
We added that article just recently.

As a side note: save() method returns true if everything went fine or an Error instance in case of error with all the details - error message, parameters, where it was thrown etc.
activeCollab team member
avatar
Valdemar on Nov 28. 2007. 10:26 am
I got the error message: "Failed to create an account. Reason: Failed to validate model properties" with my $user_data array for some odd reason - I couldn't figure out why. However, by doing it exactly as you did, it works!

It now automatically creates new users, assigns them to a company and gives them a role. Excellent.

Get it here: http://fatty.dk/acadauthprovider.zip

Thanks.
Casper Valdemar
avatar
phodgdon on Dec 4. 2007. 8:38 pm
Casper - I was able to use the adLDAP library and get it so i can authenticate off Active Directory using the example, how did you then incorporate that into the authentication for activeCollab? Did you use the method that Ilija mentioned in his documentation?
avatar
phodgdon on Dec 4. 2007. 8:39 pm
Nevermind, I see your zip file. Thanks.
avatar
colin.hostert on Dec 20. 2007. 12:22 am
Has anyone had any success getting this to work against an openLDAP directory ?
avatar
RobDaPraia on Dec 30. 2007. 1:11 pm
Thanks for the explanation, was looking for this to SSO into ActiveCollab.

I just did the following on my Apache web server where authentication is done by the Apache web server and the user name is stored as a server variable "PHP_AUTH_USER". Since this PHP_AUTH_USER is a user name and not an id, I had to add an extra field to the acx_users table: acx_users.username varchar 10, not null and to hack the file Users.class.php to create a function to search for the user by username.

Users.class.php:

/* Hacked by Rob */
/* Extra function for SSO after authentication by Apache
this requires extra field in table acx_users.username varchar 10, not null

/**
* Return user by username
*
* @param string $username
* @return User
*/
function findByUserName($username) {
return Users::find(array(
'conditions' => 'username = ' . db_escape($username),
'one' => true,
));
} // findByUserName


/* End of Hacked by Rob */


For authentication I made the following class, based on the article in the knowledge base:

<?php


class ApacheAuthenticationProvider extends AuthenticationProvider {

function initialize() {

$user = Users::findByUserName($_SERVER['PHP_AUTH_USER']);

if(instance_of($user, 'User')) {
return $this->logUserIn($user);
} else {
return new Error('User not recognized');
} // if
} // initialize

}

?>



RSS IconRecent posts in this topic