예제 #1
0
    if ($valgroups->name == 'employees') {
        $valgroupsEmployees = $valgroups->guid;
        $employees = true;
    }
    if ($valgroups->name == 'finance') {
        $valgroupsFinance = $valgroups->guid;
        $finance = true;
    }
}
//Test unit
$groups = ws_assignUserToGroup($valuser1, $valgroups1);
$groups = ws_assignUserToGroup($valuser2, $valgroups2);
$groups = ws_assignUserToGroup($valuser3, $valgroups3);
$groups = ws_assignUserToGroup($valuser4, $valgroups4);
$groups = ws_assignUserToGroup($valuser5, $valgroups5);
$groups = ws_assignUserToGroup($valuser6, $valgroups6);
$groups = ws_assignUserToGroup($valuser7, $valgroups7);
// Expend report
$groups = ws_assignUserToGroup($valuser1, $valgroupsSupervisors);
$groups = ws_assignUserToGroup($valuser2, $valgroupsEmployees);
$groups = ws_assignUserToGroup($valuser3, $valgroupsFinance);
$t->is($foundUser1, true, 'user1 is present in Group One');
$t->is($foundUser2, true, 'user2 is present in Group Two');
$t->is($foundUser3, true, 'user3 is present in Group Three');
$t->is($foundUser3, true, 'user4 is present in Group Four');
$t->is($foundUser3, true, 'user5 is present in Group Five');
$t->is($foundUser3, true, 'user6 is present in Group Six');
$t->is($foundUser3, true, 'user7 is present in Group Seven');
$t->is($foundUser1, true, 'user1 is present in Group supervisors');
$t->is($foundUser2, true, 'user2 is present in Group employees');
$t->is($foundUser3, true, 'user3 is present in Group finance');
예제 #2
0
function assignUserToGroup($t, $userId, $groupId)
{
    $result = ws_assignUserToGroup($userId, $groupId);
    if ($result->status_code == 8) {
        $t->pass("User {$userId} already exists in the group");
        return;
    }
    if ($result->status_code != 0) {
        throw new Exception($result->message);
    }
    $t->pass("assigned {$userId} to group {$groupId}");
}
예제 #3
0
$firstname = 'Mary ' . date('mdHi');
$lastname = 'Smith';
$email = 'Mary' . date('mdHi') . '@colosa.com';
$role = $roleOperator;
$password = '******';
$res = ws_createUser($user2Id, $firstname, $lastname, $email, $roleOperator, $password);
$t->isa_ok($res, 'stdClass', 'executed ws_createUser');
if ($res->status_code == 0) {
    $t->is($res->status_code, 0, 'ws_createUser status_code = 0');
} else {
    $t->is($res->status_code, 7, 'ws_createUser status_code = 7');
}
$t->diag($res->message);
$t->diag('UserUID = ' . $res->userUID);
$user2Uid = $res->userUID;
$res = ws_assignUserToGroup($user2Uid, DERIVATORS_GROUP);
$res = ws_open_with_params(WS_WSDL_URL, $user1Id, 'sample');
//create a case with John
$variables = array();
$variables[] = array('name' => 'webServer', 'value' => $info->webServer);
$variables[] = array('name' => 'phpVersion', 'value' => $info->phpVersion);
$result = ws_newCase(PROCESS_UID, START_SEQ_CYCLICAL_TASK, $variables);
$t->isa_ok($result, 'stdClass', 'executed ws_newCase');
$t->is($result->status_code, 0, 'ws_newCase status_code = 0');
if ($result->status_code == 0) {
    $caseId = $result->caseId;
    $caseNumber = $result->caseNumber;
    $msg = sprintf("New Case created: %s %s", $caseNumber, $caseId);
    $t->diag($msg);
} else {
    $t->diag('------------ Error executing newCase ---------------------');