实现shiro hasanypermission不改jar包有没有别的方法
答案:2 悬赏:0 手机版
解决时间 2021-04-19 07:53
- 提问者网友:缘字诀
- 2021-04-18 12:58
实现shiro hasanypermission不改jar包有没有别的方法
最佳答案
- 五星知识达人网友:北城痞子
- 2021-04-18 13:35
import org.apache.shiro.subject.Subject;
import org.apache.shiro.web.tags.PermissionTag;
public class HasAnyPermissionsTag extends PermissionTag {
private static final long serialVersionUID = 1L;
private static final String PERMISSION_NAMES_DELIMETER = ",";
@Override
protected boolean showTagBody(String permissionNames) {
boolean hasAnyPermission = false;
Subject subject = getSubject();
if (subject != null) {
// Iterate through permissions and check to see if the user has one of the permissions
for (String permission : permissionNames.split(PERMISSION_NAMES_DELIMETER)) {
if (subject.isPermitted(permission.trim())) {
hasAnyPermission = true;
break;
}
}
}
return hasAnyPermission;
}
}
import org.apache.shiro.web.tags.PermissionTag;
public class HasAnyPermissionsTag extends PermissionTag {
private static final long serialVersionUID = 1L;
private static final String PERMISSION_NAMES_DELIMETER = ",";
@Override
protected boolean showTagBody(String permissionNames) {
boolean hasAnyPermission = false;
Subject subject = getSubject();
if (subject != null) {
// Iterate through permissions and check to see if the user has one of the permissions
for (String permission : permissionNames.split(PERMISSION_NAMES_DELIMETER)) {
if (subject.isPermitted(permission.trim())) {
hasAnyPermission = true;
break;
}
}
}
return hasAnyPermission;
}
}
全部回答
- 1楼网友:詩光轨車
- 2021-04-18 14:23
请在此输入您的回答
[html] view plain copy print?
com.github.theborakompanioni
thymeleaf-extras-shiro
1.0.2
[html] view plain copy print?
thymeleaf-extras-shiro
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