Integration of Drupal Organic Groups and User SQL Backend

I have been able to integrate Organic Groups (og) for using groups in Nextcloud.
Note: In my config the user_id is the Drupal name, not the uid.

  1. Create two views in Drupal:
  • nextcloud_group
select `n`.`nid` AS `group_id`,`n`.`title` AS `group_title`,'admin' AS `user_id` from (`og_membership` `om` left join `node` `n` on(`om`.`gid` = `n`.`nid`)) group by `n`.`nid` order by `n`.`title`
  • nextcloud_group_users
select `n`.`nid` AS `group_id`,`n`.`title` AS `group_title`,`u`.`name` AS `user_id` from ((`og_membership` `om` left join `node` `n` on(`om`.`gid` = `n`.`nid`)) left join `users` `u` on(`om`.`etid` = `u`.`uid`)) where `om`.`entity_type` = 'user'
  1. Configure Nextcloud:
    image