Search in sources :

Example 1 with PeriscopeUser

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);
}
Also used : PeriscopeUser(com.sequenceiq.periscope.domain.PeriscopeUser) Cluster(com.sequenceiq.periscope.domain.Cluster)

Example 2 with PeriscopeUser

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);
}
Also used : PeriscopeUser(com.sequenceiq.periscope.domain.PeriscopeUser)

Example 3 with PeriscopeUser

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();
}
Also used : UserFilterField(com.sequenceiq.cloudbreak.common.service.user.UserFilterField) Field(java.lang.reflect.Field) PeriscopeUser(com.sequenceiq.periscope.domain.PeriscopeUser)

Example 4 with PeriscopeUser

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);
}
Also used : PeriscopeUser(com.sequenceiq.periscope.domain.PeriscopeUser)

Example 5 with PeriscopeUser

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;
}
Also used : SecurityConfig(com.sequenceiq.periscope.domain.SecurityConfig) PeriscopeUser(com.sequenceiq.periscope.domain.PeriscopeUser)

Aggregations

PeriscopeUser (com.sequenceiq.periscope.domain.PeriscopeUser)12 Cluster (com.sequenceiq.periscope.domain.Cluster)4 UserFilterField (com.sequenceiq.cloudbreak.common.service.user.UserFilterField)1 History (com.sequenceiq.periscope.domain.History)1 SecurityConfig (com.sequenceiq.periscope.domain.SecurityConfig)1 AmbariStack (com.sequenceiq.periscope.model.AmbariStack)1 Field (java.lang.reflect.Field)1 Before (org.aspectj.lang.annotation.Before)1 CodeSignature (org.aspectj.lang.reflect.CodeSignature)1