Search in sources :

Example 26 with User

use of org.eclipse.vorto.repository.domain.User in project vorto by eclipse.

the class ModelRepositoryController method getUserPolicy.

@PreAuthorize("isAuthenticated() or hasAuthority('model_viewer')")
@GetMapping("/{modelId:.+}/policy")
public ResponseEntity<PolicyEntry> getUserPolicy(@PathVariable final String modelId) {
    Objects.requireNonNull(modelId, "model ID must not be null");
    Authentication user = SecurityContextHolder.getContext().getAuthentication();
    ModelId modelID = ModelId.fromPrettyFormat(modelId);
    String tenantId = getWorkspaceId(modelId);
    try {
        List<PolicyEntry> policyEntries = getPolicyManager(tenantId).getPolicyEntries(modelID).stream().filter(p -> userHasPolicyEntry(p, user, tenantId)).collect(Collectors.toList());
        return getBestPolicyEntryForUser(policyEntries).map(p -> new ResponseEntity<>(p, HttpStatus.OK)).orElseGet(() -> new ResponseEntity<>(HttpStatus.NOT_FOUND));
    } catch (NotAuthorizedException ex) {
        return new ResponseEntity<>(HttpStatus.UNAUTHORIZED);
    }
}
Also used : InfomodelTemplate(org.eclipse.vorto.repository.web.core.templates.InfomodelTemplate) RequestParam(org.springframework.web.bind.annotation.RequestParam) PreAuthorize(org.springframework.security.access.prepost.PreAuthorize) ApiParam(io.swagger.annotations.ApiParam) Autowired(org.springframework.beans.factory.annotation.Autowired) ModelAlreadyExistsException(org.eclipse.vorto.repository.core.ModelAlreadyExistsException) ModelInfo(org.eclipse.vorto.repository.core.ModelInfo) RequestContextHolder(org.springframework.web.context.request.RequestContextHolder) Future(java.util.concurrent.Future) Map(java.util.Map) Diagnostic(org.eclipse.vorto.repository.core.Diagnostic) AsyncModelMappingsFetcher(org.eclipse.vorto.repository.web.core.async.AsyncModelMappingsFetcher) SecurityContextHolder(org.springframework.security.core.context.SecurityContextHolder) ModelParserFactory(org.eclipse.vorto.repository.core.impl.parser.ModelParserFactory) PostMapping(org.springframework.web.bind.annotation.PostMapping) AsyncModelLinksFetcher(org.eclipse.vorto.repository.web.core.async.AsyncModelLinksFetcher) NotAuthorizedException(org.eclipse.vorto.repository.web.core.exceptions.NotAuthorizedException) User(org.eclipse.vorto.repository.domain.User) Namespace(org.eclipse.vorto.repository.domain.Namespace) RestController(org.springframework.web.bind.annotation.RestController) Executors(java.util.concurrent.Executors) IOUtils(org.apache.commons.io.IOUtils) Permission(org.eclipse.vorto.repository.core.PolicyEntry.Permission) DefaultUserAccountService(org.eclipse.vorto.repository.account.impl.DefaultUserAccountService) ZipOutputStream(java.util.zip.ZipOutputStream) ByteArrayOutputStream(java.io.ByteArrayOutputStream) ModelFullDetailsDTO(org.eclipse.vorto.repository.web.api.v1.dto.ModelFullDetailsDTO) ControllerUtils(org.eclipse.vorto.repository.web.ControllerUtils) ModelLink(org.eclipse.vorto.repository.web.api.v1.dto.ModelLink) IModelRepository(org.eclipse.vorto.repository.core.IModelRepository) Value(org.springframework.beans.factory.annotation.Value) RequestBody(org.springframework.web.bind.annotation.RequestBody) FatalModelRepositoryException(org.eclipse.vorto.repository.core.FatalModelRepositoryException) IWorkflowService(org.eclipse.vorto.repository.workflow.IWorkflowService) Lists(com.google.common.collect.Lists) Attachment(org.eclipse.vorto.repository.core.Attachment) AsyncModelSyntaxFetcher(org.eclipse.vorto.repository.web.core.async.AsyncModelSyntaxFetcher) UserRepositoryRoleService(org.eclipse.vorto.repository.services.UserRepositoryRoleService) ModelProperty(org.eclipse.vorto.model.ModelProperty) ModelNotReleasedException(org.eclipse.vorto.repository.model.ModelNotReleasedException) GenericApplicationException(org.eclipse.vorto.repository.web.GenericApplicationException) IOException(java.io.IOException) IModelPolicyManager(org.eclipse.vorto.repository.core.IModelPolicyManager) NamespaceService(org.eclipse.vorto.repository.services.NamespaceService) ExecutionException(java.util.concurrent.ExecutionException) HttpStatus(org.springframework.http.HttpStatus) ApiResponse(io.swagger.annotations.ApiResponse) AttachmentValidator(org.eclipse.vorto.repository.core.impl.validation.AttachmentValidator) AttachResult(org.eclipse.vorto.repository.web.api.v1.dto.AttachResult) ModelTemplate(org.eclipse.vorto.repository.web.core.templates.ModelTemplate) PathVariable(org.springframework.web.bind.annotation.PathVariable) ValidationReport(org.eclipse.vorto.repository.importer.ValidationReport) DoesNotExistException(org.eclipse.vorto.repository.services.exceptions.DoesNotExistException) ApiOperation(io.swagger.annotations.ApiOperation) Logger(org.apache.log4j.Logger) AbstractRepositoryController(org.eclipse.vorto.repository.web.AbstractRepositoryController) ByteArrayInputStream(java.io.ByteArrayInputStream) PutMapping(org.springframework.web.bind.annotation.PutMapping) ModelMinimalInfoDTO(org.eclipse.vorto.repository.web.api.v1.dto.ModelMinimalInfoDTO) ZipEntry(java.util.zip.ZipEntry) DeleteMapping(org.springframework.web.bind.annotation.DeleteMapping) AsyncWorkflowActionsFetcher(org.eclipse.vorto.repository.web.core.async.AsyncWorkflowActionsFetcher) FileContent(org.eclipse.vorto.repository.core.FileContent) IDiagnostics(org.eclipse.vorto.repository.core.IDiagnostics) Collection(java.util.Collection) ModelValidationHelper(org.eclipse.vorto.repository.core.impl.utils.ModelValidationHelper) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) OperationForbiddenException(org.eclipse.vorto.repository.services.exceptions.OperationForbiddenException) Collectors(java.util.stream.Collectors) ModelId(org.eclipse.vorto.model.ModelId) Objects(java.util.Objects) List(java.util.List) Principal(java.security.Principal) Optional(java.util.Optional) WorkflowException(org.eclipse.vorto.repository.workflow.WorkflowException) Authentication(org.springframework.security.core.Authentication) IUserContext(org.eclipse.vorto.repository.core.IUserContext) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) HashMap(java.util.HashMap) ApiResponses(io.swagger.annotations.ApiResponses) AsyncModelAttachmentsFetcher(org.eclipse.vorto.repository.web.core.async.AsyncModelAttachmentsFetcher) Status(org.eclipse.vorto.repository.web.Status) GetMapping(org.springframework.web.bind.annotation.GetMapping) ExecutorService(java.util.concurrent.ExecutorService) ModelContent(org.eclipse.vorto.repository.web.core.dto.ModelContent) ModelNamespaceNotOfficialException(org.eclipse.vorto.repository.model.ModelNamespaceNotOfficialException) AsyncModelReferenceFetcher(org.eclipse.vorto.repository.web.core.async.AsyncModelReferenceFetcher) IBulkOperationsService(org.eclipse.vorto.repository.model.IBulkOperationsService) UserNamespaceRoleService(org.eclipse.vorto.repository.services.UserNamespaceRoleService) HttpServletResponse(javax.servlet.http.HttpServletResponse) PolicyEntry(org.eclipse.vorto.repository.core.PolicyEntry) ValidationException(org.eclipse.vorto.repository.core.impl.validation.ValidationException) ModelType(org.eclipse.vorto.model.ModelType) TimeUnit(java.util.concurrent.TimeUnit) ModelResource(org.eclipse.vorto.repository.core.ModelResource) PrincipalType(org.eclipse.vorto.repository.core.PolicyEntry.PrincipalType) MultipartFile(org.springframework.web.multipart.MultipartFile) ResponseEntity(org.springframework.http.ResponseEntity) UserContext(org.eclipse.vorto.repository.core.impl.UserContext) ResponseEntity(org.springframework.http.ResponseEntity) Authentication(org.springframework.security.core.Authentication) NotAuthorizedException(org.eclipse.vorto.repository.web.core.exceptions.NotAuthorizedException) PolicyEntry(org.eclipse.vorto.repository.core.PolicyEntry) ModelId(org.eclipse.vorto.model.ModelId) GetMapping(org.springframework.web.bind.annotation.GetMapping) PreAuthorize(org.springframework.security.access.prepost.PreAuthorize)

