Exemplo n.º 1
0
    require CL_ROOT . "/config/" . CL_CONFIG . "/config.php";
    // Start database connection
    $conn = new PDO("mysql:host={$db_host};dbname={$db_name}", $db_user, $db_pass);
    $user = $_POST['name'];
    $pass = $_POST['pass'];
    // create the first user
    $usr = new user();
    $installChk = $usr->getAllUsers();
    if ($installChk) {
        // There already are users. abort install.
        die("Collabtive seems to be already installed.<br />If this is an error, please clear your database.");
    }
    $usrid = $usr->add($user, "", 0, $pass);
    if (!$usrid) {
        $template->assign("errortext", "Error: Failed to create first user.");
        $template->display("error.tpl");
        die;
    }
    // insert default roles
    $rolesobj = new roles();
    $adminrid = $rolesobj->add("Admin", array("add" => 1, "edit" => 1, "del" => 1, "close" => 1, "view" => 1), array("add" => 1, "edit" => 1, "del" => 1, "close" => 1, "view" => 1), array("add" => 1, "edit" => 1, "del" => 1, "close" => 1, "view" => 1), array("add" => 1, "edit" => 1, "del" => 1, "close" => 1, "view" => 1), array("add" => 1, "edit" => 1, "del" => 1, "view" => 1), array("add" => 1, "edit" => 1, "del" => 1, "read" => 1, "view" => 1), array("add" => 1), array("add" => 1));
    $userrid = $rolesobj->add("User", array("add" => 1, "edit" => 1, "del" => 0, "close" => 0, "view" => 1), array("add" => 1, "edit" => 1, "del" => 0, "close" => 1, "view" => 1), array("add" => 1, "edit" => 1, "del" => 1, "close" => 1, "view" => 1), array("add" => 1, "edit" => 1, "del" => 1, "close" => 1, "view" => 1), array("add" => 1, "edit" => 1, "del" => 1, "view" => 1), array("add" => 1, "edit" => 1, "del" => 1, "read" => 0, "view" => 1), array("add" => 1), array("add" => 0));
    $clientrid = $rolesobj->add("Client", array("add" => 0, "edit" => 0, "del" => 0, "close" => 0), array("add" => 0, "edit" => 0, "del" => 0, "close" => 0), array("add" => 0, "edit" => 0, "del" => 0, "close" => 0), array("add" => 0, "edit" => 0, "del" => 0, "close" => 0), array("add" => 0, "edit" => 0, "del" => 0), array("add" => 0, "edit" => 0, "del" => 0, "read" => 0), array("add" => 0), array("add" => 0));
    if (!$adminrid or !$userrid or !$clientrid) {
        $template->assign("errortext", "Error: Failed to create initial roles.");
        $template->display("error.tpl");
        die;
    }
    $rolesobj->assign($adminrid, $usrid);
    $template->display("install3.tpl");
}
Exemplo n.º 2
0
 private function addPeople($peopleArray)
 {
     $user = new user();
     foreach ($peopleArray->person as $person) {
         $company = 0;
         //note that this should be updated when company becomes a used object
         $isAdmin = 1;
         $rolesobj = new roles();
         $adminrid = $rolesobj->add("BasecampAdmin", array("add" => 1, "edit" => 1, "del" => 1, "close" => 1), array("add" => 1, "edit" => 1, "del" => 1, "close" => 1), array("add" => 1, "edit" => 1, "del" => 1, "close" => 1), array("add" => 1, "edit" => 1, "del" => 1, "close" => 1), array("add" => 1, "edit" => 1, "del" => 1), array("add" => 1, "edit" => 1, "del" => 1, "read" => 1), array("add" => 0), array("add" => 1));
         $userrid = $rolesobj->add("BasecampUser", array("add" => 1, "edit" => 1, "del" => 0, "close" => 0), array("add" => 1, "edit" => 1, "del" => 0), array("add" => 1, "edit" => 1, "del" => 1), array("add" => 1, "edit" => 1, "del" => 1), array("add" => 1, "edit" => 1, "del" => 1), array("add" => 1, "edit" => 1, "del" => 1, "read" => 0), array("add" => 1), array("add" => 0));
         $username = $person->{'user-name'};
         $email = $person->{'email-address'};
         $pass = $email;
         $uid = $user->add($username, $email, $company, $pass);
         if ($uid) {
             if ($person->{'administrator'} == "true") {
                 $rolesobj->assign($adminrid, $uid);
                 $isAdmin = 5;
             } elseif ($person->{'client-id'} != 0) {
                 $rolesobj->assign($userrid, $uid);
                 $isAdmin = 0;
             }
             $iid = "" . $person->{'id'};
             $this->peopleHash[$iid] = $uid;
             ++$this->peopleCount;
         }
     }
 }
Exemplo n.º 3
0
  Description: System File

  ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
if (!defined('PARENT')) {
    $HEADERS->err403(true);
}
// Access..
if (!in_array($cmd, $userAccess) && $MSTEAM->id != '1') {
    $HEADERS->err403(true);
}
// Class..
include_once PATH . 'control/classes/class.roles.php';
$MSDEPT = new roles();
// Add..
if (isset($_POST['process'])) {
    if (trim($_POST['name'])) {
        $MSDEPT->add($MSTEAM->id);
        $OK1 = true;
    }
}
// Update..
if (isset($_POST['update'])) {
    if (trim($_POST['name'])) {
        $MSDEPT->update();
        $OK2 = true;
    }
}
$title = isset($_GET['edit']) ? $msg_dept5 : $msg_dept2;
include PATH . 'templates/header.php';
include PATH . 'templates/system/role/role.php';
include PATH . 'templates/footer.php';