public void assertHasAnyPermission(String[] permissions, String errorCode) {
if (StringUtils.isEmpty(errorCode)) {
errorCode = getDefaultErrorCode();
}
if (permissions == null || permissions.length == 0) {
throw new UnauthorizedException(MessageUtils.message(errorCode, resourceIdentity + ":" + Arrays.toString(permissions)));
}
Subject subject = SecurityUtils.getSubject();
for (String permission : permissions) {
String resourcePermission = resourcePermissions.get(permission);
if (resourcePermission == null) {
resourcePermission = this.resourceIdentity + ":" + permission;
}
if (subject.isPermitted(resourcePermission)) {
return;
}
}
throw new UnauthorizedException(MessageUtils.message(errorCode, resourceIdentity + ":" + Arrays.toString(permissions)));
}