Package org.eurekastreams.commons.exceptions

Examples of org.eurekastreams.commons.exceptions.AuthorizationException


                will(returnValue(transStatus));

                oneOf(validationStrategy).validate(serviceActionContext);

                oneOf(authorizationStrategy).authorize(serviceActionContext);
                will(throwException(new AuthorizationException()));

                oneOf(transStatus).isCompleted();
                will(returnValue(false));

                oneOf(transMgrMock).rollback(transStatus);
View Full Code Here


                will(returnValue(transStatus));

                oneOf(validationStrategy).validate(with(any(ServiceActionContext.class)));

                oneOf(authorizationStrategy).authorize(with(any(ServiceActionContext.class)));
                will(throwException(new AuthorizationException()));

                oneOf(transStatus).isCompleted();
                will(returnValue(false));

                oneOf(transMgrMock).rollback(transStatus);
View Full Code Here

        expectValidatePrincipal(true);
        mockery.checking(new Expectations()
        {
            {
                oneOf(authorizationStrategy).authorize((PrincipalActionContext) with(contextWithPrincipalMatcher));
                will(throwException(new AuthorizationException("BAD!")));
            }
        });
        coreTest(true, serviceAction, serviceActionInnerContext, childParam);
        mockery.assertIsSatisfied();
    }
View Full Code Here

            {
                oneOf(principalMock).getAccountId();
                will(returnValue(TEST_ACCOUNTID));

                oneOf(tabPermissionMock).canChangeTabLayout(TEST_ACCOUNTID, tabId, true);
                will(throwException(new AuthorizationException()));
            }
        });

        SetTabLayoutRequest currentRequest = new SetTabLayoutRequest(Layout.TWOCOLUMN, tabId);
        ServiceActionContext currentContext = new ServiceActionContext(currentRequest, principalMock);
View Full Code Here

            {
                oneOf(principalMock).getAccountId();
                will(returnValue("testUser"));

                oneOf(tabPermissionMock).canDeleteStartPageTab("testUser", tabId, true);
                will(throwException(new AuthorizationException()));
            }
        });

        ServiceActionContext currentContext = new ServiceActionContext(tabId, principalMock);
        sut.authorize(currentContext);
View Full Code Here

     * Tests how exceptions are returned to client.
     */
    @Test
    public void testAuthorizationExceptionNested()
    {
        Exception exIn = new AuthorizationException(new ArithmeticException());
        Exception exOut = coreForbidNestingExceptionTest(exIn);
        assertTrue(exOut instanceof AuthorizationException);
        assertEquals(exIn.getMessage(), exOut.getMessage());
    }
View Full Code Here

     * Tests how exceptions are returned to client.
     */
    @Test
    public void testAuthorizationExceptionNonNested()
    {
        Exception exIn = new AuthorizationException();
        Exception exOut = coreForbidNestingExceptionTest(exIn);
        assertSame(exIn, exOut);
    }
View Full Code Here

            return ex;
        }
        else if (ex instanceof AuthorizationException)
        {
            // Remove any nested exceptions
            return (ex.getCause() == null) ? ex : new AuthorizationException(ex.getMessage());
        }
        else if (ex instanceof GeneralException)
        {
            // Remove any nested exceptions (particularly want to insure no PersistenceExceptions get sent - they
            // are not serializable plus contain details that should not be exposed to users)
View Full Code Here

    {
        Long personId = inActionContext.getPrincipal().getId();
        List<Long> administrators = systemAdministratorMapper.execute(null);
        if (!administrators.contains(personId))
        {
            throw new AuthorizationException("Insufficient permissions.");
        }
    }
View Full Code Here

        Long personId = inActionContext.getPrincipal().getId();

        if (!groupPermissionsChecker.hasGroupCoordinatorAccessRecursively(personId, groupId))
        {
            // doesn't have permissions
            throw new AuthorizationException("Insufficient permissions to update group.");
        }
    }
View Full Code Here

TOP

Related Classes of org.eurekastreams.commons.exceptions.AuthorizationException

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.