codemation / easyauth

Create a centralized Authentication and Authorization token server. Easily secure FastAPI endpoints based on Users, Groups, Roles or Permissions with very little database usage.
https://easyauth.readthedocs.io/en/latest/
MIT License
553 stars 52 forks source link

Import config api doesn't work #88

Closed remydewa closed 1 year ago

remydewa commented 1 year ago

Hello everyone,

I have an issue with the export/import config api. When I export and import the default config I have an exception at the import.

File \"/usr/local/lib/python3.9/dist-packages/easyauth/api.py\", line 110, in import_auth_config\n for action in role[\"permissions\"][\"actions\"]:\nKeyError: 'permissions'"} In my exported config my roles looks like:

"roles": [
    {
      "role": "admin",
      "actions": [
        {
          "action": "CREATE_USER",
          "details": "default action for creating users"
        }
      ]
    }
  ]

It's true I don't have the permissions key.

codemation commented 1 year ago

Hey @remydewa , thanks for reporting, I can see the bug in the code which is preventing the export. Will include fix in next release.

codemation commented 1 year ago

@remydewa - In version 2.0.0 this is now fixed, see documentation on syntax changes required to support latest fastapi version