use of com.sequenceiq.periscope.domain.PeriscopeUser in project cloudbreak by hortonworks.
the class AutoScaleClusterCommonService method getClusters.
public List<AutoscaleClusterResponse> getClusters() {
PeriscopeUser user = authenticatedUserService.getPeriscopeUser();
MDCBuilder.buildUserMdcContext(user);
List<Cluster> clusters = clusterService.findAllByUser(user);
return clusterConverter.convertAllToJson(clusters);
}
use of com.sequenceiq.periscope.domain.PeriscopeUser in project cloudbreak by hortonworks.
the class AutoScaleClusterCommonService method addCluster.
public AutoscaleClusterResponse addCluster(AutoscaleClusterRequest ambariServer) {
PeriscopeUser user = authenticatedUserService.getPeriscopeUser();
MDCBuilder.buildUserMdcContext(user);
return setCluster(user, ambariServer, null);
}
use of com.sequenceiq.periscope.domain.PeriscopeUser in project cloudbreak by hortonworks.
the class OwnerBasedPermissionEvaluator method getUserIdFromCluster.
private String getUserIdFromCluster(Object targetDomainObject) throws IllegalAccessException {
Field owner = ReflectionUtils.findField(targetDomainObject.getClass(), "user");
owner.setAccessible(true);
PeriscopeUser user = (PeriscopeUser) owner.get(targetDomainObject);
return user.getId();
}
use of com.sequenceiq.periscope.domain.PeriscopeUser in project cloudbreak by hortonworks.
the class ScimAccountGroupReaderFilter method doFilterInternal.
@SuppressWarnings("unchecked")
@Override
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException {
if (SecurityContextHolder.getContext().getAuthentication() != null) {
String username = (String) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
PeriscopeUser user = userDetailsService.getDetails(username, UserFilterField.USERNAME);
request.setAttribute("user", user);
}
filterChain.doFilter(request, response);
}
use of com.sequenceiq.periscope.domain.PeriscopeUser in project cloudbreak by hortonworks.
the class ClusterService method create.
public Cluster create(Cluster cluster, PeriscopeUser user, AmbariStack stack, ClusterState clusterState) {
PeriscopeUser periscopeUser = createUserIfAbsent(user);
validateClusterUniqueness(stack);
cluster.setUser(periscopeUser);
cluster.setAmbari(stack.getAmbari());
cluster.setStackId(stack.getStackId());
if (clusterState != null) {
cluster.setState(clusterState);
}
cluster = save(cluster);
if (stack.getSecurityConfig() != null) {
SecurityConfig securityConfig = stack.getSecurityConfig();
securityConfig.setCluster(cluster);
securityConfigRepository.save(securityConfig);
}
return cluster;
}
Aggregations