Example 27 with User

use of org.eclipse.vorto.repository.domain.User in project vorto by eclipse.

the class NamespaceController method createTechnicalUserForNamespace.

/**
 * Creates a technical user with the given {@link Collaborator} and associates them to the given
 * namespace, with the desired roles held by the collaborator.
 *
 * @param namespace
 * @param collaborator
 * @return
 */
@RequestMapping(method = RequestMethod.POST, value = "/{namespace:.+}/users")
@PreAuthorize("isAuthenticated()")
public ResponseEntity<Boolean> createTechnicalUserForNamespace(@ApiParam(value = "namespace", required = true) @PathVariable String namespace, @RequestBody @ApiParam(value = "The user to be associated with the namespace", required = true) final Collaborator collaborator) {
    try {
        IUserContext userContext = UserContext.user(SecurityContextHolder.getContext().getAuthentication());
        User user = EntityDTOConverter.createUser(userUtil, collaborator);
        userNamespaceRoleService.createTechnicalUserAndAddAsCollaborator(userContext.getUsername(), user, namespace, collaborator.getRoles());
        return new ResponseEntity<>(true, HttpStatus.CREATED);
    } catch (InvalidUserException ie) {
        return new ResponseEntity<>(false, HttpStatus.BAD_REQUEST);
    } catch (OperationForbiddenException ofe) {
        return new ResponseEntity<>(false, HttpStatus.FORBIDDEN);
    } catch (DoesNotExistException d) {
        return new ResponseEntity<>(false, HttpStatus.NOT_FOUND);
    }
}
Also used : IUserContext(org.eclipse.vorto.repository.core.IUserContext) ResponseEntity(org.springframework.http.ResponseEntity) OperationForbiddenException(org.eclipse.vorto.repository.services.exceptions.OperationForbiddenException) DoesNotExistException(org.eclipse.vorto.repository.services.exceptions.DoesNotExistException) User(org.eclipse.vorto.repository.domain.User) InvalidUserException(org.eclipse.vorto.repository.services.exceptions.InvalidUserException) PreAuthorize(org.springframework.security.access.prepost.PreAuthorize) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 28 with User

