You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ranger.apache.org by "kumaab (via GitHub)" <gi...@apache.org> on 2024/10/09 06:27:49 UTC
Re: [PR] RANGER-4607: Ranger REST API improvements [ranger]
kumaab commented on code in PR #393:
URL: https://github.com/apache/ranger/pull/393#discussion_r1792913986
##########
security-admin/src/main/java/org/apache/ranger/biz/XAuditMgr.java:
##########
@@ -52,8 +52,11 @@ public class XAuditMgr extends XAuditMgrBase {
RangerBizUtil rangerBizUtil;
public VXTrxLog getXTrxLog(Long id) {
- checkAdminAccess();
- return super.getXTrxLog(id);
+ if (rangerBizUtil.isAdmin() || rangerBizUtil.isKeyAdmin() || rangerBizUtil.isAuditAdmin() || rangerBizUtil.isAuditKeyAdmin()) {
Review Comment:
Please see if a private function can be re-used at lines 55, 81 and 90, for eg:
```
private boolean checkAdminAccess(){
if (rangerBizUtil.isAdmin() || rangerBizUtil.isKeyAdmin() || rangerBizUtil.isAuditAdmin() || rangerBizUtil.isAuditKeyAdmin()){
return true;
} else {
throw restErrorUtil.createRESTException(HttpServletResponse.SC_FORBIDDEN, "User doesn't have permissions to perform this action", true);
}
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@ranger.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org