Search in sources :

Example 1 with UFSpendProfileUser

use of bio.terra.cli.serialization.userfacing.UFSpendProfileUser in project terra-cli by DataBiosphere.

the class Enable method execute.

/**
 * Enable access to the WSM default spend profile for the given email.
 */
@Override
protected void execute() {
    SpendProfileUser spendProfileUser = SpendProfileUser.enable(spendProfileUserOption.email, spendProfileUserOption.policy);
    formatOption.printReturnValue(new UFSpendProfileUser(spendProfileUser), Enable::printText);
}
Also used : UFSpendProfileUser(bio.terra.cli.serialization.userfacing.UFSpendProfileUser) SpendProfileUser(bio.terra.cli.businessobject.SpendProfileUser) UFSpendProfileUser(bio.terra.cli.serialization.userfacing.UFSpendProfileUser)

Example 2 with UFSpendProfileUser

use of bio.terra.cli.serialization.userfacing.UFSpendProfileUser in project terra-cli by DataBiosphere.

the class Invite method execute.

/**
 * Invite a new user.
 */
@Override
protected void execute() {
    TerraUser.invite(email);
    OUT.println("Successfully invited user.");
    if (enableSpend) {
        SpendProfileUser spendProfileUser = SpendProfileUser.enable(email, SpendProfileManagerService.SpendProfilePolicy.USER);
        OUT.println("User enabled on the default spend profile.");
        new UFSpendProfileUser(spendProfileUser).print();
    }
}
Also used : UFSpendProfileUser(bio.terra.cli.serialization.userfacing.UFSpendProfileUser) SpendProfileUser(bio.terra.cli.businessobject.SpendProfileUser) UFSpendProfileUser(bio.terra.cli.serialization.userfacing.UFSpendProfileUser)

Example 3 with UFSpendProfileUser

use of bio.terra.cli.serialization.userfacing.UFSpendProfileUser in project terra-cli by DataBiosphere.

the class SpendProfileUser method listUsersReflectsEnableDisable.

@Test
@DisplayName("list-users reflects enabling and disabling users")
void listUsersReflectsEnableDisable() throws IOException {
    // get an email to try and add
    String testEmail = generateSamGroupForEmail();
    // use a test user that is an owner to grant spend access to the test email
    TestUser spendProfileOwner = TestUser.chooseTestUserWithOwnerAccess();
    spendProfileOwner.login();
    // `terra spend enable --email=$testEmail --policy=USER`
    TestCommand.runCommandExpectSuccess("spend", "enable", "--email=" + testEmail, "--policy=USER");
    // check that the test email is included in the list-users output
    expectListedUserWithPolicies(testEmail, SpendProfilePolicy.USER);
    // `terra spend disable --email=$testEmail --policy=USER`
    TestCommand.runCommandExpectSuccess("spend", "disable", "--email=" + testEmail, "--policy=USER");
    // check that the test email is not included in the list-users output
    Optional<UFSpendProfileUser> listUsersOutput = listUsersWithEmail(testEmail);
    assertTrue(listUsersOutput.isEmpty(), "user is not included in the test-users output after having their spend access disabled");
}
Also used : UFSpendProfileUser(bio.terra.cli.serialization.userfacing.UFSpendProfileUser) TestUser(harness.TestUser) Test(org.junit.jupiter.api.Test) DisplayName(org.junit.jupiter.api.DisplayName)

Aggregations

UFSpendProfileUser (bio.terra.cli.serialization.userfacing.UFSpendProfileUser)3 SpendProfileUser (bio.terra.cli.businessobject.SpendProfileUser)2 TestUser (harness.TestUser)1 DisplayName (org.junit.jupiter.api.DisplayName)1 Test (org.junit.jupiter.api.Test)1