public CompletableFuture<Collection<Permission>> findPermissions(String projectName, String repoName,
                                                                     String appId) {
        requireNonNull(projectName, "projectName");
        requireNonNull(repoName, "repoName");
        requireNonNull(appId, "appId");

        return getProject(projectName).thenApply(metadata -> {
            final RepositoryMetadata repositoryMetadata = metadata.repo(repoName);
            final TokenRegistration registration = metadata.tokens().getOrDefault(appId, null);

            // If the token is guest.
            if (registration == null) {
                return repositoryMetadata.perRolePermissions().guest();
            }
            final Collection<Permission> p = repositoryMetadata.perTokenPermissions().get(registration.id());
            if (p != null) {
                return p;
            }
            return findPerRolePermissions(repositoryMetadata, registration.role());
        });
    }
public CompletableFuture < Collection < Permission > > findPermissions ( String projectName , String repoName , String appId ) { requireNonNull ( projectName , "projectName" ) ; requireNonNull ( repoName , "repoName" ) ; requireNonNull ( appId , "appId" ) ; return getProject ( projectName ) . thenApply ( metadata -> { final RepositoryMetadata repositoryMetadata = metadata . repo ( repoName ) ; final TokenRegistration registration = metadata . tokens ( ) . getOrDefault ( appId , null ) ; if ( registration == null ) { return repositoryMetadata . perRolePermissions ( ) . guest ( ) ; } final Collection < Permission > p = repositoryMetadata . perTokenPermissions ( ) . get ( registration . id ( ) ) ; if ( p != null ) { return p ; } return findPerRolePermissions ( repositoryMetadata , registration . role ( ) ) ; } ) ; }
Finds {@link Permission}s which belong to the specified {@code appId} from the specified
{@code repoName} in the specified {@code projectName}.