public function getUserDashboards(array $user): QueryInterface
    {
        // get all dashboards
        $query = $this->find('all')->order('name');

        // return all dashboards if current user is superuser
        if (isset($user['is_superuser']) && $user['is_superuser']) {
            return $query;
        }

        $roles = [];
        /** @var \Groups\Model\Table\GroupsTable */
        $table = $this->Roles->Groups->getTarget();
        $groups = $table->getUserGroups($user['id']);
        // get group(s) roles
        if (!empty($groups)) {
            $roles = $this->Roles->Capabilities->getGroupsRoles($groups);
        }

        if (empty($roles)) {
            // get all dashboards not assigned to any role
            $query->where(['Dashboards.role_id IS NULL']);

            return $query;
        }

        // return all dashboards for Admins
        if (in_array(Configure::read('RolesCapabilities.Roles.Admin.name'), $roles)) {
            return $query;
        }

        // get role(s) dashboards
        $query->where(['OR' => [
            ['Dashboards.role_id IN' => array_keys($roles)],
            ['Dashboards.role_id IS NULL']
        ]]);

        return $query;
    }