use of org.eclipse.vorto.repository.domain.User in project vorto by eclipse.

the class NamespaceController method findAllAccessibleNamespacesByPartial.

/**
 * Finds all namespaces accessible to the authenticated user, by a partial name. <br/>
 * This is used in the UI to search for namespaces the user can view, aka all the public ones and
 * the private ones the user has at least one role in.
 *
 * @param partial
 * @return
 */
@RequestMapping(method = RequestMethod.GET, value = "/search/{partial:.+}")
@PreAuthorize("isAuthenticated()")
public ResponseEntity<Collection<NamespaceDto>> findAllAccessibleNamespacesByPartial(@ApiParam(value = "The partial name of the namespaces to be searched with", required = true) @PathVariable String partial) {
    if (Strings.nullToEmpty(partial).trim().isEmpty()) {
        return new ResponseEntity<>(Collections.emptyList(), HttpStatus.OK);
    }
    IUserContext userContext = UserContext.user(SecurityContextHolder.getContext().getAuthentication());
    Collection<NamespaceDto> result = namespaceRepository.findNamespaceByPartial(partial.toLowerCase()).stream().filter(n -> {
        try {
            return // all public namespaces
            !n.getName().startsWith(NamespaceValidator.PRIVATE_NAMESPACE_PREFIX) || // or namespaces where user has a role
            userNamespaceRoleService.hasAnyRole(userContext.getUsername(), n.getName());
        // should never occur here
        } catch (DoesNotExistException dnee) {
            return false;
        }
    }).map(EntityDTOConverter::createNamespaceDTO).sorted(Comparator.comparing(NamespaceDto::getName)).collect(Collectors.toList());
    return new ResponseEntity<>(result, HttpStatus.OK);
}
Also used : OperationResult(org.eclipse.vorto.repository.web.api.v1.dto.OperationResult) PathVariable(org.springframework.web.bind.annotation.PathVariable) DoesNotExistException(org.eclipse.vorto.repository.services.exceptions.DoesNotExistException) NamespaceValidator(org.eclipse.vorto.repository.web.api.v1.util.NamespaceValidator) PreAuthorize(org.springframework.security.access.prepost.PreAuthorize) UserNamespaceRoles(org.eclipse.vorto.repository.domain.UserNamespaceRoles) EntityDTOConverter(org.eclipse.vorto.repository.web.api.v1.util.EntityDTOConverter) ApiParam(io.swagger.annotations.ApiParam) Autowired(org.springframework.beans.factory.annotation.Autowired) PrivateNamespaceQuotaExceededException(org.eclipse.vorto.repository.services.exceptions.PrivateNamespaceQuotaExceededException) PutMapping(org.springframework.web.bind.annotation.PutMapping) Map(java.util.Map) SecurityContextHolder(org.springframework.security.core.context.SecurityContextHolder) DeleteMapping(org.springframework.web.bind.annotation.DeleteMapping) RequestAccessToNamespaceMessage(org.eclipse.vorto.repository.notification.message.RequestAccessToNamespaceMessage) PostMapping(org.springframework.web.bind.annotation.PostMapping) Collection(java.util.Collection) UserService(org.eclipse.vorto.repository.services.UserService) Set(java.util.Set) OperationForbiddenException(org.eclipse.vorto.repository.services.exceptions.OperationForbiddenException) RequestMethod(org.springframework.web.bind.annotation.RequestMethod) IRole(org.eclipse.vorto.repository.domain.IRole) User(org.eclipse.vorto.repository.domain.User) Collectors(java.util.stream.Collectors) Namespace(org.eclipse.vorto.repository.domain.Namespace) RestController(org.springframework.web.bind.annotation.RestController) IMessage(org.eclipse.vorto.repository.notification.IMessage) Optional(java.util.Optional) NameSyntaxException(org.eclipse.vorto.repository.services.exceptions.NameSyntaxException) IUserContext(org.eclipse.vorto.repository.core.IUserContext) NotificationProblem(org.eclipse.vorto.repository.notification.INotificationService.NotificationProblem) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) TreeSet(java.util.TreeSet) HashSet(java.util.HashSet) Value(org.springframework.beans.factory.annotation.Value) RequestBody(org.springframework.web.bind.annotation.RequestBody) Strings(com.google.common.base.Strings) UserNamespaceRoleRepository(org.eclipse.vorto.repository.repositories.UserNamespaceRoleRepository) INotificationService(org.eclipse.vorto.repository.notification.INotificationService) Collaborator(org.eclipse.vorto.repository.web.api.v1.dto.Collaborator) GetMapping(org.springframework.web.bind.annotation.GetMapping) InvalidUserException(org.eclipse.vorto.repository.services.exceptions.InvalidUserException) CollisionException(org.eclipse.vorto.repository.services.exceptions.CollisionException) NamespaceDto(org.eclipse.vorto.repository.web.api.v1.dto.NamespaceDto) UserNamespaceRoleService(org.eclipse.vorto.repository.services.UserNamespaceRoleService) NamespaceService(org.eclipse.vorto.repository.services.NamespaceService) UserUtil(org.eclipse.vorto.repository.services.UserUtil) HttpStatus(org.springframework.http.HttpStatus) NamespaceRepository(org.eclipse.vorto.repository.repositories.NamespaceRepository) NamespaceAccessRequestDTO(org.eclipse.vorto.repository.web.api.v1.dto.NamespaceAccessRequestDTO) ResponseEntity(org.springframework.http.ResponseEntity) Comparator(java.util.Comparator) Collections(java.util.Collections) UserContext(org.eclipse.vorto.repository.core.impl.UserContext) IUserContext(org.eclipse.vorto.repository.core.IUserContext) ResponseEntity(org.springframework.http.ResponseEntity) NamespaceDto(org.eclipse.vorto.repository.web.api.v1.dto.NamespaceDto) DoesNotExistException(org.eclipse.vorto.repository.services.exceptions.DoesNotExistException) EntityDTOConverter(org.eclipse.vorto.repository.web.api.v1.util.EntityDTOConverter) PreAuthorize(org.springframework.security.access.prepost.PreAuthorize) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 29 with User

