Closed T0mWz closed 1 year ago
Table has a maximum of 64 chars;
explain oc_group_user;
+-------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+-------------+------+-----+---------+-------+
| gid | varchar(64) | NO | PRI | | |
| uid | varchar(64) | NO | PRI | | |
+-------+-------------+------+-----+---------+-------+
2 rows in set (0.003 sec)
We can take 2 approaches to solve this:
user
and group_user
tables to make the type varchar(255). It would be risky if OC was still active but since they are not developing it anymore, I think it a safe quick fix.I think solution 1 is the best quickest way to approach it. @michiel-testing @navid-shokri @soltanireza65 what do you think?
I do agree more with option number one Increasing a column size shouldn't affect anything at all
This pull request fixes this issue.
@T0mWz it is now merged into the main branch. Feel free to close this issue after you verify :blush:
When I try to create a group via SCIM, I got;
{"reqId":"ZHBer7792hG2DxMoyLlEUAAAAAg","level":3,"time":"26\/May\/2023:09:24:32","remoteAddr":"10.234.0.3","user":"--","app":"index","method":"POST","url":"\/index.php\/apps\/federatedgroups\/scim\/Groups","message":"Exception: {\"Exception\":\"Error\",\"Message\":\"Call to a member function getBackend() on null\",\"Code\":0,\"Trace\":\"#0 \\\/var\\\/www\\\/owncloud\\\/apps\\\/federatedgroups\\\/lib\\\/Controller\\\/ScimController.php(172): OCA\\\\FederatedGroups\\\\Controller\\\\ScimController->handleUpdateGroup()\\n#1 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/AppFramework\\\/Http\\\/Dispatcher.php(169): OCA\\\\FederatedGroups\\\\Controller\\\\ScimController->createGroup()\\n#2 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/AppFramework\\\/Http\\\/Dispatcher.php(89): OC\\\\AppFramework\\\\Http\\\\Dispatcher->executeController()\\n#3 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/AppFramework\\\/App.php(99): OC\\\\AppFramework\\\\Http\\\\Dispatcher->dispatch()\\n#4 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/AppFramework\\\/Routing\\\/RouteActionHandler.php(47): OC\\\\AppFramework\\\\App::main()\\n#5 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/Route\\\/Router.php(344): OC\\\\AppFramework\\\\Routing\\\\RouteActionHandler->__invoke()\\n#6 \\\/var\\\/www\\\/owncloud\\\/lib\\\/base.php(916): OC\\\\Route\\\\Router->match()\\n#7 \\\/var\\\/www\\\/owncloud\\\/index.php(54): OC::handleRequest()\\n#8 {main}\",\"File\":\"\\\/var\\\/www\\\/owncloud\\\/apps\\\/federatedgroups\\\/lib\\\/Controller\\\/ScimController.php\",\"Line\":114}"}
Can you share the request you are sending?
Can you share the request you are sending?
curl -X POST -d '{"displayName": "TestGroup (uniharderwijk_surfdrive_test) (SRAM CO)", "externalId": "3f938b6b-cbe0-4856-beb3-91dffa773c15@sram.surf.nl", "members": [{"display": "", "value": "zoete001@surf.nl"}, {"display": "", "value": "wezep001@surf.nl"}, {"display": "", "value": "zoete001@surf.nl"}, {"display": "", "value": "wezep001@surf.nl"}], "urn:mace:surf.nl:sram:scim:extension:Group": {"description": "Provisioned by service Research Drive test - ", "labels": [], "urn": "uniharderwijk:surfdrive_test:srd_test-testgroup"}, "schemas": ["urn:ietf:params:scim:schemas:core:2.0:Group", "urn:mace:surf.nl:sram:scim:extension:Group"], "id": "TestGroup (uniharderwijk_surfdrive_test) (SRAM CO)", "meta": {"created": "2023-05-09T09:28:12.589456", "lastModified": "2023-05-09T09:28:12.602001", "location": "/Groups/848a0f5d-b492-4580-80f1-1950cf7be410", "resourceType": "Group"}}' https://tst-miskatonic.data.surfsara.nl/index.php/apps/federatedgroups/scim/Groups
I tried the call on our test environment and it worked just fine. Can you make sure you have these 2 tables in your database:
| oc_fg_group_user |
| oc_fg_groups |
The only way this error can happen is that an insert into the table oc_fg_groups
has failed.
Have both tables. In only one of them are records added;
MariaDB [miskatonic_tst_oc]> select * from oc_fg_groups;
+---------------------------------------------------------------+
| gid |
+---------------------------------------------------------------+
| Demo collaboration (uniharderwijk_democollab) (SRAM CO) |
| Demonstratiegroep (uniharderwijk_democollab) (SRAM CO) |
| Research Drive Demo CO (uniharderwijk_demo_co_srd.. (SRAM CO) |
| Researchdrive testsamenwerking (uniharderwijk_sur.. (SRAM CO) |
| TestGroup (uniharderwijk_demo_co_srd) (SRAM CO) |
| testgroup (uniharderwijk_democollab) (SRAM CO) |
| TestGroup (uniharderwijk_surfdrive_test) (SRAM CO) |
| TestGroup123 |
+---------------------------------------------------------------+
8 rows in set (0.003 sec)
Also with other naming, the error keeps occured.
Have added an extra logger line be createGroup call;
{"reqId":"ZHXEWDkEOLCxmeCXDdjavwAAAAQ","level":0,"time":"30\/May\/2023:11:39:36","remoteAddr":"10.234.2.58","user":"--","app":"no app in context","method":"POST","url":"\/index.php\/apps\/federatedgroups\/scim\/Groups","message":"GroupID TestGroup (uniharderwijk_surfdrive_test) (SRAM CO)"}
{"reqId":"ZHXEWDkEOLCxmeCXDdjavwAAAAQ","level":3,"time":"30\/May\/2023:11:39:36","remoteAddr":"10.234.2.58","user":"--","app":"index","method":"POST","url":"\/index.php\/apps\/federatedgroups\/scim\/Groups","message":"Exception: {\"Exception\":\"Error\",\"Message\":\"Call to a member function getBackend() on null\",\"Code\":0,\"Trace\":\"#0 \\\/var\\\/www\\\/owncloud\\\/apps\\\/federatedgroups\\\/lib\\\/Controller\\\/ScimController.php(181): OCA\\\\FederatedGroups\\\\Controller\\\\ScimController->handleUpdateGroup()\\n#1 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/AppFramework\\\/Http\\\/Dispatcher.php(169): OCA\\\\FederatedGroups\\\\Controller\\\\ScimController->createGroup()\\n#2 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/AppFramework\\\/Http\\\/Dispatcher.php(89): OC\\\\AppFramework\\\\Http\\\\Dispatcher->executeController()\\n#3 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/AppFramework\\\/App.php(99): OC\\\\AppFramework\\\\Http\\\\Dispatcher->dispatch()\\n#4 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/AppFramework\\\/Routing\\\/RouteActionHandler.php(47): OC\\\\AppFramework\\\\App::main()\\n#5 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/Route\\\/Router.php(344): OC\\\\AppFramework\\\\Routing\\\\RouteActionHandler->__invoke()\\n#6 \\\/var\\\/www\\\/owncloud\\\/lib\\\/base.php(916): OC\\\\Route\\\\Router->match()\\n#7 \\\/var\\\/www\\\/owncloud\\\/index.php(54): OC::handleRequest()\\n#8 {main}\",\"File\":\"\\\/var\\\/www\\\/owncloud\\\/apps\\\/federatedgroups\\\/lib\\\/Controller\\\/ScimController.php\",\"Line\":121}"}
public function createGroup() {
$body = json_decode(file_get_contents("php://input"), true);
$groupId = $body["id"];
$this->logger->debug('GroupID ' . $groupId );
$this->groupBackend->createGroup($groupId);
// expect group to already exist
// we are probably receiving this create due to
// https://github.com/SURFnet/rd-sram-integration/commit/38c6289fd85a92b7fce5d4fbc9ea3170c5eed5d5
$this->handleUpdateGroup($groupId, $body);
return new JSONResponse(
$body,
RESPONSE_TO_GROUP_CREATE
);
}
Added the body too;
{"reqId":"ZHXG8wc0pFR-GyaKPbPJSwAAAAY","level":0,"time":"30\/May\/2023:11:50:44","remoteAddr":"10.234.2.58","user":"--","app":"no app in context","method":"POST","url":"\/index.php\/apps\/federatedgroups\/scim\/Groups","message":"GroupID TestGroup123 and body: Array\n(\n [displayName] => TestGroup123\n [externalId] => 3f938b6b-cbe0-4856-beb3-91dffa773c15@sram.surf.nl\n [members] => Array\n (\n [0] => Array\n (\n [display] => \n [value] => zoete001@surf.nl\n )\n\n [1] => Array\n (\n [display] => \n [value] => wezep001@surf.nl\n )\n\n [2] => Array\n (\n [display] => \n [value] => zoete001@surf.nl\n )\n\n [3] => Array\n (\n [display] => \n [value] => wezep001@surf.nl\n )\n\n )\n\n [urn:mace:surf.nl:sram:scim:extension:Group] => Array\n (\n [description] => Provisioned by service Research Drive test - \n [labels] => Array\n (\n )\n\n [urn] => uniharderwijk:surfdrive_test:srd_test-testgroup\n )\n\n [schemas] => Array\n (\n [0] => urn:ietf:params:scim:schemas:core:2.0:Group\n [1] => urn:mace:surf.nl:sram:scim:extension:Group\n )\n\n [id] => TestGroup123\n [meta] => Array\n (\n [created] => 2023-05-09T09:28:12.589456\n [lastModified] => 2023-05-09T09:28:12.602001\n [location] => \/Groups\/848a0f5d-b492-4580-80f1-1950cf7be410\n [resourceType] => Group\n )\n\n)\n"}
{"reqId":"ZHXG8wc0pFR-GyaKPbPJSwAAAAY","level":3,"time":"30\/May\/2023:11:50:44","remoteAddr":"10.234.2.58","user":"--","app":"index","method":"POST","url":"\/index.php\/apps\/federatedgroups\/scim\/Groups","message":"Exception: {\"Exception\":\"Error\",\"Message\":\"Call to a member function getBackend() on null\",\"Code\":0,\"Trace\":\"#0 \\\/var\\\/www\\\/owncloud\\\/apps\\\/federatedgroups\\\/lib\\\/Controller\\\/ScimController.php(181): OCA\\\\FederatedGroups\\\\Controller\\\\ScimController->handleUpdateGroup()\\n#1 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/AppFramework\\\/Http\\\/Dispatcher.php(169): OCA\\\\FederatedGroups\\\\Controller\\\\ScimController->createGroup()\\n#2 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/AppFramework\\\/Http\\\/Dispatcher.php(89): OC\\\\AppFramework\\\\Http\\\\Dispatcher->executeController()\\n#3 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/AppFramework\\\/App.php(99): OC\\\\AppFramework\\\\Http\\\\Dispatcher->dispatch()\\n#4 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/AppFramework\\\/Routing\\\/RouteActionHandler.php(47): OC\\\\AppFramework\\\\App::main()\\n#5 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/Route\\\/Router.php(344): OC\\\\AppFramework\\\\Routing\\\\RouteActionHandler->__invoke()\\n#6 \\\/var\\\/www\\\/owncloud\\\/lib\\\/base.php(916): OC\\\\Route\\\\Router->match()\\n#7 \\\/var\\\/www\\\/owncloud\\\/index.php(54): OC::handleRequest()\\n#8 {main}\",\"File\":\"\\\/var\\\/www\\\/owncloud\\\/apps\\\/federatedgroups\\\/lib\\\/Controller\\\/ScimController.php\",\"Line\":121}"}
for;
curl -X POST -d '{"displayName": "TestGroup123", "externalId": "3f938b6b-cbe0-4856-beb3-91dffa773c15@sram.surf.nl", "members": [{"display": "", "value": "zoete001@surf.nl"}, {"display": "", "value": "wezep001@surf.nl"}, {"display": "", "value": "zoete001@surf.nl"}, {"display": "", "value": "wezep001@surf.nl"}], "urn:mace:surf.nl:sram:scim:extension:Group": {"description": "Provisioned by service Research Drive test - ", "labels": [], "urn": "uniharderwijk:surfdrive_test:srd_test-testgroup"}, "schemas": ["urn:ietf:params:scim:schemas:core:2.0:Group", "urn:mace:surf.nl:sram:scim:extension:Group"], "id": "TestGroup123", "meta": {"created": "2023-05-09T09:28:12.589456", "lastModified": "2023-05-09T09:28:12.602001", "location": "/Groups/848a0f5d-b492-4580-80f1-1950cf7be410", "resourceType": "Group"}}' https://tst-miskatonic.data.surfsara.nl/index.php/apps/federatedgroups/scim/Groups
private function handleUpdateGroup(string $groupId, $obj) {
$group = $this->groupManager->get($groupId);
$this->logger->debug('handleUpdateGroup GroupID: ' . $group);
Results in;
{"reqId":"ZHXH2OjoK4UCAQK30KHBbgAAAAM","level":0,"time":"30\/May\/2023:11:54:32","remoteAddr":"10.234.2.58","user":"--","app":"no app in context","method":"POST","url":"\/index.php\/apps\/federatedgroups\/scim\/Groups","message":"handleUpdateGroup GroupID: "}
Do I miss something for my groupManager
?
Maybe $this->groupBackend->createGroup($groupId);
is failing silently?
@T0mWz can you try:
curl -X POST -H 'Content-Type: application/json' -d '{"displayName": "TestGroup123", "externalId": "3f938b6b-cbe0-4856-beb3-91dffa773c15@sram.surf.nl", "members": [{"display": "", "value": "zoete001@surf.nl"}, {"display": "", "value": "wezep001@surf.nl"}, {"display": "", "value": "zoete001@surf.nl"}, {"display": "", "value": "wezep001@surf.nl"}], "urn:mace:surf.nl:sram:scim:extension:Group": {"description": "Provisioned by service Research Drive test - ", "labels": [], "urn": "uniharderwijk:surfdrive_test:srd_test-testgroup"}, "schemas": ["urn:ietf:params:scim:schemas:core:2.0:Group", "urn:mace:surf.nl:sram:scim:extension:Group"], "id": "TestGroup123", "meta": {"created": "2023-05-09T09:28:12.589456", "lastModified": "2023-05-09T09:28:12.602001", "location": "/Groups/848a0f5d-b492-4580-80f1-1950cf7be410", "resourceType": "Group"}}' https://tst-miskatonic.data.surfsara.nl/index.php/apps/federatedgroups/scim/Groups
@T0mWz can you try:
curl -X POST -H 'Content-Type: application/json' -d '{"displayName": "TestGroup123", "externalId": "3f938b6b-cbe0-4856-beb3-91dffa773c15@sram.surf.nl", "members": [{"display": "", "value": "zoete001@surf.nl"}, {"display": "", "value": "wezep001@surf.nl"}, {"display": "", "value": "zoete001@surf.nl"}, {"display": "", "value": "wezep001@surf.nl"}], "urn:mace:surf.nl:sram:scim:extension:Group": {"description": "Provisioned by service Research Drive test - ", "labels": [], "urn": "uniharderwijk:surfdrive_test:srd_test-testgroup"}, "schemas": ["urn:ietf:params:scim:schemas:core:2.0:Group", "urn:mace:surf.nl:sram:scim:extension:Group"], "id": "TestGroup123", "meta": {"created": "2023-05-09T09:28:12.589456", "lastModified": "2023-05-09T09:28:12.602001", "location": "/Groups/848a0f5d-b492-4580-80f1-1950cf7be410", "resourceType": "Group"}}' https://tst-miskatonic.data.surfsara.nl/index.php/apps/federatedgroups/scim/Groups
This make no difference, the response on server side is equal.
{"reqId":"ZH77muNZ8GxfHeVXQQrlcAAAAAU","level":0,"time":"06\/Jun\/2023:11:25:46","remoteAddr":"10.234.2.58","user":"--","app":"no app in context","method":"POST","url":"\/index.php\/apps\/federatedgroups\/scim\/Groups","message":"GroupID TestGroup123 and body: Array\n(\n [displayName] => TestGroup123\n [externalId] => 3f938b6b-cbe0-4856-beb3-91dffa773c15@sram.surf.nl\n [members] => Array\n (\n [0] => Array\n (\n [display] => \n [value] => zoete001@surf.nl\n )\n\n [1] => Array\n (\n [display] => \n [value] => wezep001@surf.nl\n )\n\n [2] => Array\n (\n [display] => \n [value] => zoete001@surf.nl\n )\n\n [3] => Array\n (\n [display] => \n [value] => wezep001@surf.nl\n )\n\n )\n\n [urn:mace:surf.nl:sram:scim:extension:Group] => Array\n (\n [description] => Provisioned by service Research Drive test - \n [labels] => Array\n (\n )\n\n [urn] => uniharderwijk:surfdrive_test:srd_test-testgroup\n )\n\n [schemas] => Array\n (\n [0] => urn:ietf:params:scim:schemas:core:2.0:Group\n [1] => urn:mace:surf.nl:sram:scim:extension:Group\n )\n\n [id] => TestGroup123\n [meta] => Array\n (\n [created] => 2023-05-09T09:28:12.589456\n [lastModified] => 2023-05-09T09:28:12.602001\n [location] => \/Groups\/848a0f5d-b492-4580-80f1-1950cf7be410\n [resourceType] => Group\n )\n\n)\n"}
{"reqId":"ZH77muNZ8GxfHeVXQQrlcAAAAAU","level":0,"time":"06\/Jun\/2023:11:25:46","remoteAddr":"10.234.2.58","user":"--","app":"no app in context","method":"POST","url":"\/index.php\/apps\/federatedgroups\/scim\/Groups","message":"handleUpdateGroup GroupID: "}
{"reqId":"ZH77muNZ8GxfHeVXQQrlcAAAAAU","level":3,"time":"06\/Jun\/2023:11:25:46","remoteAddr":"10.234.2.58","user":"--","app":"index","method":"POST","url":"\/index.php\/apps\/federatedgroups\/scim\/Groups","message":"Exception: {\"Exception\":\"Error\",\"Message\":\"Call to a member function getBackend() on null\",\"Code\":0,\"Trace\":\"#0 \\\/var\\\/www\\\/owncloud\\\/apps\\\/federatedgroups\\\/lib\\\/Controller\\\/ScimController.php(184): OCA\\\\FederatedGroups\\\\Controller\\\\ScimController->handleUpdateGroup()\\n#1 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/AppFramework\\\/Http\\\/Dispatcher.php(169): OCA\\\\FederatedGroups\\\\Controller\\\\ScimController->createGroup()\\n#2 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/AppFramework\\\/Http\\\/Dispatcher.php(89): OC\\\\AppFramework\\\\Http\\\\Dispatcher->executeController()\\n#3 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/AppFramework\\\/App.php(99): OC\\\\AppFramework\\\\Http\\\\Dispatcher->dispatch()\\n#4 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/AppFramework\\\/Routing\\\/RouteActionHandler.php(47): OC\\\\AppFramework\\\\App::main()\\n#5 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/Route\\\/Router.php(344): OC\\\\AppFramework\\\\Routing\\\\RouteActionHandler->__invoke()\\n#6 \\\/var\\\/www\\\/owncloud\\\/lib\\\/base.php(916): OC\\\\Route\\\\Router->match()\\n#7 \\\/var\\\/www\\\/owncloud\\\/index.php(54): OC::handleRequest()\\n#8 {main}\",\"File\":\"\\\/var\\\/www\\\/owncloud\\\/apps\\\/federatedgroups\\\/lib\\\/Controller\\\/ScimController.php\",\"Line\":124}"}
the issue depends on: https://github.com/SURFnet/rd-sram-integration/issues/178