Package com.infoclinika.mssharing.model

Examples of com.infoclinika.mssharing.model.AccessDenied


    @RequestMapping(value = "/uploadRequest", method = RequestMethod.POST)
    public UploadFilesDTOResponse save(@RequestBody UploadFilesDTORequest uploadFilesRequest,
                                       @RequestParam("token") String restToken) {
        UserDetails userDetails = getUserAndCheckToken(restToken);
        if (!userDetails.hasLaboratories) {
            throw new AccessDenied("permission denied");
        }
        final long userId = userDetails.id;
        final long instrumentId = uploadFilesRequest.instrument;

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


    }

    private UserDetails getUserAndCheckToken(String restToken) throws AccessDenied {
        UserDetails userDetails = restHelper.checkToken(restToken);
        if (userDetails == null) {
            throw new AccessDenied("permission denied");
        }
        return userDetails;
    }
View Full Code Here

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

     */
    @Override
    public void checkCreatingExperimentInExistingProject(long creator, long project) {
        final Project projectEntity = checkPresence(projectRepository.findOne(project));
        if (!isUserCanCreateExperimentsInProject(creator).apply(projectEntity))
            throw new AccessDenied("User has no permissions to create experiment in this project");
    }
View Full Code Here

    }

    @Override
    public void removeUserFromLab(long labHead, long labId, long userId) {
        if (!ruleValidator.userHasPermissionsToRemoveUserFromLab(labHead, labId, userId))
            throw new AccessDenied("User isn't permitted to removed user from laboratory");

        final Lab lab = labRepository.findOne(labId);
        final User user = userRepository.findOne(userId);
        removeUserFromInstrumentOperators(labHead, lab, userId);
        final Iterable<Long> experimentIds = getExperimentIdsToChangeOwner(userId, lab);
View Full Code Here

    @Override
    public Optional<Long> newInstrument(long creator, long labId, long model, InstrumentDetails instrumentDetails) {
        final User actor = Util.USER_FROM_ID.apply(creator);
        if (!validator.canUserCreateInstrument(creator)) {
            throw new AccessDenied("User isn't permitted to create experiment - laboratory is not specified");
        }
        if (!validator.canInstrumentBeCreated(labId, instrumentDetails.name, instrumentDetails.serialNumber)) {
            throw new AccessDenied("Couldn't create instrument");
        }
        //TODO: [stanislav.kurilin] email to lab head should be send
        final Lab lab =  labRepository.findOne(labId);
        final Instrument entity = new Instrument(instrumentDetails.name, actor, Util.INSTRUMENT_MODEL_FROM_ID.apply(model), instrumentDetails.serialNumber, instrumentDetails.hplc, instrumentDetails.peripherals, lab);
View Full Code Here

    }

    @Override
    public void editInstrument(long actor, long instrumentId, InstrumentDetails details) {
        if (!validator.canInstrumentBeSaved(instrumentId, details.name, details.serialNumber)) {
            throw new AccessDenied("Can't save instrument. Check Instrument Name or Serial Number");
        }
        if(!validator.canUserEditInstrument(actor, instrumentId)) {
            throw new AccessDenied("User isn't permitted to edit instrument");
        }

        final Instrument instrument = findInstrument(instrumentId);
        instrument.setName(details.name);
        instrument.setHplc(details.hplc);
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.