use of org.eclipse.vorto.repository.domain.User in project vorto by eclipse.

the class NamespaceController method addOrUpdateCollaboratorForNamespace.

/**
 * Sets the roles of the given user on the given namespace.
 *
 * @param namespace
 * @param collaborator
 * @return
 */
@PreAuthorize("isAuthenticated()")
@RequestMapping(method = RequestMethod.PUT, value = "/{namespace:.+}/users")
public ResponseEntity<Boolean> addOrUpdateCollaboratorForNamespace(@ApiParam(value = "namespace", required = true) @PathVariable String namespace, @RequestBody @ApiParam(value = "The user to be associated with the namespace", required = true) final Collaborator collaborator) {
    try {
        // no validation here save for essentials: we are pointing to an existing user
        User user = EntityDTOConverter.createUser(null, collaborator);
        IUserContext userContext = UserContext.user(SecurityContextHolder.getContext().getAuthentication());
        return new ResponseEntity<>(userNamespaceRoleService.setRoles(userContext.getUsername(), user.getUsername(), namespace, collaborator.getRoles(), false), HttpStatus.OK);
    } catch (InvalidUserException iue) {
        return new ResponseEntity<>(false, HttpStatus.BAD_REQUEST);
    } catch (OperationForbiddenException ofe) {
        return new ResponseEntity<>(false, HttpStatus.FORBIDDEN);
    } catch (DoesNotExistException d) {
        return new ResponseEntity<>(false, HttpStatus.NOT_FOUND);
    }
}
Also used : IUserContext(org.eclipse.vorto.repository.core.IUserContext) ResponseEntity(org.springframework.http.ResponseEntity) OperationForbiddenException(org.eclipse.vorto.repository.services.exceptions.OperationForbiddenException) DoesNotExistException(org.eclipse.vorto.repository.services.exceptions.DoesNotExistException) User(org.eclipse.vorto.repository.domain.User) InvalidUserException(org.eclipse.vorto.repository.services.exceptions.InvalidUserException) PreAuthorize(org.springframework.security.access.prepost.PreAuthorize) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 30 with User

