use of com.sequenceiq.cloudbreak.common.model.user.IdentityUser in project cloudbreak by hortonworks.
the class OwnerBasedPermissionEvaluatorTest method testWriteOwner.
@Test
public void testWriteOwner() {
when(oauth.getUserAuthentication()).thenReturn(new TestingAuthenticationToken("principal", "credential"));
IdentityUser user = new IdentityUser("userid", "", "", Collections.emptyList(), "", "", null);
when(userDetailsService.getDetails(anyString(), any(UserFilterField.class))).thenReturn(user);
boolean result = underTest.hasPermission(oauth, stack, "write");
Assert.assertTrue(result);
}
use of com.sequenceiq.cloudbreak.common.model.user.IdentityUser in project cloudbreak by hortonworks.
the class OwnerBasedPermissionEvaluatorTest method testReadNotOwnerNotAdminNotAccountButPublicInAccount.
@Test
public void testReadNotOwnerNotAdminNotAccountButPublicInAccount() {
when(oauth.getUserAuthentication()).thenReturn(new TestingAuthenticationToken("principal", "credential"));
IdentityUser user = new IdentityUser("admin", "", "test-account", Collections.emptyList(), "", "", null);
when(userDetailsService.getDetails(anyString(), any(UserFilterField.class))).thenReturn(user);
stack.setPublicInAccount(true);
boolean result = underTest.hasPermission(oauth, stack, "read");
Assert.assertFalse(result);
}
use of com.sequenceiq.cloudbreak.common.model.user.IdentityUser in project cloudbreak by hortonworks.
the class SmartSenseSubscriptionController method createSmartSenseSubscription.
private SmartSenseSubscriptionJson createSmartSenseSubscription(SmartSenseSubscriptionJson json, boolean publicInAccount) {
IdentityUser identityUser = authenticatedUserService.getCbUser();
SmartSenseSubscription subscription = toSmartSenseSubscriptionConverter.convert(json);
subscription.setAccount(identityUser.getAccount());
subscription.setOwner(identityUser.getUserId());
subscription.setPublicInAccount(publicInAccount);
subscription = smartSenseSubService.create(subscription);
return toJsonConverter.convert(subscription);
}
use of com.sequenceiq.cloudbreak.common.model.user.IdentityUser in project cloudbreak by hortonworks.
the class SmartSenseSubscriptionController method deletePrivate.
@Override
public void deletePrivate(String subscriptionId) {
IdentityUser cbUser = authenticatedUserService.getCbUser();
smartSenseSubService.delete(subscriptionId, cbUser);
}
use of com.sequenceiq.cloudbreak.common.model.user.IdentityUser in project cloudbreak by hortonworks.
the class StackCommonService method deletePublic.
@Override
public void deletePublic(String name, Boolean forced, Boolean deleteDependencies) {
IdentityUser user = authenticatedUserService.getCbUser();
stackService.delete(name, user, forced, deleteDependencies);
}
Aggregations