feat: 增加动态设置当前账户的权限功能;增加该功能演示效果

This commit is contained in:
augushong
2025-04-21 15:54:07 +08:00
parent 81860e8277
commit c1042ce1c6
3 changed files with 59 additions and 3 deletions

View File

@@ -1,4 +1,7 @@
<div lay-id="layuiminiDemoTabIdContent" class="layui-tab-item">
<div
lay-id="layuiminiDemoTabIdContent"
class="layui-tab-item"
>
<!-- var的用法如果变量未声明则声明比如a1 -->
{var name='a1' value='a1' /}
@@ -9,4 +12,24 @@
<!-- 与assign区别即便其他地方已经定义了a3此处仍然会被定义 -->
{assign name='a3' value='a3' /}
{$a3}
<div class="ul-group-title">
动态设置权限
</div>
<pre>
if (date('i') % 2 == 0) {
/** @var AuthService $authService */
$authService = app(AuthService::class);
$authService->disableNode('debug.log/export', false);
}
</pre>
<p>当分钟数为双数时,禁用指定的权限。</p>
<p>
日志导出权限:
{if auth('debug.log/export') }
有权限
{else /}
无权限
{/if}
</p>
<p>{:date('i')}</p>
</div>