use of com.sequenceiq.cloudbreak.common.model.user.IdentityUser in project cloudbreak by hortonworks.
the class AccountPreferencesController method get.
@Override
public AccountPreferencesJson get() {
IdentityUser user = authenticatedUserService.getCbUser();
AccountPreferences preferences = service.getOneByAccount(user);
return convert(preferences);
}
use of com.sequenceiq.cloudbreak.common.model.user.IdentityUser in project cloudbreak by hortonworks.
the class UserController method evictCurrentUserDetails.
@Override
public User evictCurrentUserDetails() {
IdentityUser user = authenticatedUserService.getCbUser();
userDetailsService.evictUserDetails(user.getUserId(), user.getUsername());
return new User(user.getUsername());
}
use of com.sequenceiq.cloudbreak.common.model.user.IdentityUser in project cloudbreak by hortonworks.
the class UserController method modifyProfile.
@Override
public void modifyProfile(UserProfileRequest userProfileRequest) {
IdentityUser user = authenticatedUserService.getCbUser();
userProfileService.put(userProfileRequest, user);
}
use of com.sequenceiq.cloudbreak.common.model.user.IdentityUser in project cloudbreak by hortonworks.
the class OwnerBasedPermissionEvaluatorTest method testWriteNotOwnerButAdmin.
@Test
public void testWriteNotOwnerButAdmin() {
when(oauth.getUserAuthentication()).thenReturn(new TestingAuthenticationToken("principal", "credential"));
IdentityUser user = new IdentityUser("admin", "", "account", Collections.singletonList(IdentityUserRole.ADMIN), "", "", 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 testWriteNotOwnerNotAdminButPublicInAccount.
@Test
public void testWriteNotOwnerNotAdminButPublicInAccount() {
when(oauth.getUserAuthentication()).thenReturn(new TestingAuthenticationToken("principal", "credential"));
IdentityUser user = new IdentityUser("admin", "", "account", Collections.emptyList(), "", "", null);
when(userDetailsService.getDetails(anyString(), any(UserFilterField.class))).thenReturn(user);
stack.setPublicInAccount(true);
boolean result = underTest.hasPermission(oauth, stack, "write");
Assert.assertFalse(result);
}
Aggregations