Examples of DomainGroupModelView


Examples of org.eurekastreams.server.search.modelview.DomainGroupModelView

    public void testAuthorizeRemoveFollowerPublicGroupNotOwner()
    {
        final SetFollowingStatusRequest request = new SetFollowingStatusRequest("ntaccount", "groupshortname",
                EntityType.GROUP, false, Follower.FollowerStatus.NOTFOLLOWING);

        final DomainGroupModelView testGroup = new DomainGroupModelView();
        testGroup.setIsPublic(true);
        testGroup.setEntityId(1L);

        context.checking(new Expectations()
        {
            {
                oneOf(groupMapperMock).fetchUniqueResult(with(any(String.class)));
View Full Code Here

Examples of org.eurekastreams.server.search.modelview.DomainGroupModelView

    public void testAuthorizeRemoveFollowerPublicGroup()
    {
        final SetFollowingStatusRequest request = new SetFollowingStatusRequest("ntaccount", "groupshortname",
                EntityType.GROUP, false, Follower.FollowerStatus.NOTFOLLOWING);

        final DomainGroupModelView testGroup = new DomainGroupModelView();
        testGroup.setIsPublic(true);
        testGroup.setEntityId(1L);

        context.checking(new Expectations()
        {
            {
                oneOf(groupMapperMock).fetchUniqueResult(with(any(String.class)));
View Full Code Here

Examples of org.eurekastreams.server.search.modelview.DomainGroupModelView

     */
    @Before
    public void setup()
    {
        results = new ArrayList<ModelView>();
        result1 = new DomainGroupModelView();
        result1.setSearchIndexExplanationString(result1Explanation);
        result2 = new PersonModelView();
        result2.setSearchIndexExplanationString(result2Explanation);
        results.add(result1);
        results.add(result2);
View Full Code Here

Examples of org.eurekastreams.server.search.modelview.DomainGroupModelView

     *            If stream is public.
     * @return The group.
     */
    private DomainGroupModelView expectGroupStream(final boolean isStreamPublic)
    {
        final DomainGroupModelView group = mockery.mock(DomainGroupModelView.class);
        mockery.checking(new Expectations()
        {
            {
                allowing(stream).getType();
                will(returnValue(EntityType.GROUP));
View Full Code Here

Examples of org.eurekastreams.server.search.modelview.DomainGroupModelView

     * @return Result of SUT.
     */
    private boolean coreGroupStreamInGeneralCommentTest(final boolean isStreamPublic,
            final boolean streamAllowsAction, final boolean strict)
    {
        final DomainGroupModelView group = expectGroupStream(isStreamPublic);
        mockery.checking(new Expectations()
        {
            {
                allowing(group).isCommentable();
                will(returnValue(streamAllowsAction));
View Full Code Here

Examples of org.eurekastreams.server.search.modelview.DomainGroupModelView

     * @return Result of SUT.
     */
    private boolean coreGroupStreamActionTest(final long testUser, final boolean isStreamPublic,
            final boolean streamAllowsAction)
    {
        final DomainGroupModelView group = expectGroupStream(isStreamPublic);
        mockery.checking(new Expectations()
        {
            {
                allowing(group).isCommentable();
                will(returnValue(streamAllowsAction));
View Full Code Here

Examples of org.eurekastreams.server.search.modelview.DomainGroupModelView

        }

        // if this activity was sticky, reset the stream's sticky activity
        if (activity.getDestinationStream().getEntityType() == EntityType.GROUP)
        {
            DomainGroupModelView group = groupMapper.execute(activity.getDestinationStream().getDestinationEntityId());
            if (group != null && activityId.equals(group.getStickyActivityId()))
            {
                clearGroupStickyActivityExecutor.execute(inActionContext,
                        new UpdateStickyActivityRequest(group.getId(), null));
            }
        }

        // submit request for additional cache updates due to activity deletion.
        inActionContext.getUserActionRequests().add(
View Full Code Here

Examples of org.eurekastreams.server.search.modelview.DomainGroupModelView

            String groupShortName = actionRequest.getEntityId();
            List<DomainGroupModelView> groups = groupMapper.execute(Collections.singletonList(groupShortName));

            if (groups.size() > 0)
            {
                DomainGroupModelView group = groups.get(0);

                if (group.isPublic() || isUserCoordForGroup(userId, group.getId())
                        || isUserFollowingGroup(userId, group.getId())
                        || adminIdsMapper.execute(null).contains(inActionContext.getPrincipal().getId()))
                {
                    return;
                }
            }
View Full Code Here

Examples of org.eurekastreams.server.search.modelview.DomainGroupModelView

    @Override
    public void authorize(final PrincipalActionContext inActionContext) throws AuthorizationException
    {
        SetFollowingStatusRequest request = (SetFollowingStatusRequest) inActionContext.getParams();

        DomainGroupModelView targetResult = groupMapper.fetchUniqueResult(request.getTargetUniqueId());

        if (request.getFollowerStatus().equals(Follower.FollowerStatus.FOLLOWING))
        {
            // If the group is private, only a group coordinator can add a follower to a group.
            if (!targetResult.isPublic())
            {
                Set<Long> groupCoordinators = groupCoordMapper.execute(targetResult.getEntityId());
                if (!groupCoordinators.contains(inActionContext.getPrincipal().getId()))
                {
                    throw new AuthorizationException("Only group coordinators can add members to a private group.");
                }
            }
        }
        else
        {
            // if the group is private, the follower and group coordinators are the only users that can sever the
            // relationship.
            if (!targetResult.isPublic())
            {
                Set<Long> groupCoordinators = groupCoordMapper.execute(targetResult.getEntityId());
                if (!groupCoordinators.contains(inActionContext.getPrincipal().getId())
                        && !request.getFollowerUniqueId().equals(inActionContext.getPrincipal().getAccountId()))
                {
                    throw new AuthorizationException("Coordinators and Followers are the only ones who can remove a "
                            + "follower from a private group.");
View Full Code Here

Examples of org.eurekastreams.server.search.modelview.DomainGroupModelView

        if (!inRequest.getTargetEntityType().equals(EntityType.GROUP))
        {
            vex.addError("EntityType", "This action only supports following a group.");
        }

        DomainGroupModelView targetResult = domainGroupMapper.fetchUniqueResult(inRequest.getTargetUniqueId());

        if (targetResult == null)
        {
            vex.addError("FollowerAndTarget", "Target unique id must refer to valid 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.