perf: 修改依赖版本 (#7666)

* perf: 修复一些错误权限位

* Pr@fix rbac@fix rbac permissions (#7648)

* fix: 确保每次 migrate 执行更新 role permissions

* perf: 修改 choices

* feat: 兼容apple m1

* perf: 修改 migrations role permissions

* perf: pymysql 导入

* perf: admin 判断

* perf: 修改依赖版本

Co-authored-by: ibuler <ibuler@qq.com>
Co-authored-by: Aaron3S <chenyang@fit2cloud.com>
pull/7677/head
fit2bot 2022-02-22 11:48:06 +08:00 committed by Jiangjie.Bai
parent abe5fa9036
commit 534cbf1281
4 changed files with 14 additions and 9 deletions

View File

@ -5,7 +5,7 @@ import json
import os
from collections import defaultdict
from ansible import constants as C
import ansible.constants as C
from ansible.plugins.callback import CallbackBase
from ansible.plugins.callback.default import CallbackModule
from ansible.plugins.callback.minimal import CallbackModule as CMDCallBackModule

View File

@ -98,8 +98,6 @@ class Organization(models.Model):
@lazyproperty
def resource_statistics_cache(self):
# Todo: 由于 redis 问题,没能获取到
return {}
from .caches import OrgResourceStatisticsCache
return OrgResourceStatisticsCache(self)

View File

@ -269,15 +269,22 @@ class RoleMixin:
@lazyproperty
def is_superuser(self):
"""
由于这里用了 cache 所以不能改成 self.system_roles.filter().exists()
"""
from rbac.builtin import BuiltinRole
return self.system_roles.filter(id=BuiltinRole.system_admin.id).exists()
ids = [str(r.id) for r in self.system_roles.all()]
yes = BuiltinRole.system_admin.id in ids
return yes
@lazyproperty
def is_org_admin(self):
from rbac.builtin import BuiltinRole
if self.is_superuser:
return True
return self.org_roles.filter(id=BuiltinRole.org_admin.id).exists()
ids = [str(r.id) for r in self.org_roles.all()]
yes = BuiltinRole.org_admin.id in ids
return yes
@property
def is_staff(self):

View File

@ -1,8 +1,8 @@
amqp==2.5.2
amqp==5.0.9
ansible==2.10
asn1crypto==0.24.0
bcrypt==3.1.4
billiard==3.6.3.0
billiard==3.6.4.0
boto3==1.18.11
botocore==1.21.11
celery==5.2.2
@ -41,7 +41,7 @@ itsdangerous==0.24
itypes==1.1.0
Jinja2==2.11.3
jmespath==0.9.3
kombu==4.6.8
kombu==5.2.2
ldap3==2.4
MarkupSafe==1.1.1
mysqlclient==2.0.1
@ -69,7 +69,7 @@ six==1.11.0
sshpubkeys==3.1.0
uritemplate==3.0.0
urllib3==1.26.5
vine==1.3.0
vine==5.0.0
drf-yasg==1.20.0
Werkzeug==0.15.3
drf-nested-routers==0.91