Package com.infoclinika.mssharing.model

Examples of com.infoclinika.mssharing.model.AccessDenied


    @Override
    public ImmutableSortedSet<ExperimentFileItem> filesInExperiment(long actor, long experimentId) {
        Experiment experiment = checkPresence(experimentRepository.findOne(experimentId));
        if (!ruleValidator.isUserCanReadExperiment(actor).apply(experiment))
            throw new AccessDenied("User hasn't permissions to read experiment");

        return from(experiment.getRawFiles().data)
                .transform(FILE_ITEM_TRANSFORMER)
                .toImmutableSortedSet(FILE_ITEM_COMPARATOR);
    }
View Full Code Here


    }

    @Override
    public long createGroup(long actor, String name, Iterable<Long> collaborators) {
        if (!ruleValidator.userHasPermissionsToCreateGroup(actor))
            throw new AccessDenied("User isn't permitted to create sharing group");
        checkGroupName(name, null);
        final Date time = current.get();
        if (!collaborators.iterator().hasNext()) {
            throw new IllegalArgumentException("No members were supplied for the new group '" + name + "'");
        }
View Full Code Here

    }

    @Override
    public void removeGroup(long actor, long groupId) {
        if (!ruleValidator.canRemoveGroup(actor, groupId))
            throw new AccessDenied("User isn't permitted to remove group");
        groupRepository.delete(groupId);
    }
View Full Code Here

    }

    @Override
    public void renameGroup(long actor, long groupId, String newName) {
        if (!ruleValidator.userHasReadPermissionsToEditGroup(actor, groupId))
            throw new AccessDenied("Couldn't edit group");
        checkGroupName(newName, groupId);
        final Group group = findGroup(groupId);
        group.name = newName;
        saveGroup(group);
    }
View Full Code Here

    }

    @Override
    public void setCollaborators(long actor, long group, Iterable<Long> collaborators, boolean withEmailNotification) {
        if (!ruleValidator.userHasReadPermissionsToEditGroup(actor, group))
            throw new AccessDenied("Couldn't edit group");

        if (!collaborators.iterator().hasNext()) {
            throw new IllegalArgumentException("No members were supplied for the group");
        }
View Full Code Here

    }

    @Override
    public void updateSharingPolicy(long actor, long project, Map<Long, AccessLevel> colleagues, Map<Long, AccessLevel> groups, boolean withEmailNotification) {
        if (!ruleValidator.hasWriteAccessOnProject(actor, project))
            throw new AccessDenied("User have no permission to share project");
        Sharing.Type type;
        if (colleagues.isEmpty() && groups.isEmpty()) {
            type = Sharing.Type.PRIVATE;
        }
        else if (groups.containsKey(groupRepository.findAllUsersGroup().getId())) {
View Full Code Here

    }

    @Override
    public void makeProjectPublic(long actor, long projectId) {
        if (!ruleValidator.hasWriteAccessOnProject(actor, projectId))
            throw new AccessDenied("User have no permission to make project public");
        updateSharingPolicy(actor, projectId, Collections.<Long, AccessLevel>emptyMap(),
                Collections.singletonMap(groupRepository.findAllUsersGroup().getId(),
                        AccessLevel.READ), false);
    }
View Full Code Here


    @Override
    public void makeProjectPrivate(long actor, long projectId) {
        if (!ruleValidator.hasWriteAccessOnProject(actor, projectId))
            throw new AccessDenied("User have no permission to make project private");
        final Project project = findProject(projectId);
        final ImmutableMap<User, AccessLevel> oldCollaborators = copyOf(project.getSharing().getAllCollaborators());
        project.getSharing().setType(Sharing.Type.PRIVATE);
        final Project saved = saveProject(project);
        updateExperimentSharing(project);
View Full Code Here

        this.ruleValidator = ruleValidator;
    }

    @Override
    public void updateNews(long actor, long newsId, NewsInfo newsInfo) {
        if(!ruleValidator.canManageNews(actor)) throw new AccessDenied("Only admin can update news");
        final NewsItem newsItem = checkPresence(newsRepository.findOne(newsId));
        newsItem.setAuthor(newsInfo.creatorEmail);
        newsItem.setIntroduction(newsInfo.introduction);
        newsItem.setText(newsInfo.text);
        newsItem.setTitle(newsInfo.title);
View Full Code Here

        newsRepository.save(newsItem);
    }

    @Override
    public void createNews(long actor, NewsInfo newsInfo) {
        if(!ruleValidator.canManageNews(actor)) throw new AccessDenied("Only admin can create news");

        final Date date = newsInfo.dateCreated != null ? newsInfo.dateCreated: new Date();
        NewsItem newsItem = new NewsItem(newsInfo.title, newsInfo.introduction, newsInfo.text, newsInfo.creatorEmail, date);
        newsItem.setLastModification(date);
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.