Search in sources :

Example 1 with SectionMatcher

use of com.google.gerrit.server.project.SectionMatcher in project gerrit by GerritCodeReview.

the class ProjectControl method allRefPatterns.

private Set<String> allRefPatterns(String permissionName) {
    Set<String> all = new HashSet<>();
    for (SectionMatcher matcher : access()) {
        AccessSection section = matcher.getSection();
        Permission permission = section.getPermission(permissionName);
        if (permission != null) {
            all.add(section.getName());
        }
    }
    return all;
}
Also used : Permission(com.google.gerrit.entities.Permission) CoreOrPluginProjectPermission(com.google.gerrit.extensions.api.access.CoreOrPluginProjectPermission) PluginProjectPermission(com.google.gerrit.extensions.api.access.PluginProjectPermission) SectionMatcher(com.google.gerrit.server.project.SectionMatcher) AccessSection(com.google.gerrit.entities.AccessSection) HashSet(java.util.HashSet)

Example 2 with SectionMatcher

use of com.google.gerrit.server.project.SectionMatcher in project gerrit by GerritCodeReview.

the class ProjectControl method canPerformOnAnyRef.

private boolean canPerformOnAnyRef(String permissionName) {
    for (SectionMatcher matcher : access()) {
        AccessSection section = matcher.getSection();
        Permission permission = section.getPermission(permissionName);
        if (permission == null) {
            continue;
        }
        Boolean can = canPerform(permissionName, section, permission);
        if (can != null) {
            return can;
        }
    }
    return false;
}
Also used : Permission(com.google.gerrit.entities.Permission) CoreOrPluginProjectPermission(com.google.gerrit.extensions.api.access.CoreOrPluginProjectPermission) PluginProjectPermission(com.google.gerrit.extensions.api.access.PluginProjectPermission) SectionMatcher(com.google.gerrit.server.project.SectionMatcher) AccessSection(com.google.gerrit.entities.AccessSection)

Example 3 with SectionMatcher

use of com.google.gerrit.server.project.SectionMatcher in project gerrit by GerritCodeReview.

the class ProjectControl method canPerformOnTagRef.

private boolean canPerformOnTagRef(String permissionName) {
    for (SectionMatcher matcher : access()) {
        AccessSection section = matcher.getSection();
        if (section.getName().startsWith(REFS_TAGS) || section.getName().startsWith(REGEX_PREFIX + REFS_TAGS)) {
            Permission permission = section.getPermission(permissionName);
            if (permission == null) {
                continue;
            }
            Boolean can = canPerform(permissionName, section, permission);
            if (can != null) {
                return can;
            }
        }
    }
    return false;
}
Also used : Permission(com.google.gerrit.entities.Permission) CoreOrPluginProjectPermission(com.google.gerrit.extensions.api.access.CoreOrPluginProjectPermission) PluginProjectPermission(com.google.gerrit.extensions.api.access.PluginProjectPermission) SectionMatcher(com.google.gerrit.server.project.SectionMatcher) AccessSection(com.google.gerrit.entities.AccessSection)

Aggregations

AccessSection (com.google.gerrit.entities.AccessSection)3 Permission (com.google.gerrit.entities.Permission)3 CoreOrPluginProjectPermission (com.google.gerrit.extensions.api.access.CoreOrPluginProjectPermission)3 PluginProjectPermission (com.google.gerrit.extensions.api.access.PluginProjectPermission)3 SectionMatcher (com.google.gerrit.server.project.SectionMatcher)3 HashSet (java.util.HashSet)1