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);
}
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();
}
}
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");
}
Aggregations