Ejemplo n.º 1
0
$user_ids = array();
for ($i = 0; $i < 500; $i++) {
    echo "Adding User {$i}\n";
    $id = $user_model->addUser("User{$i}", "test", "First{$i}", "Last{$i}", "user{$i}@email.net", ACTIVE_STATUS);
    if ($id === false) {
        echo "Problem inserting user into DB, aborting...\n";
        exit(1);
    }
    $user_ids[$i] = $id;
}
// add lots of groups
$group_model = new GroupModel();
$group_ids = array();
for ($i = 0; $i < 100; $i++) {
    echo "Creating Group {$i}\n";
    $group_ids[$i] = $group_model->addGroup("Group{$i}", $user_ids[$i], PUBLIC_JOIN, GROUP_READ_WRITE);
}
// add lots of users to group 1
for ($i = 0; $i < 100; $i++) {
    $user_id = $user_ids[$i + 2];
    $group_model->addUserGroup($user_id, $group_ids[1], ACTIVE_STATUS);
}
// add lots of roles
$role_model = new RoleModel();
$user_id = $user_ids[2];
for ($i = 0; $i < 100; $i++) {
    echo "Creating Role {$i}\n";
    $role_model->addRole("Role{$i}");
    $role_id = $role_model->getRoleId("Role{$i}");
    $role_model->addUserRole($user_id, $role_id);
}