fastapi-user-auth icon indicating copy to clipboard operation
fastapi-user-auth copied to clipboard

FastAPI-User-Auth is a simple and powerful FastAPI user RBAC authentication and authorization library. Based on FastAPI-Amis-Admin and provides a freely extensible visual management interface.

Results 22 fastapi-user-auth issues
Sort by recently updated
recently updated
newest added

await site.db.async_run_sync(SQLModel.metadata.create_all, is_session=False) sqlalchemy无法初始化自带的auth表,只能用sqlmodel

postgreSQL数据库使用update_casbin_site_grouping方法时,错误如下: sqlalchemy.exc.IntegrityError: (psycopg2.errors.NotNullViolation) null value in column "id" of relation "auth_casbin_rule" violates not-null constraint。 错误原因:fastapi_user_auth\utils\sqlachemy_adapter.py内第134行 values.append(self.parse_rule(ptype, rule).dict()) #导出dict时,包含id字段,id字段为NONE,postgreSQL数据库不允许id为null的数据插入。 未测试建议:能否在导出dict时排除id字段。修改原同行代码为: values.append(self.parse_rule(ptype, rule).dict(exclude={"id"}))

更新到了最新版,发现启动后@app.on_event("startup")执行到“ await site.router.startup() ”时出错,错误信息如下 ``` ERROR: Traceback (most recent call last): File "c:\WebProjects\my_experiments\.venv\Lib\site-packages\sqlalchemy\engine\base.py", line 1900, in _execute_context self.dialect.do_execute( File "c:\WebProjects\my_experiments\.venv\Lib\site-packages\sqlalchemy\engine\default.py", line 736, in do_execute cursor.execute(statement, parameters) File "c:\WebProjects\my_experiments\.venv\Lib\site-packages\sqlalchemy\dialects\sqlite\aiosqlite.py", line 100,...

新环境python3.11 发生异常: TypeError AdminSite.__init__() takes 2 positional arguments but 4 were given 修改为 super().__init__(settings) 成功运行

```python await auth.create_role_user("admin") await auth.create_role_user("root") await auth.enforcer.add_grouping_policy("r:root", "r:admin") # 在dependencies中使用root验证auth.requires("admin")失败 ``` 在auth.has_role_for_user函数中, 能否使用self.enforcer.get_implicit_roles_for_user再自己判定呢? (也看到casbin没有提供has_implicit_roles_for_user了, 可能这其中有效率之类的考虑。如果是我的使用方式有问题, 请告诉我, 非常感谢!)

在使用传入的engine创建AuthAdminSite时, 由于绕过了AsyncDatabase.create函数的commit_on_exit=True, 导致无法创建user (因为没有commit所以被rollback)

用faa 创建的demo,只按照文档添加了AuthAdminSite

Fix "Simple example" typo

``` class AuthSelectArticleAdmin(AuthSelectModelAdmin): page_schema = PageSchema(label="数据集控制文章管理") model = Article select_permissions = [ # 最近7天创建的数据. reverse=True表示反向选择,即默认选择最近7天之内的数据 RecentTimeSelectPerm(name="recent7_create", label="最近7天创建", td=60 * 60 * 24 * 7, reverse=True), # 最近30天创建的数据 RecentTimeSelectPerm(name="recent30_create", label="最近30天创建", td=60...