API for adding new users remotely

For Installatron Sales: sales@installatron.com
Post Reply
webawere
Posts: 2
Joined: Sat Feb 02, 2008 9:58 am

API for adding new users remotely

Post by webawere » Sat Feb 02, 2008 10:02 am

Hi,

Perhaps I missed it but is there some kind of API available since I want to add access to installatron from my remote administration system.

Regards,
Michel

Rowan
Staff
Posts: 235
Joined: Tue Jun 19, 2007 7:39 am

Re: API for adding new users remotely

Post by Rowan » Sat Feb 02, 2008 6:40 pm

There's no API, it requires one of the supported control panels.

Row.

webawere
Posts: 2
Joined: Sat Feb 02, 2008 9:58 am

Re: API for adding new users remotely

Post by webawere » Fri Feb 15, 2008 4:30 am

But I don't want all my users to access installatron. I add users to DA with an API and I also want to determine that way if they can access Installatron.

Phil
Staff
Posts: 490
Joined: Tue Jun 19, 2007 6:06 am

Re: API for adding new users remotely

Post by Phil » Fri Feb 15, 2008 7:03 am

Hi,

To automatically add new users to an Access Group when they're added to your server, you can use this script:

Code: Select all

<?php

$d = unserialize(file_get_contents("/home/admin/.installatron/.groups"));

foreach ( array_keys($d) as $i )
{
        if ( $d[$i]["label"] === $argv[1] )
        {
                $d[$i]["for"][$argv[2]] = true;
                break;
        }
}

$fp = fopen("/home/admin/.installatron/.groups","w");
flock($fp,2);
fwrite($fp,serialize($d));
fclose($fp);

?>


In that code, /home/admin/.installatron/.groups needs to be the path to your admin's .group data file. For DirectAdmin, the preset value is likely correct.

You can call this script from shell:

Code: Select all

/usr/bin/php -c /usr/local/installatron/etc/php.ini -f
/path/to/addtogroup.php 'group1' 'newuser1'


The above would add the domain or user named newuser1 to the Access Group labeled group1.

Let us know if you have any questions.

Thanks,
Phil
Phillip Stier
Installatron Co-Founder

Post Reply