protected function getAllCapabilities(RolesTable $table): array
    {
        $result = [];

        $allCapabilities = Utils::getAllCapabilities();
        if (empty($allCapabilities)) {
            $this->abort('No capabilities at all found in the system!');
        }

        foreach ($allCapabilities as $groupName => $groupCaps) {
            if (empty($groupCaps)) {
                continue;
            }

            foreach ($groupCaps as $type => $caps) {
                foreach ($caps as $cap) {
                    $result = array_merge($result, [$cap->getName()]);
                }
            }
        }

        // set all capabilities as selected
        $result = array_fill_keys($result, '1');
        $result = $table->prepareCapabilities($result);

        if (empty($result)) {
            $this->abort('No capabilities found in the system!');
        }

        return $result;
    }