Search in sources :

Example 6 with UserPermission

use of com.netflix.spinnaker.fiat.model.UserPermission in project fiat by spinnaker.

the class RolesController method putUserPermission.

@RequestMapping(value = "/{userId:.+}", method = RequestMethod.POST)
public void putUserPermission(@PathVariable String userId) {
    try {
        UserPermission userPermission = permissionsResolver.resolve(ControllerSupport.convert(userId));
        log.debug("Updated user permissions (userId: {}, roles: {})", userId, userPermission.getRoles().stream().map(Role::getName).collect(Collectors.toList()));
        permissionsRepository.put(userPermission);
    } catch (PermissionResolutionException pre) {
        throw new UserPermissionModificationException(pre);
    }
}
Also used : Role(com.netflix.spinnaker.fiat.model.resources.Role) PermissionResolutionException(com.netflix.spinnaker.fiat.permissions.PermissionResolutionException) UserPermission(com.netflix.spinnaker.fiat.model.UserPermission) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

UserPermission (com.netflix.spinnaker.fiat.model.UserPermission)6 Role (com.netflix.spinnaker.fiat.model.resources.Role)4 IntegrationException (com.netflix.spinnaker.kork.exceptions.IntegrationException)3 IOException (java.io.IOException)3 Collectors (java.util.stream.Collectors)3 NonNull (lombok.NonNull)3 Slf4j (lombok.extern.slf4j.Slf4j)3 TypeReference (com.fasterxml.jackson.core.type.TypeReference)2 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)2 Caffeine (com.github.benmanes.caffeine.cache.Caffeine)2 LoadingCache (com.github.benmanes.caffeine.cache.LoadingCache)2 UnrestrictedResourceConfig (com.netflix.spinnaker.fiat.config.UnrestrictedResourceConfig)2 Resource (com.netflix.spinnaker.fiat.model.resources.Resource)2 ResourceType (com.netflix.spinnaker.fiat.model.resources.ResourceType)2 PermissionResolutionException (com.netflix.spinnaker.fiat.permissions.PermissionResolutionException)2 SpinnakerException (com.netflix.spinnaker.kork.exceptions.SpinnakerException)2 RedisClientDelegate (com.netflix.spinnaker.kork.jedis.RedisClientDelegate)2 RetryRegistry (io.github.resilience4j.retry.RetryRegistry)2 Clock (java.time.Clock)2 Duration (java.time.Duration)2