过期权限优化

This commit is contained in:
caoqianming 2021-01-22 14:14:58 +08:00
parent f549469769
commit 13588d91ec
3 changed files with 8 additions and 6 deletions

View File

@ -20,6 +20,7 @@ Page({
msgList: [
{ title: "欢迎使用辐射学堂!" },
{ title: "QQ交流群:1072443859" },
{ title: "首次访问用户有3次自助模考机会" },
{ title: "如有疑问,请致电课程顾问" },
]
},

View File

@ -1,7 +1,7 @@
<view >
<view class="weui-form__text-area" style="margin-top:20px;padding: 0 18px;">
<h2 class="weui-form__title">个人防护用品检测(铅当量)</h2>
<view class="weui-form__desc">中科辐射学堂和国家建材工业安防工程产品质量监督检验中心推出个人防护用品合格检测,免费检测一套个人防护用品,如有需要请提交您的申请。</view>
<view class="weui-form__desc">中科辐射学堂和国家建材工业安防工程产品质量监督检验中心推出个人防护用品合格检测, 如有需要可提交您的申请。</view>
</view>
<view style="text-align:center">
<button class="mini-btn" type="default" size="mini" bindtap="tap1">介绍和案例</button>

View File

@ -50,17 +50,18 @@ class MyPermission(RbacPermission):
else:
perms = get_consumerperm_list(request.user)
if perms:
if 'account_exceed' in perms: #账户过期
if request.user.exceed_date and (request.user.exceed_date >= datetime.date(timezone.now())):
pass
else:
perms = ['questioncat_view','my_examtest','down_material']
if not hasattr(view, 'perms_map'):
return True
elif 'account_exceed' in perms: #账户过期
if request.user.exceed_date and (request.user.exceed_date >= datetime.date(timezone.now())):
return True
return False
else:
perms_map = view.perms_map
_method = request._request.method.lower()
for i in perms_map:
for method, alias in i.items():
if ((_method == method or method == '*') and alias in perms)or alias == '*':
if ((_method == method or method == '*') and alias in perms) or alias == '*':
return True
return False