SURFnet / rd-sram-integration

Research Drive / SURF Research Access Management Integration
2 stars 3 forks source link

UID to long for oc_group_user table #163

Closed T0mWz closed 1 year ago

T0mWz commented 1 year ago
{"reqId":"ZGNllplURIEcE7jovjGGNgAAAA0","level":3,"time":"16\/May\/2023:13:14:31","remoteAddr":"10.234.0.3","user":"--","app":"index","method":"POST","url":"\/index.php\/apps\/federatedgroups\/scim\/Groups","message":"Exception: {\"Excepti
on\":\"Doctrine\\\\DBAL\\\\Exception\\\\DriverException\",\"Message\":\"An exception occurred while executing 'INSERT INTO `oc_group_user` (`uid`, `gid`) VALUES(?, ?)' with params [\\\"afad2da3-2815-466d-8fd0-74b1573e0687@eduid.nl#tst-ape
rture.data.surfsara.nl\\\", \\\"Demo collaboration (uniharderwijk_democollab) (SRAM CO)\\\"]:\\n\\nSQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 'uid' at row 1\",\"Code\":0,\"Trace\":\"#0 \\\/var\\\/www\\\/o
wncloud\\\/lib\\\/composer\\\/doctrine\\\/dbal\\\/lib\\\/Doctrine\\\/DBAL\\\/DBALException.php(182): Doctrine\\\\DBAL\\\\Driver\\\\AbstractMySQLDriver->convertException()\\n#1 \\\/var\\\/www\\\/owncloud\\\/lib\\\/composer\\\/doctrine\\\/d
bal\\\/lib\\\/Doctrine\\\/DBAL\\\/DBALException.php(159): Doctrine\\\\DBAL\\\\DBALException::wrapException()\\n#2 \\\/var\\\/www\\\/owncloud\\\/lib\\\/composer\\\/doctrine\\\/dbal\\\/lib\\\/Doctrine\\\/DBAL\\\/Connection.php(2226): Doctri
ne\\\\DBAL\\\\DBALException::driverExceptionDuringQuery()\\n#3 \\\/var\\\/www\\\/owncloud\\\/lib\\\/composer\\\/doctrine\\\/dbal\\\/lib\\\/Doctrine\\\/DBAL\\\/Connection.php(1538): Doctrine\\\\DBAL\\\\Connection->handleExceptionDuringQuer
y()\\n#4 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/DB\\\/Connection.php(238): Doctrine\\\\DBAL\\\\Connection->executeStatement()\\n#5 \\\/var\\\/www\\\/owncloud\\\/lib\\\/composer\\\/doctrine\\\/dbal\\\/lib\\\/Doctrine\\\/DBAL\\\/Qu
ery\\\/QueryBuilder.php(216): OC\\\\DB\\\\Connection->executeStatement()\\n#6 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/DB\\\/QueryBuilder\\\/QueryBuilder.php(141): Doctrine\\\\DBAL\\\\Query\\\\QueryBuilder->execute()\\n#7 \\\/var\\
\/www\\\/owncloud\\\/lib\\\/private\\\/Group\\\/Database.php(179): OC\\\\DB\\\\QueryBuilder\\\\QueryBuilder->execute()\\n#8 \\\/var\\\/www\\\/owncloud\\\/apps\\\/federatedgroups\\\/lib\\\/Controller\\\/ScimController.php(147): OC\\\\Group
\\\\Database->addToGroup()\\n#9 \\\/var\\\/www\\\/owncloud\\\/apps\\\/federatedgroups\\\/lib\\\/Controller\\\/ScimController.php(165): OCA\\\\FederatedGroups\\\\Controller\\\\ScimController->handleUpdateGroup()\\n#10 \\\/var\\\/www\\\/own
cloud\\\/lib\\\/private\\\/AppFramework\\\/Http\\\/Dispatcher.php(169): OCA\\\\FederatedGroups\\\\Controller\\\\ScimController->createGroup()\\n#11 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/AppFramework\\\/Http\\\/Dispatcher.php(89)
: OC\\\\AppFramework\\\\Http\\\\Dispatcher->executeController()\\n#12 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/AppFramework\\\/App.php(99): OC\\\\AppFramework\\\\Http\\\\Dispatcher->dispatch()\\n#13 \\\/var\\\/www\\\/owncloud\\\/li
b\\\/private\\\/AppFramework\\\/Routing\\\/RouteActionHandler.php(47): OC\\\\AppFramework\\\\App::main()\\n#14 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/Route\\\/Router.php(344): OC\\\\AppFramework\\\\Routing\\\\RouteActionHandler->
__invoke()\\n#15 \\\/var\\\/www\\\/owncloud\\\/lib\\\/base.php(916): OC\\\\Route\\\\Router->match()\\n#16 \\\/var\\\/www\\\/owncloud\\\/index.php(54): OC::handleRequest()\\n#17 {main}\",\"File\":\"\\\/var\\\/www\\\/owncloud\\\/lib\\\/comp
oser\\\/doctrine\\\/dbal\\\/lib\\\/Doctrine\\\/DBAL\\\/Driver\\\/AbstractMySQLDriver.php\",\"Line\":128}"}
{"reqId":"ZGNllplURIEcE7jovjGGNgAAAA0","level":3,"time":"16\/May\/2023:13:14:31","remoteAddr":"10.234.0.3","user":"--","app":"index","method":"POST","url":"\/index.php\/apps\/federatedgroups\/scim\/Groups","message":"Caused by: {\"Excepti
on\":\"Doctrine\\\\DBAL\\\\Driver\\\\PDO\\\\Exception\",\"Message\":\"SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 'uid' at row 1\",\"Code\":\"22001\",\"Trace\":\"#0 \\\/var\\\/www\\\/owncloud\\\/lib\\\/com
poser\\\/doctrine\\\/dbal\\\/lib\\\/Doctrine\\\/DBAL\\\/Driver\\\/PDOStatement.php(119): Doctrine\\\\DBAL\\\\Driver\\\\PDO\\\\Exception::new()\\n#1 \\\/var\\\/www\\\/owncloud\\\/lib\\\/composer\\\/doctrine\\\/dbal\\\/lib\\\/Doctrine\\\/DB
AL\\\/Connection.php(1527): Doctrine\\\\DBAL\\\\Driver\\\\PDOStatement->execute()\\n#2 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/DB\\\/Connection.php(238): Doctrine\\\\DBAL\\\\Connection->executeStatement()\\n#3 \\\/var\\\/www\\\/ow
ncloud\\\/lib\\\/composer\\\/doctrine\\\/dbal\\\/lib\\\/Doctrine\\\/DBAL\\\/Query\\\/QueryBuilder.php(216): OC\\\\DB\\\\Connection->executeStatement()\\n#4 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/DB\\\/QueryBuilder\\\/QueryBuilder
.php(141): Doctrine\\\\DBAL\\\\Query\\\\QueryBuilder->execute()\\n#5 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/Group\\\/Database.php(179): OC\\\\DB\\\\QueryBuilder\\\\QueryBuilder->execute()\\n#6 \\\/var\\\/www\\\/owncloud\\\/apps\\
\/federatedgroups\\\/lib\\\/Controller\\\/ScimController.php(147): OC\\\\Group\\\\Database->addToGroup()\\n#7 \\\/var\\\/www\\\/owncloud\\\/apps\\\/federatedgroups\\\/lib\\\/Controller\\\/ScimController.php(165): OCA\\\\FederatedGroups\\\
\Controller\\\\ScimController->handleUpdateGroup()\\n#8 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/AppFramework\\\/Http\\\/Dispatcher.php(169): OCA\\\\FederatedGroups\\\\Controller\\\\ScimController->createGroup()\\n#9 \\\/var\\\/www
\\\/owncloud\\\/lib\\\/private\\\/AppFramework\\\/Http\\\/Dispatcher.php(89): OC\\\\AppFramework\\\\Http\\\\Dispatcher->executeController()\\n#10 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/AppFramework\\\/App.php(99): OC\\\\AppFramew
ork\\\\Http\\\\Dispatcher->dispatch()\\n#11 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/AppFramework\\\/Routing\\\/RouteActionHandler.php(47): OC\\\\AppFramework\\\\App::main()\\n#12 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/Rou
te\\\/Router.php(344): OC\\\\AppFramework\\\\Routing\\\\RouteActionHandler->__invoke()\\n#13 \\\/var\\\/www\\\/owncloud\\\/lib\\\/base.php(916): OC\\\\Route\\\\Router->match()\\n#14 \\\/var\\\/www\\\/owncloud\\\/index.php(54): OC::handleR
equest()\\n#15 {main}\",\"File\":\"\\\/var\\\/www\\\/owncloud\\\/lib\\\/composer\\\/doctrine\\\/dbal\\\/lib\\\/Doctrine\\\/DBAL\\\/Driver\\\/PDO\\\/Exception.php\",\"Line\":18}"}
{"reqId":"ZGNllplURIEcE7jovjGGNgAAAA0","level":3,"time":"16\/May\/2023:13:14:31","remoteAddr":"10.234.0.3","user":"--","app":"index","method":"POST","url":"\/index.php\/apps\/federatedgroups\/scim\/Groups","message":"Caused by: {\"Excepti
on\":\"PDOException\",\"Message\":\"SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 'uid' at row 1\",\"Code\":\"22001\",\"Trace\":\"#0 \\\/var\\\/www\\\/owncloud\\\/lib\\\/composer\\\/doctrine\\\/dbal\\\/lib\\
\/Doctrine\\\/DBAL\\\/Driver\\\/PDOStatement.php(117): PDOStatement->execute()\\n#1 \\\/var\\\/www\\\/owncloud\\\/lib\\\/composer\\\/doctrine\\\/dbal\\\/lib\\\/Doctrine\\\/DBAL\\\/Connection.php(1527): Doctrine\\\\DBAL\\\\Driver\\\\PDOSta
tement->execute()\\n#2 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/DB\\\/Connection.php(238): Doctrine\\\\DBAL\\\\Connection->executeStatement()\\n#3 \\\/var\\\/www\\\/owncloud\\\/lib\\\/composer\\\/doctrine\\\/dbal\\\/lib\\\/Doctrine
\\\/DBAL\\\/Query\\\/QueryBuilder.php(216): OC\\\\DB\\\\Connection->executeStatement()\\n#4 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/DB\\\/QueryBuilder\\\/QueryBuilder.php(141): Doctrine\\\\DBAL\\\\Query\\\\QueryBuilder->execute()\
\n#5 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/Group\\\/Database.php(179): OC\\\\DB\\\\QueryBuilder\\\\QueryBuilder->execute()\\n#6 \\\/var\\\/www\\\/owncloud\\\/apps\\\/federatedgroups\\\/lib\\\/Controller\\\/ScimController.php(147
): OC\\\\Group\\\\Database->addToGroup()\\n#7 \\\/var\\\/www\\\/owncloud\\\/apps\\\/federatedgroups\\\/lib\\\/Controller\\\/ScimController.php(165): OCA\\\\FederatedGroups\\\\Controller\\\\ScimController->handleUpdateGroup()\\n#8 \\\/var\
\\/www\\\/owncloud\\\/lib\\\/private\\\/AppFramework\\\/Http\\\/Dispatcher.php(169): OCA\\\\FederatedGroups\\\\Controller\\\\ScimController->createGroup()\\n#9 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/AppFramework\\\/Http\\\/Dispat
cher.php(89): OC\\\\AppFramework\\\\Http\\\\Dispatcher->executeController()\\n#10 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/AppFramework\\\/App.php(99): OC\\\\AppFramework\\\\Http\\\\Dispatcher->dispatch()\\n#11 \\\/var\\\/www\\\/ow
ncloud\\\/lib\\\/private\\\/AppFramework\\\/Routing\\\/RouteActionHandler.php(47): OC\\\\AppFramework\\\\App::main()\\n#12 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/Route\\\/Router.php(344): OC\\\\AppFramework\\\\Routing\\\\RouteAct
ionHandler->__invoke()\\n#13 \\\/var\\\/www\\\/owncloud\\\/lib\\\/base.php(916): OC\\\\Route\\\\Router->match()\\n#14 \\\/var\\\/www\\\/owncloud\\\/index.php(54): OC::handleRequest()\\n#15 {main}\",\"File\":\"\\\/var\\\/www\\\/owncloud\\\
/lib\\\/composer\\\/doctrine\\\/dbal\\\/lib\\\/Doctrine\\\/DBAL\\\/Driver\\\/PDOStatement.php\",\"Line\":117}"}
T0mWz commented 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)
yasharpm commented 1 year ago

We can take 2 approaches to solve this:

  1. Make a migration (to our app) that alters the 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.
  2. Implement a new user backend for OC user manager. The code can be identical to the OC source except the table name is different.

I think solution 1 is the best quickest way to approach it. @michiel-testing @navid-shokri @soltanireza65 what do you think?

soltanireza65 commented 1 year ago

I do agree more with option number one Increasing a column size shouldn't affect anything at all

yasharpm commented 1 year ago

This pull request fixes this issue.

yasharpm commented 1 year ago

@T0mWz it is now merged into the main branch. Feel free to close this issue after you verify :blush:

T0mWz commented 1 year ago

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}"}
yasharpm commented 1 year ago

Can you share the request you are sending?

T0mWz commented 1 year ago

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
yasharpm commented 1 year ago

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.

T0mWz commented 1 year ago

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
T0mWz commented 1 year ago
        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 ?

michielbdejong commented 1 year ago

Maybe $this->groupBackend->createGroup($groupId); is failing silently?

michielbdejong commented 1 year ago

@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 commented 1 year ago

@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}"}
soltanireza65 commented 1 year ago

the issue depends on: https://github.com/SURFnet/rd-sram-integration/issues/178