@Component public class SysAuthorizedDirective extends AbstractTemplateDirective
参数列表
roleIds
:多个角色id
url
url,roleIds、url都存在时,结果返回true
或false
,表示这些角色是否拥有该url的权限
urls
多个url,当roleIds存在,且url为空时生效,结果返回map
(url,true
或false
)
<@sys.authorized roleIds='1,2,3' url='cmsContent/list'>${object}</@sys.authorized>
<@sys.authorized roleIds='1,2,3' urls='cmsContent/list,cmsCategory/list'><#list map as k,v>${k}:${v}<#sep>,</#list></@sys.authorized>
<script> $.getJSON('${site.dynamicPath}api/directive/sys/authorized?roleIds=1,2,3&url=cmsContent/list&appToken=接口访问授权Token', function(data){ console.log(data); }); </script>
限定符和类型 | 字段和说明 |
---|---|
protected ConfigDataComponent |
configDataComponent |
private SysModuleService |
moduleService |
private SysRoleAuthorizedService |
service |
private SysRoleService |
sysRoleService |
ADVANCED, AUTH_TOKEN, AUTH_USER_ID, siteComponent
log
构造器和说明 |
---|
SysAuthorizedDirective() |
限定符和类型 | 方法和说明 |
---|---|
void |
execute(RenderHandler handler) |
boolean |
needAppToken() |
execute, expose, getAdvanced, getApp, getSite, getUserId, needUserToken, supportAdvanced
execute, getName, getNamespace, getShortName, httpEnabled, setName, setNamespace, setShortName
private SysRoleService sysRoleService
protected ConfigDataComponent configDataComponent
private SysModuleService moduleService
private SysRoleAuthorizedService service
public void execute(RenderHandler handler) throws java.io.IOException, freemarker.template.TemplateException
java.io.IOException
freemarker.template.TemplateException
public boolean needAppToken()
needAppToken
在类中 AbstractTemplateDirective