Changeset 784 for trunk


Ignore:
Timestamp:
Oct 7, 2016, 12:03:13 AM (8 years ago)
Author:
autocommit@…
Message:

cambio a la creacion para tener los subdominios como grupos secundarios

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/alternc/patches/class/m_mail_egw.php

    r783 r784  
    9393
    9494
    95         // armamos el commando a executar en el cli de egw
    96         $admincli= $L_EGW_ADMINCLI;
    97         $command= "--edit-user";              // Command to be performed
    98         $adminuser= $L_EGW_ADMINUSER;
    99         $adminclave= $L_EGW_ADMINCLAVE;
    100         //$adminclave= "*******";
    101 
    102         $firstname = $mail;                     // the left side of the email
    103         $lastname= "-";                         // we have a generic lastname
    104         $pass= "*****"; //TEMPORARY
    105         $email = $account = $mail ."@" .$domain; // account and email are the same
    106         $expires= "never";
    107         $canchangepw= "yes";
    108         $anonuser= "no";
    109 //      $primarygroup = $domain[$size-3];   // domains in .ar starts at the third level
    110         $primarygroup= "cta"; //TEMPORARY
    111 //      $secondarygroup = $domain[$size-4]; // sub-domain is used as a secondary group
    112         $homedir = "/home/". $mail ."_" .$domain; // everyone can have a home   
    113         $loginshell = "/bin/bash";                // everyone can have a shell
    114 
    115         $go= $admincli ." " .$command ." " .$adminuser ."," .$adminclave .",\"" .$account ."\"," .$firstname ."," .$lastname ."," .$pass .",\"" .$email ."\"," .$expires ."," .$canchangepw ."," .$anonuser ."," .$primarygroup ;
     95        $dominio = explode('.',$domain);
     96        $size = count($dominio);
     97        if (  $size >= 3 &&
     98                $dominio[$size-2] == "org" &&
     99                $dominio[$size-1] == "ar" ) {
     100
     101                // armamos el commando a executar en el cli de egw
     102                $admincli= $L_EGW_ADMINCLI;
     103                $command= "--edit-user";              // Command to be performed
     104                $adminuser= $L_EGW_ADMINUSER;
     105                $adminclave= $L_EGW_ADMINCLAVE;
     106                //$adminclave= "*******";
     107
     108                $firstname = $mail;                     // the left side of the email
     109                $lastname= "-";                         // we have a generic lastname
     110                $pass= "*****"; //TEMPORARY
     111                $email = $account = $mail ."@" .$domain; // account and email are the same
     112                $expires= "never";
     113                $canchangepw= "yes";
     114                $anonuser= "no";
     115                $primarygroup = $dominio[$size-3];   // domains in .ar starts at the third level
     116                //$primarygroup= "cta"; //TEMPORARY
     117                $secondarygroup = $dominio[$size-4]; // sub-domain as a secondary group
     118                //$secondarygroup= "cta"; //TEMPORARY
     119                $homedir = "/home/". $mail ."_" .$domain; // everyone can have a home   
     120                $loginshell = "/bin/bash";                // everyone can have a shell
     121
     122                $go= $admincli ." " .$command ." " .$adminuser ."," .$adminclave .",\"" .$account ."\"," .$firstname ."," .$lastname ."," .$pass .",\"" .$email ."\"," .$expires ."," .$canchangepw ."," .$anonuser ."," .$primarygroup ;
    116123       
    117         $go= $go ."," .$homedir ."," .$loginshell ;
    118 
    119         echo "<h3>Creamos la cuenta en la base ldap</h3>";
     124                if (isset($secondarygroup)) {
     125                $go= $go ."," .$secondarygroup ;
     126                }
     127
     128                $go= $go ."," .$homedir ."," .$loginshell ;
     129
     130                echo "<h3>Creamos la cuenta en la base ldap</h3>";
    120131//      echo "<h4>$go</h4>"; // LA CLAVE SALE... ACA
    121132
    122                         $cod = exec($go);
    123                         if ($cod)
    124                         {
    125                          // die ($cod);
    126                          echo "<p class=\"error\">";
    127                          echo $cod;
    128                          echo "</p>";
    129                          //$res = false;
    130                         }       
     133                exec($go,$output);
     134                $cod=$output;
     135                if ($cod)
     136                   {
     137                   // die ($cod);
     138                  echo "<p class=\"alert alert-danger\">";
     139                  //echo $cod;
     140                  print_r ($cod);
     141                  echo "</p>";
     142                  //$res = false;
     143                 }
     144        }
    131145
    132146        // mandamos el codigo de error en /var/log/alternc/bureau.log
    133147        $err->log("mail_egw", "create", $cod);
    134 
    135148
    136149        // para no morir aca...
    137150        return $res;
    138151        }       
    139 //////
     152
    140153        function _del_egw_account($mail_id) {
    141154        global $err, $db, $hooks, $L_EGW_ADMINCLI, $L_EGW_ADMINUSER, $L_EGW_ADMINCLAVE;
Note: See TracChangeset for help on using the changeset viewer.