use of org.eclipse.vorto.repository.domain.User in project vorto by eclipse.

the class NamespaceController method requestAccessToNamespace.

@PostMapping("/requestAccess")
@PreAuthorize("isAuthenticated()")
public ResponseEntity<OperationResult> requestAccessToNamespace(@RequestBody @ApiParam(value = "The request body specifying who initiates the request, the namespace, whom the request is intended for, and an optional collection of suggested roles", required = true) NamespaceAccessRequestDTO request) {
    Optional<OperationResult> validationError = NamespaceValidator.validateAccessRequest(request);
    if (validationError.isPresent()) {
        return new ResponseEntity<>(validationError.get(), HttpStatus.BAD_REQUEST);
    }
    // checks namespace exists
    // should only occur if namespace was deleted after user search, but before sending request
    Namespace target;
    try {
        target = namespaceService.getByName(request.getNamespaceName());
    } catch (DoesNotExistException dnee) {
        return new ResponseEntity<>(OperationResult.failure("Namespace not found."), HttpStatus.NOT_FOUND);
    }
    // checks any admin with an e-mail address set
    Set<User> adminsWithEmail = userNamespaceRoleRepository.findAllByNamespace(target).stream().map(UserNamespaceRoles::getUser).filter(u -> !Strings.nullToEmpty(u.getEmailAddress()).trim().isEmpty()).collect(Collectors.toSet());
    if (adminsWithEmail.isEmpty()) {
        return new ResponseEntity<>(OperationResult.failure(String.format("None of the users administrating namespace %s has set their own e-mail. Please contact them directly. ", request.getNamespaceName())), HttpStatus.PRECONDITION_FAILED);
    }
    int successCount = adminsWithEmail.size();
    // attempts to send the e-mails
    // ugly exception handling here, due to the way this was designed in the service
    Collection<IMessage> messages = adminsWithEmail.stream().map(u -> new RequestAccessToNamespaceMessage(request, u, host)).collect(Collectors.toList());
    for (IMessage message : messages) {
        try {
            emailNotificationService.sendNotification(message);
        } catch (NotificationProblem np) {
            successCount--;
        }
    }
    // worked for all recipients
    if (successCount == adminsWithEmail.size()) {
        return new ResponseEntity<>(OperationResult.success(), HttpStatus.OK);
    } else // worked for some recipients
    if (successCount > 0) {
        return new ResponseEntity<>(OperationResult.success("The message could not be sent to all administrators."), HttpStatus.OK);
    } else // did not work for any recipient
    {
        return new ResponseEntity<>(OperationResult.failure("The message could not be sent to any administrator."), HttpStatus.SERVICE_UNAVAILABLE);
    }
}
Also used : OperationResult(org.eclipse.vorto.repository.web.api.v1.dto.OperationResult) PathVariable(org.springframework.web.bind.annotation.PathVariable) DoesNotExistException(org.eclipse.vorto.repository.services.exceptions.DoesNotExistException) NamespaceValidator(org.eclipse.vorto.repository.web.api.v1.util.NamespaceValidator) PreAuthorize(org.springframework.security.access.prepost.PreAuthorize) UserNamespaceRoles(org.eclipse.vorto.repository.domain.UserNamespaceRoles) EntityDTOConverter(org.eclipse.vorto.repository.web.api.v1.util.EntityDTOConverter) ApiParam(io.swagger.annotations.ApiParam) Autowired(org.springframework.beans.factory.annotation.Autowired) PrivateNamespaceQuotaExceededException(org.eclipse.vorto.repository.services.exceptions.PrivateNamespaceQuotaExceededException) PutMapping(org.springframework.web.bind.annotation.PutMapping) Map(java.util.Map) SecurityContextHolder(org.springframework.security.core.context.SecurityContextHolder) DeleteMapping(org.springframework.web.bind.annotation.DeleteMapping) RequestAccessToNamespaceMessage(org.eclipse.vorto.repository.notification.message.RequestAccessToNamespaceMessage) PostMapping(org.springframework.web.bind.annotation.PostMapping) Collection(java.util.Collection) UserService(org.eclipse.vorto.repository.services.UserService) Set(java.util.Set) OperationForbiddenException(org.eclipse.vorto.repository.services.exceptions.OperationForbiddenException) RequestMethod(org.springframework.web.bind.annotation.RequestMethod) IRole(org.eclipse.vorto.repository.domain.IRole) User(org.eclipse.vorto.repository.domain.User) Collectors(java.util.stream.Collectors) Namespace(org.eclipse.vorto.repository.domain.Namespace) RestController(org.springframework.web.bind.annotation.RestController) IMessage(org.eclipse.vorto.repository.notification.IMessage) Optional(java.util.Optional) NameSyntaxException(org.eclipse.vorto.repository.services.exceptions.NameSyntaxException) IUserContext(org.eclipse.vorto.repository.core.IUserContext) NotificationProblem(org.eclipse.vorto.repository.notification.INotificationService.NotificationProblem) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) TreeSet(java.util.TreeSet) HashSet(java.util.HashSet) Value(org.springframework.beans.factory.annotation.Value) RequestBody(org.springframework.web.bind.annotation.RequestBody) Strings(com.google.common.base.Strings) UserNamespaceRoleRepository(org.eclipse.vorto.repository.repositories.UserNamespaceRoleRepository) INotificationService(org.eclipse.vorto.repository.notification.INotificationService) Collaborator(org.eclipse.vorto.repository.web.api.v1.dto.Collaborator) GetMapping(org.springframework.web.bind.annotation.GetMapping) InvalidUserException(org.eclipse.vorto.repository.services.exceptions.InvalidUserException) CollisionException(org.eclipse.vorto.repository.services.exceptions.CollisionException) NamespaceDto(org.eclipse.vorto.repository.web.api.v1.dto.NamespaceDto) UserNamespaceRoleService(org.eclipse.vorto.repository.services.UserNamespaceRoleService) NamespaceService(org.eclipse.vorto.repository.services.NamespaceService) UserUtil(org.eclipse.vorto.repository.services.UserUtil) HttpStatus(org.springframework.http.HttpStatus) NamespaceRepository(org.eclipse.vorto.repository.repositories.NamespaceRepository) NamespaceAccessRequestDTO(org.eclipse.vorto.repository.web.api.v1.dto.NamespaceAccessRequestDTO) ResponseEntity(org.springframework.http.ResponseEntity) Comparator(java.util.Comparator) Collections(java.util.Collections) UserContext(org.eclipse.vorto.repository.core.impl.UserContext) DoesNotExistException(org.eclipse.vorto.repository.services.exceptions.DoesNotExistException) User(org.eclipse.vorto.repository.domain.User) IMessage(org.eclipse.vorto.repository.notification.IMessage) OperationResult(org.eclipse.vorto.repository.web.api.v1.dto.OperationResult) RequestAccessToNamespaceMessage(org.eclipse.vorto.repository.notification.message.RequestAccessToNamespaceMessage) Namespace(org.eclipse.vorto.repository.domain.Namespace) ResponseEntity(org.springframework.http.ResponseEntity) UserNamespaceRoles(org.eclipse.vorto.repository.domain.UserNamespaceRoles) NotificationProblem(org.eclipse.vorto.repository.notification.INotificationService.NotificationProblem) PostMapping(org.springframework.web.bind.annotation.PostMapping) PreAuthorize(org.springframework.security.access.prepost.PreAuthorize)

