Examples of AccessDenied


Examples of com.infoclinika.mssharing.model.AccessDenied

    }

    @Override
    public void addOperatorDirectly(long actor, long instrumentId, String newOperatorEmail) {
        if (!validator.canEditOperatorsList(actor, instrumentId)) {
            throw new AccessDenied("Actor cant add more newOperators");
        }
        final Optional<User> newOperator = Optional.fromNullable(userRepository.findByEmail(newOperatorEmail));
        final Instrument instrument = findInstrument(instrumentId);
        if (newOperator.isPresent()) {
            if (instrument.getOperators().contains(Util.USER_FROM_ID.apply(newOperator.get().getId()))) return;
            if (!validator.canShareInstrument(actor, newOperator.get().getId())) {
                throw new AccessDenied("Can't share instrument");
            }
            instrument.removePending(newOperator.get());
            instrument.addOperator(newOperator.get());
            notifier.userWasAddedToOperators(actor, newOperator.get().getId(), instrumentId);
        } else {
View Full Code Here

Examples of com.infoclinika.mssharing.model.AccessDenied

    }

    @Override
    public void approveAccessToInstrument(long actor, long instrumentId, long initiatorId) {
        if (!validator.canEditOperatorsList(actor, instrumentId)) {
            throw new AccessDenied("Actor cant add more newOperators");
        }

        final Instrument instrument = findInstrument(instrumentId);
        final User initiator = Util.USER_FROM_ID.apply(initiatorId);
        if (instrument.isOperator(initiator)) return;
View Full Code Here

Examples of com.infoclinika.mssharing.model.AccessDenied

    }

    @Override
    public void setInstrumentOperators(final long actor, long instrumentId, List<Long> newOperators) {
        if (!validator.canEditOperatorsList(actor, instrumentId)) {
            throw new AccessDenied("Actor cant add more newOperators");
        }
        if (newOperators.size() == 0) {
            throw new IllegalStateException("Number of operators must be equals to not zero");
        }
View Full Code Here

Examples of com.infoclinika.mssharing.model.AccessDenied

    }

    private void doAddNewOperators(long actor, Instrument instrument, Set<User> users) {
        for (User newOperator : users) {
            if (!validator.canShareInstrument(actor, newOperator.getId())) {
                throw new AccessDenied("Can't share instrument");
            }
            if (instrument.isPending(newOperator)) {
                instrument.removePending(newOperator);
            }
            notifier.userWasAddedToOperators(actor, newOperator.getId(), instrument.getId());
View Full Code Here

Examples of com.infoclinika.mssharing.model.AccessDenied

    @Override
    public void requestAccessToInstrument(long initiatorId, long instrumentId) {
        final Instrument instrument = findInstrument(instrumentId);
        final User actor = findUser(initiatorId);
        if (!validator.canShareInstrument(instrument.getOperators().iterator().next().getId(), initiatorId)) {
            throw new AccessDenied("Can't share instrument");
        }
        final PendingOperator pending = pendingOperatorRepository.save(new PendingOperator(current.get(), actor));
        requests.addOutboxItem(initiatorId, "Operators of " + instrument.getName(), "Requested an access to " + instrument.getName() + " instrument.", current.get());
        instrument.addPending(pending);
    }
View Full Code Here

Examples of com.infoclinika.mssharing.model.AccessDenied


    @Override
    public void refuseAccessToInstrument(long actor, long instrumentId, long initiatorId, String refuseComment) {
        if (!validator.canEditOperatorsList(actor, instrumentId)) {
            throw new AccessDenied("Actor cant add more newOperators");
        }
        final Instrument instrument = findInstrument(instrumentId);
        final User initiator = Util.USER_FROM_ID.apply(initiatorId);
        if (instrument.isPending(initiator)) {
            instrument.removePending(initiator);
View Full Code Here

Examples of com.infoclinika.mssharing.model.AccessDenied

    }

    @Override
    public long attachFile(long user, String fileName, long sizeInBytes, long instrument, long specie, String labels, boolean archive, String destinationPath) {
        if (!validator.canFileBeUploadedByInstrument(archive, instrument)) {
            throw new AccessDenied("Vendor of this instrument doesn't provide an ability to upload archives");
        }

        final Specie specieEntity = speciesRepository.findOne(specie);
        final FileMetaData fileMetaData = new FileMetaData(Util.USER_FROM_ID.apply(user),
                fileName,
View Full Code Here

Examples of com.infoclinika.mssharing.model.AccessDenied

    @Override
    public void cancelUpload(long actor, long file) {
        final FileMetaData entity = load(file);
        if (!entity.getOwner().equals(Util.USER_FROM_ID.apply(actor)))
            throw new AccessDenied("Only owner is able to cancel file upload");
        fileRepository.delete(entity);
    }
View Full Code Here

Examples of com.infoclinika.mssharing.model.AccessDenied

    @Override
    public void pingUpload(long actor, long file) {
        final FileMetaData entity = load(file);
        if (!entity.getOwner().equals(Util.USER_FROM_ID.apply(actor)))
            throw new AccessDenied("Only owner is able to update file upload");
        entity.setLastPingDate(new Date());
        fileRepository.save(entity);
    }
View Full Code Here

Examples of com.infoclinika.mssharing.model.AccessDenied

    @Override
    public void setContent(long actor, long file, StoredObject content) {
        final FileMetaData entity = load(file);
        if (!entity.getOwner().equals(Util.USER_FROM_ID.apply(actor)))
            throw new AccessDenied("Only owner can set content");
        if (RuleValidatorImpl.IS_UPLOAD_COMPLETE.apply(entity))
            throw new AccessDenied("Content already set");
        final NodePath path = storedObjectPaths.rawFilePath(actor, entity.getInstrument().getId(), entity.getName());
        storageService.put(path, content);
        entity.setContentId(path.getPath());
        logger.debug("the content for file with ID = " + file + " for user " + actor + " has been set. Path = " + path.getPath());
        fileRepository.save(entity);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.