Search in sources :

Example 1 with WithPermissionsRepository

use of io.pivotal.cla.egit.github.core.WithPermissionsRepository in project pivotal-cla by pivotalsoftware.

the class MylynGitHubApi method findRepositoryNamesWithAdminPermission.

@Override
@SneakyThrows
public List<String> findRepositoryNamesWithAdminPermission(String accessToken) {
    GitHubClient client = createClient(accessToken);
    WithPermissionsRepositoryService service = new WithPermissionsRepositoryService(client);
    List<WithPermissionsRepository> repositories = service.getPermissionRepositories();
    List<String> repoSlugs = new ArrayList<>();
    for (WithPermissionsRepository r : repositories) {
        if (!r.getPermissions().isAdmin()) {
            continue;
        }
        org.eclipse.egit.github.core.User owner = r.getOwner();
        repoSlugs.add(owner.getLogin() + "/" + r.getName());
    }
    return repoSlugs;
}
Also used : GitHubClient(org.eclipse.egit.github.core.client.GitHubClient) WithPermissionsRepository(io.pivotal.cla.egit.github.core.WithPermissionsRepository) WithPermissionsRepositoryService(io.pivotal.cla.egit.github.core.service.WithPermissionsRepositoryService) SneakyThrows(lombok.SneakyThrows)

Aggregations

WithPermissionsRepository (io.pivotal.cla.egit.github.core.WithPermissionsRepository)1 WithPermissionsRepositoryService (io.pivotal.cla.egit.github.core.service.WithPermissionsRepositoryService)1 SneakyThrows (lombok.SneakyThrows)1 GitHubClient (org.eclipse.egit.github.core.client.GitHubClient)1