Skip to content

Commit

Permalink
v0.6.1
Browse files Browse the repository at this point in the history
  • Loading branch information
amisadmin committed Sep 16, 2023
1 parent 0e049d7 commit f57c457
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 10 deletions.
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,15 @@ site.mount_app(app)
@app.on_event("startup")
async def startup():
await site.db.async_run_sync(SQLModel.metadata.create_all, is_session=False)
# 创建默认管理员,用户名: root,密码: root, 请及时修改密码!!!
await auth.create_role_user('root')
await auth.create_role_user('admin')
# 创建默认管理员,用户名: admin,密码: admin, 请及时修改密码!!!
await auth.create_role_user("admin")
# 创建默认超级管理员,用户名: root,密码: root, 请及时修改密码!!!
await auth.create_role_user("root")
# 运行site的startup方法,加载casbin策略等
await site.router.startup()
# 添加一条默认的casbin规则
if not auth.enforcer.enforce("u:admin", site.unique_id, "page", "page"):
await auth.enforcer.add_policy("u:admin", site.unique_id, "page", "page", "allow")


# 要求: 用户必须登录
Expand Down Expand Up @@ -140,8 +144,6 @@ def admin_or_vip_roles(request: Request):

```python
from fastapi import Depends
from typing import Tuple
from fastapi_user_auth.auth import Auth
from fastapi_user_auth.auth.models import User


Expand Down
2 changes: 1 addition & 1 deletion fastapi_user_auth/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = "0.6.1a7"
__version__ = "0.6.1"
__url__ = "https://github.com/amisadmin/fastapi_user_auth"

import gettext
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ classifiers = [
"Programming Language :: Python :: 3.11",
]
dependencies = [
"pydantic>=1.9.0,<2.0.0",
"fastapi-amis-admin>=0.6.5a2,<0.7.0",
"pydantic>=1.10.0,<2.0.0",
"fastapi-amis-admin>=0.6.5,<0.7.0",
"email-validator>=1.3.1,<2.0.0",
"passlib>=1.7.4",
"bcrypt>=4.0.0",
Expand Down
4 changes: 2 additions & 2 deletions tests/test_mixins/admin.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from typing import List, Optional

from fastapi_amis_admin import admin
from fastapi_amis_admin.admin import RecentTimeSelectPerm, SelectPerm, SimpleSelectPerm, UserSelectPerm
from fastapi_amis_admin.admin import FieldPermEnum, RecentTimeSelectPerm, SelectPerm, SimpleSelectPerm, UserSelectPerm
from fastapi_amis_admin.amis import PageSchema
from fastapi_amis_admin.models import Field
from sqlalchemy import Column, Text
Expand All @@ -24,7 +24,7 @@ class AuthFieldArticleAdmin(AuthFieldModelAdmin, admin.ModelAdmin):
page_schema = PageSchema(label="字段控制文章管理")
model = Article
perm_fields_exclude = {
"create": ["title", "description", "content"],
FieldPermEnum.CREATE: ["title", "description", "content"],
}


Expand Down

0 comments on commit f57c457

Please sign in to comment.