Search in sources :

Example 1 with IAuthorizationPlugin

use of org.opensolaris.opengrok.authorization.IAuthorizationPlugin in project OpenGrok by OpenGrok.

the class ProjectHelperTestBase method setUp.

@Before
public void setUp() {
    Assert.assertEquals("Should contain 4 groups", 4, env.getGroups().size());
    Assert.assertEquals("Should contain 40 project", 40, env.getProjects().size());
    Assert.assertEquals("Should contain 20 repositories", 20, env.getRepositories().size());
    Assert.assertNotNull("Repository map should not be null", env.getProjectRepositoriesMap());
    Assert.assertEquals("Repository map should contain 20 project", 20, env.getProjectRepositoriesMap().size());
    invokeRemoveAll();
    instance = getInstance();
    IAuthorizationPlugin plugin = new TestPlugin() {

        @Override
        public boolean isAllowed(HttpServletRequest request, Project project) {
            return project.getName().startsWith("allowed");
        }

        @Override
        public boolean isAllowed(HttpServletRequest request, Group group) {
            return group.getName().startsWith("allowed");
        }
    };
    invokeAddPlugin(plugin);
    cfg = PageConfig.get(getRequest());
    helper = cfg.getProjectHelper();
}
Also used : HttpServletRequest(javax.servlet.http.HttpServletRequest) Project(org.opensolaris.opengrok.configuration.Project) Group(org.opensolaris.opengrok.configuration.Group) IAuthorizationPlugin(org.opensolaris.opengrok.authorization.IAuthorizationPlugin) TestPlugin(org.opensolaris.opengrok.authorization.TestPlugin) Before(org.junit.Before)

Aggregations

HttpServletRequest (javax.servlet.http.HttpServletRequest)1 Before (org.junit.Before)1 IAuthorizationPlugin (org.opensolaris.opengrok.authorization.IAuthorizationPlugin)1 TestPlugin (org.opensolaris.opengrok.authorization.TestPlugin)1 Group (org.opensolaris.opengrok.configuration.Group)1 Project (org.opensolaris.opengrok.configuration.Project)1