过期权限优化
This commit is contained in:
parent
f549469769
commit
13588d91ec
|
|
@ -20,6 +20,7 @@ Page({
|
||||||
msgList: [
|
msgList: [
|
||||||
{ title: "欢迎使用辐射学堂!" },
|
{ title: "欢迎使用辐射学堂!" },
|
||||||
{ title: "QQ交流群:1072443859" },
|
{ title: "QQ交流群:1072443859" },
|
||||||
|
{ title: "首次访问用户有3次自助模考机会" },
|
||||||
{ title: "如有疑问,请致电课程顾问" },
|
{ title: "如有疑问,请致电课程顾问" },
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
<view >
|
<view >
|
||||||
<view class="weui-form__text-area" style="margin-top:20px;padding: 0 18px;">
|
<view class="weui-form__text-area" style="margin-top:20px;padding: 0 18px;">
|
||||||
<h2 class="weui-form__title">个人防护用品检测(铅当量)</h2>
|
<h2 class="weui-form__title">个人防护用品检测(铅当量)</h2>
|
||||||
<view class="weui-form__desc">中科辐射学堂和国家建材工业安防工程产品质量监督检验中心推出个人防护用品合格检测,免费检测一套个人防护用品,如有需要请提交您的申请。</view>
|
<view class="weui-form__desc">中科辐射学堂和国家建材工业安防工程产品质量监督检验中心推出个人防护用品合格检测, 如有需要可提交您的申请。</view>
|
||||||
</view>
|
</view>
|
||||||
<view style="text-align:center">
|
<view style="text-align:center">
|
||||||
<button class="mini-btn" type="default" size="mini" bindtap="tap1">介绍和案例</button>
|
<button class="mini-btn" type="default" size="mini" bindtap="tap1">介绍和案例</button>
|
||||||
|
|
|
||||||
|
|
@ -50,17 +50,18 @@ class MyPermission(RbacPermission):
|
||||||
else:
|
else:
|
||||||
perms = get_consumerperm_list(request.user)
|
perms = get_consumerperm_list(request.user)
|
||||||
if perms:
|
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'):
|
if not hasattr(view, 'perms_map'):
|
||||||
return True
|
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:
|
else:
|
||||||
perms_map = view.perms_map
|
perms_map = view.perms_map
|
||||||
_method = request._request.method.lower()
|
_method = request._request.method.lower()
|
||||||
for i in perms_map:
|
for i in perms_map:
|
||||||
for method, alias in i.items():
|
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 True
|
||||||
return False
|
return False
|
||||||
Loading…
Reference in New Issue