use of org.guvnor.structure.organizationalunit.OrganizationalUnit in project kie-wb-common by kiegroup.
the class SocialEventOUConstraint method getAuthorizedOrganizationUnits.
Collection<OrganizationalUnit> getAuthorizedOrganizationUnits() {
final Collection<OrganizationalUnit> organizationalUnits = organizationalUnitService.getOrganizationalUnits();
final Collection<OrganizationalUnit> authorizedOrganizationalUnits = new ArrayList<OrganizationalUnit>();
for (OrganizationalUnit ou : organizationalUnits) {
if (authorizationManager.authorize(ou, userCDIContextHelper.getUser())) {
authorizedOrganizationalUnits.add(ou);
}
}
return authorizedOrganizationalUnits;
}
use of org.guvnor.structure.organizationalunit.OrganizationalUnit in project kie-wb-common by kiegroup.
the class SocialEventRepositoryConstraint method getAuthorizedOrganizationUnits.
private Collection<OrganizationalUnit> getAuthorizedOrganizationUnits() {
final Collection<OrganizationalUnit> organizationalUnits = organizationalUnitService.getOrganizationalUnits();
final Collection<OrganizationalUnit> authorizedOrganizationalUnits = new ArrayList<OrganizationalUnit>();
for (OrganizationalUnit ou : organizationalUnits) {
if (authorizationManager.authorize(ou, userCDIContextHelper.getUser())) {
authorizedOrganizationalUnits.add(ou);
}
}
return authorizedOrganizationalUnits;
}
use of org.guvnor.structure.organizationalunit.OrganizationalUnit in project kie-wb-common by kiegroup.
the class SocialEventOUConstraintTest method setUp.
@Before
public void setUp() throws Exception {
Collection<OrganizationalUnit> ous = new ArrayList<OrganizationalUnit>();
final OrganizationalUnitImpl ou = new OrganizationalUnitImpl("ouname", "owner", "groupid");
ous.add(ou);
when(organizationalUnitService.getOrganizationalUnits()).thenReturn(ous);
when(authorizationManager.authorize(ou, user)).thenReturn(true);
when(userCDIContextHelper.getUser()).thenReturn(user);
when(userCDIContextHelper.thereIsALoggedUserInScope()).thenReturn(true);
socialEventOUConstraint = new SocialEventOUConstraint(organizationalUnitService, authorizationManager, repositoryService, userCDIContextHelper);
}
use of org.guvnor.structure.organizationalunit.OrganizationalUnit in project kie-wb-common by kiegroup.
the class SocialEventRepositoryConstraintTest method setUp.
@Before
public void setUp() throws Exception {
Collection<OrganizationalUnit> ous = new ArrayList<OrganizationalUnit>();
final OrganizationalUnitImpl ou = new OrganizationalUnitImpl("ouname", "owner", "groupid");
final OrganizationalUnitImpl ouSpy = spy(ou);
Collection<Repository> repositories = new ArrayList<Repository>();
repository = new GitRepository("repo", new Space("space"));
repositories.add(repository);
ous.add(ouSpy);
when(ouSpy.getRepositories()).thenReturn(repositories);
when(organizationalUnitService.getOrganizationalUnits()).thenReturn(ous);
when(authorizationManager.authorize(ou, user)).thenReturn(true);
when(authorizationManager.authorize(repository, user)).thenReturn(true);
when(userCDIContextHelper.getUser()).thenReturn(user);
when(userCDIContextHelper.thereIsALoggedUserInScope()).thenReturn(true);
socialEventRepositoryConstraint = createSocialEventRepositoryContraint();
}
use of org.guvnor.structure.organizationalunit.OrganizationalUnit in project kie-wb-common by kiegroup.
the class ProjectExplorerContentResolverTest method createModule.
private Module createModule(final String branchName, final Branch branch, final String moduleName) {
final POM pom = mock(POM.class);
when(pom.getName()).thenReturn(moduleName);
final Module module = new Module(createMockPath(branchName, moduleName), createMockPath(branchName, moduleName), pom);
final OrganizationalUnit organizationalUnit = mock(OrganizationalUnit.class);
doReturn("demo").when(organizationalUnit).getName();
doReturn(new WorkspaceProject(organizationalUnit, repository, branch, module)).when(projectService).resolveProject(space, branch);
return module;
}
Aggregations