fossology / FOSSologyUI

Repository to hold the new UI framework for FOSSology built with React
https://fossology.github.io/FOSSologyUI/
GNU General Public License v2.0
49 stars 88 forks source link

Clicking on delete user button throws error #195

Closed krishna9304 closed 2 years ago

krishna9304 commented 2 years ago

Description

When I go to admin>user>delete user and select a user and click on delete button after confirming, it breaks the portal and generates error that looks something like below

Steps to reproduce

  1. Click on the admin option from the navbar.
  2. Then click user>Delete user.
  3. Select a user from the list and confirm.
  4. Then click on delete button.

Screenshots

https://user-images.githubusercontent.com/71918441/160529839-5fd261d6-c122-485f-9305-0c926cebf3a6.mov

Versions

Logs

Browser console is generating logs and issues related to cors.

FOSSology logs

web_1 | [Tue Mar 29 03:58:56.724246 2022] [php7:notice] [pid 50] [client 127.0.0.1:49592] [2022-03-29T03:58:56.723926+00:00] default.ERROR: invalid user name [{"file":"/usr/local/share/fossology/www/ui/core-auth.php","line":165,"function":"getUserAndDefaultGroupByUserName","class":"Fossology\\\\Lib\\\\Dao\\\\UserDao","type":"->","args":["Default User"]},{"file":"/usr/local/share/fossology/www/ui/core-auth.php","line":146,"function":"updateSession","class":"core_auth","type":"->","args":["",true]},{"file":"/usr/local/share/fossology/lib/php/Plugin/FO_Plugin.php","line":477,"function":"PostInitialize","class":"core_auth","type":"->","args":[]},{"file":"/usr/local/share/fossology/lib/php/common-plugin.php","line":229,"function":"preInstall","class":"FO_Plugin","type":"->","args":[]},{"file":"/usr/local/share/fossology/www/ui/api/Middlewares/FossologyInitMiddleware.php","line":51,"function":"plugin_preinstall","args":[]},{"file":"/usr/local/share/fossology/vendor/slim/slim/Slim/MiddlewareDispatcher.php","line":313,"function":"__invoke","class":"Fossology\\\\UI\\\\Api\\\\Middlewares\\\\FossologyInitMiddleware","type":"->","args":[{"Slim\\\\Psr7\\\\Request":[]},{"Slim\\\\Routing\\\\RouteRunner":[]}]},{"file":"/usr/local/share/fossology/www/ui/api/Middlewares/RestAuthMiddleware.php","line":58,"function":"handle","class":"class@anonymous\\u0000/usr/local/share/fossology/vendor/slim/slim/Slim/MiddlewareDispatcher.php0xffffa140b686","type":"->","args":[{"Slim\\\\Psr7\\\\Request":[]}]},{"file":"/usr/local/share/fossology/vendor/slim/slim/Slim/MiddlewareDispatcher.php","line":313,"function":"__invoke","class":"Fossology\\\\UI\\\\Api\\\\Middlewares\\\\RestAuthMiddleware","type":"->","args":[{"Slim\\\\Psr7\\\\Request":[]},{"class@anonymous":[]}]},{"file":"/usr/local/share/fossology/vendor/slim/slim/Slim/Middleware/ContentLengthMiddleware.php","line":27,"function":"handle","class":"class@anonymous\\u0000/usr/local/share/fossology/vendor/slim/slim/Slim/MiddlewareDispatcher.php0xffffa140b686","type":"->","args":[{"Slim\\\\Psr7\\\\Request":[]}]},{"file":"/usr/local/share/fossology/vendor/slim/slim/Slim/MiddlewareDispatcher.php","line":147,"function":"process","class":"Slim\\\\Middleware\\\\ContentLengthMiddleware","type":"->","args":[{"Slim\\\\Psr7\\\\Request":[]},{"class@anonymous":[]}]},{"file":"/usr/local/share/fossology/vendor/slim/slim/Slim/Middleware/ErrorMiddleware.php","line":107,"function":"handle","class":"class@anonymous\\u0000/usr/local/share/fossology/vendor/slim/slim/Slim/MiddlewareDispatcher.php0xffffa140a09b","type":"->","args":[{"Slim\\\\Psr7\\\\Request":[]}]},{"file":"/usr/local/share/fossology/vendor/slim/slim/Slim/MiddlewareDispatcher.php","line":147,"function":"process","class":"Slim\\\\Middleware\\\\ErrorMiddleware","type":"->","args":[{"Slim\\\\Psr7\\\\Request":[]},{"class@anonymous":[]}]},{"file":"/usr/local/share/fossology/vendor/slim/slim/Slim/MiddlewareDispatcher.php","line":81,"function":"handle","class":"class@anonymous\\u0000/usr/local/share/fossology/vendor/slim/slim/Slim/MiddlewareDispatcher.php0xffffa140a09b","type":"->","args":[{"Slim\\\\Psr7\\\\Request":[]}]},{"file":"/usr/local/share/fossology/vendor/slim/slim/Slim/App.php","line":215,"function":"handle","class":"Slim\\\\MiddlewareDispatcher","type":"->","args":[{"Slim\\\\Psr7\\\\Request":[]}]},{"file":"/usr/local/share/fossology/vendor/slim/slim/Slim/App.php","line":199,"function":"handle","class":"Slim\\\\App","type":"->","args":[{"Slim\\\\Psr7\\\\Request":[]}]},{"file":"/usr/local/share/fossology/www/ui/api/index.php","line":294,"function":"run","class":"Slim\\\\App","type":"->","args":[]}] []

GMishx commented 2 years ago

The request failed due to cors error. I am not sure how other requests went through.

Also, I am not sure deleting "Default user" and "fossy" are good idea. They are special users in FOSSology. Can you try creating a new user and check if you can delete it?

krishna9304 commented 2 years ago

Yes, I tried adding a user and then deleting it and this time it worked fine.

Also, I have a suggestion that we should disable deletion of the "fossy" and "Delete user" by greying out these options from the dropdown.

The request failed due to cors error. I am not sure how other requests went through.

Also, I am not sure deleting "Default user" and "fossy" are good idea. They are special users in FOSSology. Can you try creating a new user and check if you can delete it?

GMishx commented 2 years ago

Agree, so can you please create a PR for it?

krishna9304 commented 2 years ago

Okay, will be creating one soon.