Aggregations

User (org.eclipse.vorto.repository.domain.User)36 ResponseEntity (org.springframework.http.ResponseEntity)13 PreAuthorize (org.springframework.security.access.prepost.PreAuthorize)12 IUserContext (org.eclipse.vorto.repository.core.IUserContext)8 DoesNotExistException (org.eclipse.vorto.repository.services.exceptions.DoesNotExistException)8 PostMapping (org.springframework.web.bind.annotation.PostMapping)8 OperationForbiddenException (org.eclipse.vorto.repository.services.exceptions.OperationForbiddenException)7 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)7 Optional (java.util.Optional)6 InvalidUserException (org.eclipse.vorto.repository.services.exceptions.InvalidUserException)6 ApiParam (io.swagger.annotations.ApiParam)5 Collection (java.util.Collection)5 Map (java.util.Map)5 Collectors (java.util.stream.Collectors)5 DefaultUserAccountService (org.eclipse.vorto.repository.account.impl.DefaultUserAccountService)5 Namespace (org.eclipse.vorto.repository.domain.Namespace)5 NamespaceService (org.eclipse.vorto.repository.services.NamespaceService)5 UserNamespaceRoleService (org.eclipse.vorto.repository.services.UserNamespaceRoleService)5 Test (org.junit.Test)5 Autowired (org.springframework.beans.factory.annotation.Autowired)5