Force pre-calculation of a list of permissions for optimisation

@param string $permission
@param array $ids
558173
public function prePopulatePermissionCache($permission = 'edit', $ids = [])
    {
        switch ($permission) {
            case self::EDIT:
                $this->canEditMultiple($ids, Security::getCurrentUser(), false);
                break;
            case self::VIEW:
                $this->canViewMultiple($ids, Security::getCurrentUser(), false);
                break;
            case self::DELETE:
                $this->canDeleteMultiple($ids, Security::getCurrentUser(), false);
                break;
            default:
                throw new InvalidArgumentException("Invalid permission type $permission");
        }
    }
827540
public function rejectNotBlocker(array $ids): array
    {
        return BlockRelationship::where('blocked_by_id', $this->id)
                                ->whereIn('blocker_id', $ids)
                                ->pluck('blocker_id')
                                ->toArray();
    }
466908
public boolean hasPermissionsById(String id, Permission... permissions) {
        return hasPermissionsById(id, Arrays.asList(permissions));
    }
1086359
public function deleteRoles(array $ids): void
	{
		if ($this->isAjax()) {
			$roles = $this->orm->aclRoles->findById($ids);
			foreach ($roles as $role) {
				$this->orm->aclRoles->remove($role);
			}
			$this->orm->flush();
			$this['permissionsList']->reload();
		} else {
			$this->terminate();
		}
	}
93744
public function authorize($permission)
    {
        $this->requiredPermissions[] = $permission instanceof IPermission
            ? $permission
            : Permission::named($permission);
    }
1056416
public function deactivateUsers(array $ids): void
	{
		if ($this->isAjax()) {
			$users = $this->orm->users->findById($ids);
			foreach ($users as $user) {
				$user->active = false;
				$this->orm->users->persist($user);
			}
			$this->orm->flush();
			$this['userList']->reload();
		} else {
			$this->terminate();
		}
	}
1122290
private function removeDeletedPermissions(array $permission)
    {
        $configActions = collect($permission['actions']);

        $actions = Permissions::where('name', $permission['name'])->pluck('action');

        $removedActions = $actions->diff($configActions);

        if( ! $removedActions->isEmpty() )
            foreach ( $removedActions as $action )
                Permissions::deletePermission($action);
    }
284749
protected function disassociateAbilities($authority, array $ids)
    {
        if (is_null($authority)) {
            $this->disassociateEveryone($ids);
        } else {
            $this->disassociateAuthority($authority, $ids);
        }
    }
243334
protected function userHasPermission(array $permissions)
    {
        if ( ! count($permissions)) {
            return true;
        }

        return (bool) count(
            array_filter($permissions, function ($permission) {
                return array_get($this->userPermissions, $permission);
            })
        );
    }
139111
public function hasAny(array $permissions, bool $need_affiliation = true): bool
    {

        foreach ($permissions as $permission)
            if ($this->has($permission, $need_affiliation))
                return true;

        return false;
    }
75547
public function setIds(array $ids)
    {
        $actualIds = [];

        foreach ($ids as $id) {
            $this->assertValidId($id);
            $actualIds[] = $id;
        }

        $this->clearCachedValueIf($this->ids != $actualIds);
        $this->ids = $actualIds;
    }
253006
public final function setIds(array $ids): void
    {
        foreach ($ids as $id) {
            $this->ids[] = (int) $id;
        }
    }
245840
public function setIds(array $ids): void
    {
        if (empty($ids)) {
            throw new \InvalidArgumentException('At least one ID must be specified');
        }

        foreach ($ids as $id) {
            if (!\is_int($id)) {
                throw new \InvalidArgumentException('All IDs must be integers');
            }
        }

        $this->ids = $ids;
    }
1066966
public function applicablePages($ids)
    {
        // Basic permission check based on SiteTree::canEdit
        if (!Permission::check(array("ADMIN", "SITETREE_EDIT_ALL"))) {
            return array();
        }

        // Get pages that exist in stage and remove them from the restore-able set
        $stageIDs = Versioned::get_by_stage($this->managedClass, Versioned::DRAFT)->column('ID');
        return array_values(array_diff($ids, $stageIDs));
    }
190581
public function removePermission($ids)
    {
        $ids = is_array($ids) ? $ids : func_get_args();

        $this->permissions()->detach($ids);
    }
1080245
private function restrictPermissions(array $userPermission, array $permissions)
    {
        return $this->mapPermissions($userPermission, $permissions, function($permission1, $permission2) {
            return $permission1 && $permission2;
        });
    }
75083
protected function canAll(array $permissions)
    {
        foreach ($permissions as $permission) {
            if (!$this->hasPermission($permission)) {
                return false;
            }
        }

        return true;
    }