Package com.infoclinika.mssharing.model

Examples of com.infoclinika.mssharing.model.AccessDenied


        labCreationRequestRepository.save(request);
    }

    @Override
    public void editLabInfo(long actor, long labId, LabInfo labInfo) {
        if (!validator.canEditLabDetails(actor, labId)) throw new AccessDenied("Couldn't edit lab");
        final Lab lab = findLab(labId);
        final User labHead = findOrCreateLabHead(labInfo.labHead);
        changeLabHead(lab, labHead);
        lab.setName(labInfo.labName);
        lab.setInstitutionUrl(labInfo.institutionUrl);
View Full Code Here


        }
    }

    @Override
    public long confirmLabCreation(long actor, long labCreationRequestId) {
        if (!validator.canProcessLabRequests(actor)) throw new AccessDenied("");

        final LabCreationRequest request = labCreationRequestRepository.findOne(labCreationRequestId);
        if (request == null) {
            notifier.staleOnLabRequest(actor, labCreationRequestId);
            throw new StaleLabCreationRequestException(labCreationRequestId);
View Full Code Here

        return lab;
    }

    @Override
    public void rejectLabCreation(long actor, long labCreationRequestId, String rejectComment) {
        if (!validator.canProcessLabRequests(actor)) throw new AccessDenied("Cannot update lab creation request");
        final LabCreationRequest request = labCreationRequestRepository.findOne(labCreationRequestId);
        if (request != null) {
            notifier.labCreationRejected(request.getContactEmail(), rejectComment, request.getLabName());
            labCreationRequestRepository.delete(request);
            User requester = userRepository.findByEmail(request.getContactEmail());
View Full Code Here

    @Override
    public void discardAttachment(long actor, long attachment) {
        //todo[tymchenko]: check if it is being used
        if (!validator.canModifyAttachment(actor, attachment)) {
            throw new AccessDenied("User cannot discard the attachment. User ID = " + actor + ". Attachment ID = " + attachment);
        }
        final Attachment toDiscard = attachmentRepository.findOne(attachment);

        //todo[tymchenko]: remove the binary contents as well
        attachmentRepository.delete(toDiscard);
View Full Code Here

    }

    @Override
    public void updateExperimentAttachments(long actor, long experiment, Iterable<Long> attachments) {
        if (!validator.userHasEditPermissionsOnExperiment(actor, experiment)) {
            throw new AccessDenied("User cannot edit the attachments for the experiment. User ID = " + actor + ". Experiment ID = " + experiment);
        }
        final Experiment entity = checkNotNull(experimentRepository.findOne(experiment));

        final List<Long> existingIds = Lists.transform(entity.attachments, new Function<Attachment, Long>() {
            @Override
View Full Code Here

    @Override
    void remove(long actor, String request) {
        InboxMessage message = messageRepository.findOne(Long.valueOf(getInternalId(request)));
        if (message.getTo().getId() != actor) {
            throw new AccessDenied("Could not remove inbox item owned by other user");
        }
        messageRepository.delete(message);
    }
View Full Code Here

    @Override
    public void removeOutboxItem(long actor, String request) {
        OutboxMessage outbpxMessage = outboxMessageRepository.findOne(Long.parseLong(request));
        if (outbpxMessage.getFrom().getId() != actor) {
            throw new AccessDenied("Could not remove outbox item owned by other user");
        }
        outboxMessageRepository.delete(outbpxMessage);
    }
View Full Code Here

        if (!Iterables.any(dashboardReader.readFiles(user, DashboardReader.Filter.SHARED_WITH_ME), new Predicate<DashboardReader.FileLine>() {
            @Override
            public boolean apply(DashboardReader.FileLine input) {
                return input.id == file;
            }
        })) throw new AccessDenied("asserting");
        checkHasAccessToFile(user, lab, file);
        reuseFile(user, lab, file);
    }
View Full Code Here

    public UploadFilesResponse save(@RequestBody UploadFilesRequest uploadFilesRequest, Principal principal) throws IOException {
        final RichUser user = get(principal);
        long userId = user.getId();

        if (user.getLabs().isEmpty()) {
            throw new AccessDenied("User isn't permitted to upload file - laboratory is not specified");
        }
        //todo: verify instrument ID?
        final long instrumentId = uploadFilesRequest.instrument;

        final LinkedList<UploadFilesResponse.UploadFileResponseLine> storedFilesInfo = new LinkedList<UploadFilesResponse.UploadFileResponseLine>();
View Full Code Here

            }
        }.apply(searchDetails.params);
        if (searchDetails.id == null) {
            searchDetailsId = studyManagement.newExperimentSearch(userId, searchDetails.name, searchDetails.description, searchDetails.experiment, experimentSearchParamsInfo);
        } else{
            throw new AccessDenied("Updating ExperimentSearch is forbidden. Create a new ExperimentSearch with updated params.");
        }
        return new ExperimentSearchIdResponse(searchDetailsId);
    }
View Full Code Here

TOP

Related Classes of com.infoclinika.mssharing.model.AccessDenied

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.