Filters repos with admin rights (to manage hooks)

@return true if we have admin rights for repo
542499
protected Predicate<GHRepository> withAdminAccess() {
        return new NullSafePredicate<GHRepository>() {
            @Override
            protected boolean applyNullSafe(@Nonnull GHRepository repo) {
                return repo.hasAdminAccess();
            }
        };
    }
1365427
def admin?
    is_admin = ( ENV['USER'] == 'root' )
    unless is_admin
      ext_admin = exec(:check_admin) do |op, results|
        if op == :reduce
          results.values.include?(true)
        else
          results ? true : false
        end
      end
    end
    is_admin || ext_admin ? true : false
  end
351939
public boolean hasStopPermission() {
        lock.readLock().lock();
        try {
            return executable != null && getParentOf(executable).getOwnerTask().hasAbortPermission();
        } finally {
            lock.readLock().unlock();
        }
    }
322692
public boolean hasPermissionsForMassEdit(CmsObject cms, String siteRoot) {

        String originalSiteRoot = cms.getRequestContext().getSiteRoot();
        try {
            cms.getRequestContext().setSiteRoot(siteRoot);
            return OpenCms.getRoleManager().hasRoleForResource(cms, CmsRole.ADMINISTRATOR, "/");
        } finally {
            cms.getRequestContext().setSiteRoot(originalSiteRoot);
        }

    }
167042
def has_delete_permission(self, request, obj=None):
        
        if obj is not None and obj.fixed:
            return False

        return super(NamespaceAdmin, self).has_delete_permission(request, obj)
1202778
def has_permission(self, request, view):
        
        course_key = CourseKey.from_string(view.kwargs.get('course_id'))
        jwt_filters = decode_jwt_filters(request.auth)
        for filter_type, filter_value in jwt_filters:
            if filter_type == 'content_org' and filter_value == course_key.org:
                return True
        log.warning(
            u"Permission JwtHasContentOrgFilterForRequestedCourse: no filter found for %s.",
            course_key.org,
        )
        return False
241470
def check_for_local_repos(repo):
    
    repos_dict = Repo().default_repository()
    if repo in repos_dict:
        repo_url = repos_dict[repo]
        if repo_url.startswith("file:///"):
            return True
246678
def has_perm(self, user, perm, obj=None):
        """"""
        if not user.is_active:
            return False
        return perm in self.get_all_permissions(user, obj)
909321
public CompletableFuture<Collection<Permission>> findPermissions(String projectName, String repoName,
                                                                     User user) {
        requireNonNull(user, "user");
        if (user.isAdmin()) {
            return CompletableFuture.completedFuture(PerRolePermissions.ALL_PERMISSION);
        }
        if (user instanceof UserWithToken) {
            return findPermissions(projectName, repoName, ((UserWithToken) user).token().appId());
        } else {
            return findPermissions0(projectName, repoName, user);
        }
    }
588842
public function hasRights(ResourceNode $resourceNode, array $userRoles): bool
    {
        $isAdmin = false;

        if ($workspace = $resourceNode->getWorkspace()) {
            $isAdmin = $this->security->isGranted('administrate', $workspace);
        }

        return 0 !== $this->rightsManager->getMaximumRights($userRoles, $resourceNode) || $isAdmin;
    }
269655
public function remove_hooks( $repo_api ) {
		remove_filter( 'extra_theme_headers', [ $this, 'add_headers' ] );
		remove_filter( 'extra_plugin_headers', [ $this, 'add_headers' ] );

		if ( $repo_api instanceof Bitbucket_API ) {
			$this->remove_authentication_hooks();
		}
	}
1036774
private function scanRolesAndPermissions()
    {
        $files = $this->getConfigFiles();

        if( ! empty($files) )
            foreach ( $files as $filePath ) {
                $config = json_decode(file_get_contents($filePath), true);

                if( is_null($config) )
                    $this->info('Invalid json file: ' . $filePath);
                else {
                    $packageName = array_get($config, 'general.serviceProviderNameSpace');

                    if( is_null($packageName) || $packageName == '' ) {
                        $this->error('SKIPPING! Package must have a name! file: ' . $filePath);
                        continue;
                    }

                    if( array_key_exists('acl', $config) ) {
                        $this->aclData[] = [
                            'packageName' => $packageName,
                            'acl'         => array_get($config, 'acl'),
                        ];
                    }
                }
            }
    }
376043
public function hasSuperUser()
    {

        $permissions = $this->getAllPermissions();

        foreach ($permissions as $permission)
            if ($permission === 'superuser') return true;

        return false;
    }
1228259
public static boolean hasFilter(Filter filter) {
        Jenkins j = Jenkins.getInstanceOrNull();
        PluginServletFilter container = null;
        if(j != null) {
            container = getInstance(j.servletContext);
        }
        if (j == null || container == null) {
            return LEGACY.contains(filter);
        } else {
            return container.list.contains(filter);
        }
    }
27985
def is_admin(self, roles):
        """"""
        for r in roles:
            if r in self.admin_roles:
                return True
        return False
6262
public boolean hasModuleResourcesWithUndefinedSite() {

        if (getSite() == null) {
            for (String modRes : getResources()) {
                if (!CmsStringUtil.isPrefixPath("/system/", modRes)
                    && !OpenCms.getSiteManager().startsWithShared(modRes)) {
                    return true;
                }

            }
        }
        return false;
    }
1344133
@Override
    protected boolean filterAdd(HeaderKeys key, byte[] value) {
        boolean rc = super.filterAdd(key, value);

        if (HttpHeaderKeys.isWasPrivateHeader(key.getName())) {
            rc = isPrivateHeaderTrusted(key);
        }
        return rc;
    }