You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ranger.apache.org by me...@apache.org on 2017/06/15 11:25:27 UTC
ranger git commit: RANGER-1555 Ranger UI : Audit Menu-> Admin tab
diff view pop-up does not come up.
Repository: ranger
Updated Branches:
refs/heads/master 42657fdb8 -> 57783900c
RANGER-1555 Ranger UI : Audit Menu-> Admin tab diff view pop-up does not come up.
Project: http://git-wip-us.apache.org/repos/asf/ranger/repo
Commit: http://git-wip-us.apache.org/repos/asf/ranger/commit/57783900
Tree: http://git-wip-us.apache.org/repos/asf/ranger/tree/57783900
Diff: http://git-wip-us.apache.org/repos/asf/ranger/diff/57783900
Branch: refs/heads/master
Commit: 57783900cad2d2a28f47e36ebea3864b8ffe38bd
Parents: 42657fd
Author: Nitin Galave <ni...@gmail.com>
Authored: Wed Jun 7 13:40:14 2017 +0530
Committer: Mehul Parikh <me...@apache.org>
Committed: Thu Jun 15 16:54:45 2017 +0530
----------------------------------------------------------------------
.../java/org/apache/ranger/biz/AssetMgr.java | 73 +++++++------
.../ranger/service/RangerPolicyService.java | 74 ++++++++++---
.../scripts/views/policies/RangerPolicyForm.js | 29 +++--
.../views/reports/PlugableServiceDiffDetail.js | 108 ++++++++-----------
security-admin/src/main/webapp/styles/xa.css | 10 +-
.../KnoxPolicyDeleteOperationDiff_tmpl.html | 4 +-
.../reports/KnoxPolicyOperationDiff_tmpl.html | 4 +-
.../KnoxPolicyUpdateOperationDiff_tmpl.html | 4 +-
.../PlugableServicePolicyDeleteDiff_tmpl.html | 79 +++++++++++++-
.../reports/PlugableServicePolicyDiff_tmpl.html | 8 +-
.../PlugableServicePolicyUpdateDiff_tmpl.html | 6 +-
.../reports/PolicyDeleteOperationDiff_tmpl.html | 4 +-
.../reports/PolicyOperationDiff_tmpl.html | 4 +-
.../reports/PolicyUpdateOperationDiff_tmpl.html | 4 +-
14 files changed, 275 insertions(+), 136 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ranger/blob/57783900/security-admin/src/main/java/org/apache/ranger/biz/AssetMgr.java
----------------------------------------------------------------------
diff --git a/security-admin/src/main/java/org/apache/ranger/biz/AssetMgr.java b/security-admin/src/main/java/org/apache/ranger/biz/AssetMgr.java
index 01062de..7d1573d 100644
--- a/security-admin/src/main/java/org/apache/ranger/biz/AssetMgr.java
+++ b/security-admin/src/main/java/org/apache/ranger/biz/AssetMgr.java
@@ -183,7 +183,7 @@ public class AssetMgr extends AssetMgrBase {
public String getLatestRepoPolicy(VXAsset xAsset, List<VXResource> xResourceList, Long updatedTime,
X509Certificate[] certchain, boolean httpEnabled, String epoch,
String ipAddress, boolean isSecure, String count, String agentId) {
- if(xAsset==null){
+ if(xAsset == null) {
logger.error("Requested repository not found");
throw restErrorUtil.createRESTException("No Data Found.",
MessageEnums.DATA_NOT_FOUND);
@@ -193,7 +193,7 @@ public class AssetMgr extends AssetMgrBase {
throw restErrorUtil.createRESTException("No Data Found.",
MessageEnums.DATA_NOT_FOUND);
}
- if(xAsset.getActiveStatus()==RangerCommonEnums.ACT_STATUS_DISABLED){
+ if(xAsset.getActiveStatus() == RangerCommonEnums.ACT_STATUS_DISABLED) {
logger.error("Requested repository is disabled");
throw restErrorUtil.createRESTException("Unauthorized access.",
MessageEnums.OPER_NO_EXPORT);
@@ -520,7 +520,7 @@ public class AssetMgr extends AssetMgrBase {
if (groupId != null) {
Set<String> groups = (Set<String>) sortedPermMap.get("groups");
- if(groups != null){
+ if(groups != null) {
groups.add(xPermMap.getGroupName());
sortedPermMap.put("groups", groups);
}
@@ -552,12 +552,12 @@ public class AssetMgr extends AssetMgrBase {
sortedPermMap.put("access", permSet);
- if(assetType == AppConstants.ASSET_KNOX){
+ if(assetType == AppConstants.ASSET_KNOX) {
String[] ipAddrList = new String[0];
- if(xPermMap.getIpAddress() != null){
+ if(xPermMap.getIpAddress() != null) {
ipAddrList = xPermMap.getIpAddress().split(",");
sortedPermMap.put("ipAddress", ipAddrList);
- }else
+ } else
sortedPermMap.put("ipAddress",ipAddrList);
}
@@ -709,7 +709,7 @@ public class AssetMgr extends AssetMgrBase {
private void createOrUpdatePluginInfo(final RangerPluginInfo pluginInfo, final boolean isPolicyDownloadRequest, final int httpCode) {
if (logger.isDebugEnabled()) {
- logger.debug("==> createOrUpdatePluginInfo(pluginInfo=" + pluginInfo + ", isPolicyDownloadRequest=" + isPolicyDownloadRequest + ", httpCode=" + httpCode + ")");
+ logger.debug("==> createOrUpdatePluginInfo(pluginInfo = " + pluginInfo + ", isPolicyDownloadRequest = " + isPolicyDownloadRequest + ", httpCode = " + httpCode + ")");
}
final boolean isTagVersionResetNeeded;
@@ -757,7 +757,7 @@ public class AssetMgr extends AssetMgrBase {
doCreateOrUpdateXXPluginInfo(pluginInfo, isPolicyDownloadRequest, isTagVersionResetNeeded);
}
if (logger.isDebugEnabled()) {
- logger.debug("<== createOrUpdatePluginInfo(pluginInfo=" + pluginInfo + ", isPolicyDownloadRequest=" + isPolicyDownloadRequest + ", httpCode=" + httpCode + ")");
+ logger.debug("<== createOrUpdatePluginInfo(pluginInfo = " + pluginInfo + ", isPolicyDownloadRequest = " + isPolicyDownloadRequest + ", httpCode = " + httpCode + ")");
}
}
@@ -925,11 +925,11 @@ public class AssetMgr extends AssetMgrBase {
searchCriteria.getParamList().put("endDate", temp);
}
if (searchCriteria.getParamList().containsKey("owner")) {
- XXPortalUser xXPortalUser= rangerDaoManager.getXXPortalUser().findByLoginId(
+ XXPortalUser xXPortalUser = rangerDaoManager.getXXPortalUser().findByLoginId(
(searchCriteria.getParamList().get("owner").toString()));
- if(xXPortalUser!=null){
+ if(xXPortalUser != null) {
searchCriteria.getParamList().put("owner", xXPortalUser.getId());
- }else{
+ } else {
searchCriteria.getParamList().put("owner", 0);
}
@@ -939,7 +939,7 @@ public class AssetMgr extends AssetMgrBase {
VXTrxLogList vXTrxLogList = xTrxLogService
.searchXTrxLogs(searchCriteria);
- Long count=xTrxLogService
+ Long count = xTrxLogService
.searchXTrxLogsCount(searchCriteria);
vXTrxLogList.setTotalCount(count);
@@ -1007,48 +1007,59 @@ public class AssetMgr extends AssetMgrBase {
for (VXTrxLog xTrxLog : xTrxLogList) {
VXTrxLog vXTrxLog = new VXTrxLog();
vXTrxLog = xTrxLog;
- if(vXTrxLog.getPreviousValue()==null || "null".equalsIgnoreCase(vXTrxLog.getPreviousValue())){
+ if(vXTrxLog.getPreviousValue() == null || "null".equalsIgnoreCase(vXTrxLog.getPreviousValue())) {
vXTrxLog.setPreviousValue("");
}
- if(vXTrxLog.getAttributeName()!=null && "Password".equalsIgnoreCase(vXTrxLog.getAttributeName())){
+ if(vXTrxLog.getNewValue() == null || "null".equalsIgnoreCase(vXTrxLog.getNewValue())) {
+ vXTrxLog.setNewValue("");
+ }
+ if(vXTrxLog.getAttributeName() != null && "Password".equalsIgnoreCase(vXTrxLog.getAttributeName())) {
vXTrxLog.setPreviousValue("*********");
vXTrxLog.setNewValue("***********");
}
- if(vXTrxLog.getAttributeName()!=null && "Connection Configurations".equalsIgnoreCase(vXTrxLog.getAttributeName())){
- if(vXTrxLog.getPreviousValue()!=null && vXTrxLog.getPreviousValue().contains("password")){
- String tempPreviousStr=vXTrxLog.getPreviousValue();
- String tempPreviousArr[]=vXTrxLog.getPreviousValue().split(",");
- for(int i=0;i<tempPreviousArr.length;i++){
- if(tempPreviousArr[i].contains("{\"password")){
- vXTrxLog.setPreviousValue(tempPreviousStr.replace(tempPreviousArr[i], "{\"password\":\"*****\"}"));
+ if(vXTrxLog.getAttributeName() != null && "Connection Configurations".equalsIgnoreCase(vXTrxLog.getAttributeName())) {
+ if(vXTrxLog.getPreviousValue() != null && vXTrxLog.getPreviousValue().contains("password")) {
+ String tempPreviousStr = vXTrxLog.getPreviousValue();
+ String tempPreviousArr[] = vXTrxLog.getPreviousValue().split(",");
+ for(int i = 0; i < tempPreviousArr.length; i++) {
+ if(tempPreviousArr[i].contains("{\"password") && tempPreviousArr[i].contains("}")) {
+ vXTrxLog.setPreviousValue(tempPreviousStr.replace(tempPreviousArr[i],"{\"password\":\"*****\"}"));
+ break;
+ } else if(tempPreviousArr[i].contains("{\"password")) {
+ vXTrxLog.setPreviousValue(tempPreviousStr.replace(tempPreviousArr[i], "{\"password\":\"*****\""));
break;
- }else if(tempPreviousArr[i].contains("\"password") && tempPreviousArr[i].contains("}")){
+ } else if(tempPreviousArr[i].contains("\"password") && tempPreviousArr[i].contains("}")) {
vXTrxLog.setPreviousValue(tempPreviousStr.replace(tempPreviousArr[i], "\"password\":\"******\"}"));
break;
- }else if(tempPreviousArr[i].contains("\"password")){
+ } else if(tempPreviousArr[i].contains("\"password")) {
vXTrxLog.setPreviousValue(tempPreviousStr.replace(tempPreviousArr[i], "\"password\":\"******\""));
break;
}
}
}
- if(vXTrxLog.getNewValue()!=null && vXTrxLog.getNewValue().contains("password")){
- String tempNewStr=vXTrxLog.getNewValue();
- String tempNewArr[]=vXTrxLog.getNewValue().split(",");
- for(int i=0;i<tempNewArr.length;i++){
- if(tempNewArr[i].contains("{\"password")){
+ if(vXTrxLog.getNewValue() != null && vXTrxLog.getNewValue().contains("password")) {
+ String tempNewStr = vXTrxLog.getNewValue();
+ String tempNewArr[] = vXTrxLog.getNewValue().split(",");
+ for(int i = 0; i < tempNewArr.length; i++) {
+ if(tempNewArr[i].contains("{\"password") && tempNewArr[i].contains("}")) {
+ vXTrxLog.setNewValue(tempNewStr.replace(tempNewArr[i], "{\"password\":\"*****\"}"));
+ break;
+ } else if(tempNewArr[i].contains("{\"password")) {
vXTrxLog.setNewValue(tempNewStr.replace(tempNewArr[i], "{\"password\":\"*****\""));
break;
- }else if(tempNewArr[i].contains("\"password") && tempNewArr[i].contains("}")){
+ } else if(tempNewArr[i].contains("\"password") && tempNewArr[i].contains("}")) {
vXTrxLog.setNewValue(tempNewStr.replace(tempNewArr[i], "\"password\":\"******\"}"));
break;
- }else if(tempNewArr[i].contains("\"password")){
+ } else if(tempNewArr[i].contains("\"password")) {
vXTrxLog.setNewValue(tempNewStr.replace(tempNewArr[i], "\"password\":\"******\""));
break;
}
}
}
}
- vXTrxLogs.add(vXTrxLog);
+ if(vXTrxLog.getPreviousValue() != null && !vXTrxLog.getPreviousValue().isEmpty() || vXTrxLog.getNewValue() != null && !vXTrxLog.getNewValue().isEmpty()) {
+ vXTrxLogs.add(vXTrxLog);
+ }
}
return vXTrxLogs;
}
http://git-wip-us.apache.org/repos/asf/ranger/blob/57783900/security-admin/src/main/java/org/apache/ranger/service/RangerPolicyService.java
----------------------------------------------------------------------
diff --git a/security-admin/src/main/java/org/apache/ranger/service/RangerPolicyService.java b/security-admin/src/main/java/org/apache/ranger/service/RangerPolicyService.java
index ede73bf..f55a103 100644
--- a/security-admin/src/main/java/org/apache/ranger/service/RangerPolicyService.java
+++ b/security-admin/src/main/java/org/apache/ranger/service/RangerPolicyService.java
@@ -24,6 +24,8 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import org.apache.ranger.entity.XXDataMaskTypeDef;
+import org.apache.commons.collections.CollectionUtils;
import org.apache.ranger.biz.RangerPolicyRetriever;
import org.apache.ranger.common.AppConstants;
import org.apache.ranger.common.JSONUtil;
@@ -125,7 +127,7 @@ public class RangerPolicyService extends RangerPolicyServiceBase<XXPolicy, Range
return this.populateViewBean(xPolicy);
}
- public List<XXTrxLog> getTransactionLog(RangerPolicy vPolicy, int action){
+ public List<XXTrxLog> getTransactionLog(RangerPolicy vPolicy, int action) {
return getTransactionLog(vPolicy, null, action);
}
@@ -195,17 +197,37 @@ public class RangerPolicyService extends RangerPolicyServiceBase<XXPolicy, Range
value = processPolicyItemsForTrxLog(field.get(vObj));
} else if (DENYPOLICY_ITEM_CLASS_FIELD_NAME.equalsIgnoreCase(fieldName)) {
value = processPolicyItemsForTrxLog(field.get(vObj));
- } else if (POLICY_NAME_CLASS_FIELD_NAME.equalsIgnoreCase(fieldName)){
+ } else if (POLICY_NAME_CLASS_FIELD_NAME.equalsIgnoreCase(fieldName)) {
value = processPolicyNameForTrxLog(field.get(vObj));
- } else if (ALLOW_EXCEPTIONS_CLASS_FIELD_NAME.equalsIgnoreCase(fieldName)){
+ } else if (ALLOW_EXCEPTIONS_CLASS_FIELD_NAME.equalsIgnoreCase(fieldName)) {
value = processPolicyItemsForTrxLog(field.get(vObj));
- } else if (DENY_EXCEPTIONS_CLASS_FIELD_NAME.equalsIgnoreCase(fieldName)){
+ } else if (DENY_EXCEPTIONS_CLASS_FIELD_NAME.equalsIgnoreCase(fieldName)) {
value = processPolicyItemsForTrxLog(field.get(vObj));
- } else if (DATAMASK_POLICY_ITEM_CLASS_FIELD_NAME.equalsIgnoreCase(fieldName)){
+ } else if (DATAMASK_POLICY_ITEM_CLASS_FIELD_NAME.equalsIgnoreCase(fieldName)) {
value = processDataMaskPolicyItemsForTrxLog(field.get(vObj));
- } else if (ROWFILTER_POLICY_ITEM_CLASS_FIELD_NAME.equalsIgnoreCase(fieldName)){
+ if(vObj.getDataMaskPolicyItems() != null && CollectionUtils.isNotEmpty(vObj.getDataMaskPolicyItems())) {
+ for(RangerDataMaskPolicyItem policyItem : vObj.getDataMaskPolicyItems()) {
+ if(policyItem.getDataMaskInfo() != null && policyItem.getDataMaskInfo().getDataMaskType() != null) {
+ List<XXDataMaskTypeDef> xDataMaskDef = daoMgr.getXXDataMaskTypeDef().getAll();
+ if(CollectionUtils.isNotEmpty(xDataMaskDef) && xDataMaskDef != null ) {
+ for (XXDataMaskTypeDef xxDataMaskTypeDef : xDataMaskDef) {
+ if(xxDataMaskTypeDef.getName().equalsIgnoreCase(policyItem.getDataMaskInfo().getDataMaskType())) {
+ String label = xxDataMaskTypeDef.getLabel();
+ StringBuilder sbValue = new StringBuilder(value);
+ label = ",\"DataMasklabel\":\""+label+"\"";
+ int sbValueIndex = sbValue.lastIndexOf("}]");
+ sbValue.insert(sbValueIndex, label);
+ value = sbValue.toString();
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+ } else if (ROWFILTER_POLICY_ITEM_CLASS_FIELD_NAME.equalsIgnoreCase(fieldName)) {
value = processRowFilterPolicyItemForTrxLog(field.get(vObj));
- } else if (IS_ENABLED_CLASS_FIELD_NAME.equalsIgnoreCase(fieldName)){
+ } else if (IS_ENABLED_CLASS_FIELD_NAME.equalsIgnoreCase(fieldName)) {
value = String.valueOf(processIsEnabledClassFieldNameForTrxLog(field.get(vObj)));
}
@@ -251,11 +273,11 @@ public class RangerPolicyService extends RangerPolicyServiceBase<XXPolicy, Range
if (oldPolicy != null) {
oldValue = processPolicyItemsForTrxLog(oldPolicy.getDenyPolicyItems());
}
- } else if (POLICY_NAME_CLASS_FIELD_NAME.equalsIgnoreCase(fieldName)){
+ } else if (POLICY_NAME_CLASS_FIELD_NAME.equalsIgnoreCase(fieldName)) {
if (oldPolicy != null) {
oldValue = processPolicyNameForTrxLog(oldPolicy.getName());
}
- } else if (POLICY_DESCRIPTION_CLASS_FIELD_NAME.equalsIgnoreCase(fieldName)){
+ } else if (POLICY_DESCRIPTION_CLASS_FIELD_NAME.equalsIgnoreCase(fieldName)) {
if (oldPolicy != null) {
oldValue = processPolicyNameForTrxLog(oldPolicy.getDescription());
}
@@ -270,6 +292,26 @@ public class RangerPolicyService extends RangerPolicyServiceBase<XXPolicy, Range
} else if (DATAMASK_POLICY_ITEM_CLASS_FIELD_NAME.equalsIgnoreCase(fieldName)) {
if (oldPolicy != null) {
oldValue = processDataMaskPolicyItemsForTrxLog(oldPolicy.getDataMaskPolicyItems());
+ if(oldPolicy.getDataMaskPolicyItems() != null && CollectionUtils.isNotEmpty(oldPolicy.getDataMaskPolicyItems())) {
+ for(RangerDataMaskPolicyItem oldPolicyItem : oldPolicy.getDataMaskPolicyItems()) {
+ if(oldPolicyItem.getDataMaskInfo() != null && oldPolicyItem.getDataMaskInfo().getDataMaskType() != null) {
+ List<XXDataMaskTypeDef> xDataMaskDef = daoMgr.getXXDataMaskTypeDef().getAll();
+ if(CollectionUtils.isNotEmpty(xDataMaskDef) && xDataMaskDef != null ) {
+ for (XXDataMaskTypeDef xxDataMaskTypeDef : xDataMaskDef) {
+ if(xxDataMaskTypeDef.getName().equalsIgnoreCase(oldPolicyItem.getDataMaskInfo().getDataMaskType())) {
+ String oldLabel = xxDataMaskTypeDef.getLabel();
+ StringBuilder sbOldValue = new StringBuilder(oldValue);
+ oldLabel = ",\"DataMasklabel\":\""+oldLabel+"\"";
+ int sbValueIndex = sbOldValue.lastIndexOf("}]");
+ sbOldValue.insert(sbValueIndex, oldLabel);
+ oldValue = sbOldValue.toString();
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
}
} else if (ROWFILTER_POLICY_ITEM_CLASS_FIELD_NAME.equalsIgnoreCase(fieldName)) {
if (oldPolicy != null) {
@@ -329,11 +371,11 @@ public class RangerPolicyService extends RangerPolicyServiceBase<XXPolicy, Range
}
} else if (IS_ENABLED_CLASS_FIELD_NAME.equalsIgnoreCase(fieldName)) {
if (oldPolicy != null) {
- oldValue=processPolicyNameForTrxLog(String.valueOf(oldPolicy.getIsEnabled()));
+ oldValue = processPolicyNameForTrxLog(String.valueOf(oldPolicy.getIsEnabled()));
}
} else if (IS_AUDIT_ENABLED_CLASS_FIELD_NAME.equalsIgnoreCase(fieldName)) {
if (oldPolicy != null) {
- oldValue=processPolicyNameForTrxLog(String.valueOf(oldPolicy.getIsAuditEnabled()));
+ oldValue = processPolicyNameForTrxLog(String.valueOf(oldPolicy.getIsAuditEnabled()));
}
} else if (IS_ENABLED_CLASS_FIELD_NAME.equalsIgnoreCase(fieldName)) {
if(compareTwoPolicyName(value, oldValue)) {
@@ -463,7 +505,7 @@ public class RangerPolicyService extends RangerPolicyServiceBase<XXPolicy, Range
return "";
}
List<RangerPolicyItem> rangerPolicyItems = (List<RangerPolicyItem>) value;
- if(rangerPolicyItems==null || rangerPolicyItems.isEmpty()){
+ if(rangerPolicyItems == null || rangerPolicyItems.isEmpty()) {
return "";
}
String ret = jsonUtil.readListToString(rangerPolicyItems);
@@ -504,7 +546,7 @@ public class RangerPolicyService extends RangerPolicyServiceBase<XXPolicy, Range
return "";
}
List<RangerDataMaskPolicyItem> rangerPolicyItems = (List<RangerDataMaskPolicyItem>) value;
- if(rangerPolicyItems==null || rangerPolicyItems.isEmpty()){
+ if(rangerPolicyItems == null || rangerPolicyItems.isEmpty()) {
return "";
}
String ret = jsonUtil.readListToString(rangerPolicyItems);
@@ -520,7 +562,7 @@ public class RangerPolicyService extends RangerPolicyServiceBase<XXPolicy, Range
return "";
}
List<RangerRowFilterPolicyItem> rangerPolicyItems = (List<RangerRowFilterPolicyItem>) value;
- if(rangerPolicyItems==null || rangerPolicyItems.isEmpty()){
+ if(rangerPolicyItems == null || rangerPolicyItems.isEmpty()) {
return "";
}
String ret = jsonUtil.readListToString(rangerPolicyItems);
@@ -529,10 +571,10 @@ public class RangerPolicyService extends RangerPolicyServiceBase<XXPolicy, Range
}
return ret;
}
- private String processIsEnabledClassFieldNameForTrxLog(Object value){
+ private String processIsEnabledClassFieldNameForTrxLog(Object value) {
if(value == null)
return null;
- String isEnabled= String.valueOf(value);
+ String isEnabled = String.valueOf(value);
return isEnabled;
}
http://git-wip-us.apache.org/repos/asf/ranger/blob/57783900/security-admin/src/main/webapp/scripts/views/policies/RangerPolicyForm.js
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/scripts/views/policies/RangerPolicyForm.js b/security-admin/src/main/webapp/scripts/views/policies/RangerPolicyForm.js
index 403e23c..9145b88 100644
--- a/security-admin/src/main/webapp/scripts/views/policies/RangerPolicyForm.js
+++ b/security-admin/src/main/webapp/scripts/views/policies/RangerPolicyForm.js
@@ -326,20 +326,27 @@ define(function(require){
}
},this);
//remove validation of fields if it's hidden
- _.each(this.fields, function(obj, key){
- if(obj.$el.hasClass('hideResource')){
- if($.inArray('required',obj.editor.validators) >= 0){
- this.defaultValidator[key] = obj.editor.validators;
- obj.editor.validators=[];
- var label = obj.$el.find('label').html();
- obj.$el.find('label').html(label.replace('*', ''));
+ //remove validation if fields is not empty
+ _.each(this.fields, function(field, key){
+ if((key.substring(0,key.length-2) === "sameLevel") && field.$el.find('[data-js="resource"]').val()!="" && field.$el.hasClass('error')){
+ field.$el.removeClass('error');
+ field.$el.find('.help-inline').empty();
+ }
+ if(field.$el.hasClass('hideResource')){
+ if($.inArray('required',field.editor.validators) >= 0){
+ this.defaultValidator[key] = field.editor.validators;
+ field.editor.validators=[];
+ var label = field.$el.find('label').html();
+ field.$el.find('label').html(label.replace('*', ''));
+ field.$el.removeClass('error');
+ field.$el.find('.help-inline').empty();
}
}else{
if(!_.isUndefined(this.defaultValidator[key])){
- obj.editor.validators = this.defaultValidator[key];
- if($.inArray('required',obj.editor.validators) >= 0){
- var label = obj.$el.find('label').html();
- obj.$el.find('label').html(label+"*");
+ field.editor.validators = this.defaultValidator[key];
+ if($.inArray('required',field.editor.validators) >= 0){
+ var label = field.$el.find('label').html();
+ field.$el.find('label').html(label+"*");
}
}
}
http://git-wip-us.apache.org/repos/asf/ranger/blob/57783900/security-admin/src/main/webapp/scripts/views/reports/PlugableServiceDiffDetail.js
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/scripts/views/reports/PlugableServiceDiffDetail.js b/security-admin/src/main/webapp/scripts/views/reports/PlugableServiceDiffDetail.js
index 9ec7e91..f24fe87 100644
--- a/security-admin/src/main/webapp/scripts/views/reports/PlugableServiceDiffDetail.js
+++ b/security-admin/src/main/webapp/scripts/views/reports/PlugableServiceDiffDetail.js
@@ -63,6 +63,7 @@ define(function(require){
newRowFilterPolicyItems: this.newRowFilterPolicyItems,
oldMaskPolicyItems: this.oldMaskPolicyItems,
oldRowFilterPolicyItems: this.oldRowFilterPolicyItems,
+ userName : this.userName,
};
},
@@ -106,21 +107,7 @@ define(function(require){
}
if(!_.isUndefined(this.collection.models[0]) ){
this.policyName = _.isUndefined(this.policyName) ? this.collection.models[0].get('objectName') : this.policyName;
- var rangerService = new RangerService({ 'id' : this.collection.models[0].get('parentObjectId') })
- rangerService.fetch({
- cache : false,
- async : false
- })
- if(!_.isUndefined(rangerService.get('type'))){
- this.rangerServiceDefModel = new RangerServiceDef();
- this.rangerServiceDefModel.url = XAUtils.getRangerServiceDef(rangerService.get('type'));
- this.rangerServiceDefModel.fetch({
- cache : false,
- async : false
- })
- this.repositoryType = this.rangerServiceDefModel.get('name');
- }
- //get policy created/updated date/owner
+// get policy created/updated date/owner
var model = this.collection.models[0];
this.objectCreatedBy = model.get('updatedBy');
}
@@ -171,9 +158,6 @@ define(function(require){
_.each(addedUsers, function(userSpan) { $(userSpan).addClass('add-text')});
},
array_diff :function(array1, array2){
-// var array1 = [<span>user1<span>,<span>user2<span>,<span>user3<span>,<span>user4<span>];
-// var array2 = [<span>user1<span>,<span>user3<span>];
-// array_diff = [<span>user2<span>,<span>user4<span>]
var difference = [];
var tmpArr2 = _.map(array2,function(a){ return (a.innerHTML);})
$.grep(array1, function(el) {
@@ -270,42 +254,41 @@ define(function(require){
if(!_.isUndefined(policyResources.get('newValue')) && !_.isEmpty(policyResources.get('newValue'))){
var resources = {} ;
var resourceNewValues = JSON.parse(policyResources.get('newValue'));
- if(!_.isUndefined(this.rangerServiceDefModel)){
- _.each(this.rangerServiceDefModel.get('resources'), function(obj) {
- _.each(resourceNewValues,function(val,key){
- if(obj.name == key){
- resources[obj.name] = val.values.toString();
- if(!_.isUndefined(obj.excludesSupported) && obj.excludesSupported){
- resources[obj.name+' exclude'] = val.isExcludes.toString();
- }
- if(!_.isUndefined(obj.recursiveSupported) && obj.recursiveSupported){
- resources[obj.name+' recursive'] = val.isRecursive.toString();
- }
- }
- });
- });
- }
+ //for resource new value
+ _.each(resourceNewValues,function(val,key){
+ resources[key] = val.values.toString();
+ resources[key +' exclude'] = val.isExcludes.toString();
+ resources[key +' recursive'] = val.isRecursive.toString();
+ });
}
if(!_.isUndefined(policyResources.get('previousValue')) && !_.isEmpty(policyResources.get('previousValue'))){
var oldResources = {} ;
var resourceNewValues = JSON.parse(policyResources.get('previousValue'));
- if(!_.isUndefined(this.rangerServiceDefModel)){
- _.each(this.rangerServiceDefModel.get('resources'), function(obj) {
- _.each(resourceNewValues,function(val,key){
- if(obj.name == key){
- oldResources[obj.name] = val.values.toString();
- if(!_.isUndefined(obj.excludesSupported) && obj.excludesSupported){
- oldResources[obj.name+' exclude'] = val.isExcludes.toString();
- }
- if(!_.isUndefined(obj.recursiveSupported) && obj.recursiveSupported){
- oldResources[obj.name+' recursive'] = val.isRecursive.toString();
- }
- }
- });
- });
- }
+ ////for resource old value
+ _.each(resourceNewValues,function(val,key){
+ oldResources[key] = val.values.toString();
+ oldResources[key +' exclude'] = val.isExcludes.toString();
+ oldResources[key +' recursive'] = val.isRecursive.toString();
+ });
}
if(this.action == "update"){
+ //**Show diffview data for resource change at same level.
+ var done = false;
+ _.each(resources,function(val, key){
+ if(_.isUndefined(oldResources[key] && !done)){
+ _.each(resources,function(val,key){
+ if(!oldResources.hasOwnProperty(key)){
+ oldResources[key] = "";
+ }
+ });
+ _.each(oldResources,function(val,key){
+ if(!resources.hasOwnProperty(key)){
+ resources[key] = "";
+ }
+ });
+ done = true;
+ }
+ });
_.each(resources,function(val, key){
if(val != oldResources[key])
this.collection.add({'attributeName':key, 'newValue':val.toString(),'previousValue': oldResources[key],type : "Policy Resources"});
@@ -342,25 +325,20 @@ define(function(require){
});
}
if(itemType === 'Masked Policy Items') {
- for(var i = 0; i < newPolicyItems.length ; i++){
- var maskingType = newPolicyItems[i].dataMaskInfo.dataMaskType;
- var dataMaskDefs = that.rangerServiceDefModel.get('dataMaskDef');
- _.each(dataMaskDefs.maskTypes,function(maskType){
- if(maskType.name === maskingType) {
- newPolicyItems[i].dataMaskInfo.dataMaskType = maskType.label;
+ // its for new created record
+ for(var i = 0; i < newPolicyItems.length ; i++){
+ if(newPolicyItems[i].DataMasklabel){
+ var maskingType = newPolicyItems[i].dataMaskInfo.dataMaskType;
+ newPolicyItems[i].dataMaskInfo.dataMaskType = newPolicyItems[i].DataMasklabel;
}
- });
- };
-
- for(var i = 0; i < oldPolicyItems.length ; i++){
- var maskingType = oldPolicyItems[i].dataMaskInfo.dataMaskType;
- var dataMaskDefs = that.rangerServiceDefModel.get('dataMaskDef');
- _.each(dataMaskDefs.maskTypes,function(maskType){
- if(maskType.name === maskingType) {
- oldPolicyItems[i].dataMaskInfo.dataMaskType = maskType.label;
+ }
+
+ for(var i = 0; i < oldPolicyItems.length ; i++){
+ if(oldPolicyItems[i].DataMasklabel){
+ var maskingType = oldPolicyItems[i].dataMaskInfo.dataMaskType;
+ oldPolicyItems[i].dataMaskInfo.dataMaskType = oldPolicyItems[i].DataMasklabel;
}
- });
- };
+ }
}
// this.oldPermList =[], this.newPermList =[]
http://git-wip-us.apache.org/repos/asf/ranger/blob/57783900/security-admin/src/main/webapp/styles/xa.css
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/styles/xa.css b/security-admin/src/main/webapp/styles/xa.css
index fbfc9a0..a1037b9 100644
--- a/security-admin/src/main/webapp/styles/xa.css
+++ b/security-admin/src/main/webapp/styles/xa.css
@@ -2182,7 +2182,15 @@ td.subgrid-custom-cell{
.tag-attr-popover .table td:first-child{
border-left-color:transparent;
}
-.divider-popup{
+.backgrid-paginator ul > li > a,
+.backgrid-paginator ul > li > span{
+ width: auto !important;
+ min-width: 30px;
+ max-width: 44px;
+ text-overflow:ellipsis;
+ white-space: nowrap;
+ overflow: hidden;
+}.divider-popup{
padding: 4px;
background-color: #eeeeee;
text-align: center;
http://git-wip-us.apache.org/repos/asf/ranger/blob/57783900/security-admin/src/main/webapp/templates/reports/KnoxPolicyDeleteOperationDiff_tmpl.html
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/templates/reports/KnoxPolicyDeleteOperationDiff_tmpl.html b/security-admin/src/main/webapp/templates/reports/KnoxPolicyDeleteOperationDiff_tmpl.html
index 31cd974..901a1df 100644
--- a/security-admin/src/main/webapp/templates/reports/KnoxPolicyDeleteOperationDiff_tmpl.html
+++ b/security-admin/src/main/webapp/templates/reports/KnoxPolicyDeleteOperationDiff_tmpl.html
@@ -15,7 +15,9 @@
limitations under the License.
--}}
<label class="no-margin label-size13-weightbold">Policy Name : {{policyName}}</label>
-<label class="no-margin label-size13-weightbold">Repository Type : {{repositoryType}}</label>
+{{#if repositoryType}}
+ <label class="no-margin label-size13-weightbold">Repository Type : {{repositoryType}}</label>
+{{/if}}
<label class="no-margin label-size13-weightbold"> Date : {{objectCreatedDate}}</label>
<label class="no-margin label-size13-weightbold" > Deleted By : {{userName}}</label>
http://git-wip-us.apache.org/repos/asf/ranger/blob/57783900/security-admin/src/main/webapp/templates/reports/KnoxPolicyOperationDiff_tmpl.html
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/templates/reports/KnoxPolicyOperationDiff_tmpl.html b/security-admin/src/main/webapp/templates/reports/KnoxPolicyOperationDiff_tmpl.html
index 3afe134..d93fcdb 100644
--- a/security-admin/src/main/webapp/templates/reports/KnoxPolicyOperationDiff_tmpl.html
+++ b/security-admin/src/main/webapp/templates/reports/KnoxPolicyOperationDiff_tmpl.html
@@ -16,7 +16,9 @@
--}}
<div class="diff-content">
<label class="no-margin label-size13-weightbold">Policy Name : {{policyName}}</label>
- <label class="no-margin label-size13-weightbold">Repository Type : {{repositoryType}}</label>
+ {{#if repositoryType}}
+ <label class="no-margin label-size13-weightbold">Repository Type : {{repositoryType}}</label>
+ {{/if}}
<label class="no-margin label-size13-weightbold"> Date : {{objectCreatedDate}}</label>
<label class="no-margin label-size13-weightbold" > Created By : {{userName}}</label>
http://git-wip-us.apache.org/repos/asf/ranger/blob/57783900/security-admin/src/main/webapp/templates/reports/KnoxPolicyUpdateOperationDiff_tmpl.html
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/templates/reports/KnoxPolicyUpdateOperationDiff_tmpl.html b/security-admin/src/main/webapp/templates/reports/KnoxPolicyUpdateOperationDiff_tmpl.html
index 07758dd..3cbde7a 100644
--- a/security-admin/src/main/webapp/templates/reports/KnoxPolicyUpdateOperationDiff_tmpl.html
+++ b/security-admin/src/main/webapp/templates/reports/KnoxPolicyUpdateOperationDiff_tmpl.html
@@ -18,7 +18,9 @@
<div class="row-fluid">
<div class="span6">
<label class="no-margin label-size13-weightbold">Policy Name : {{policyName}}</label>
- <label class="no-margin label-size13-weightbold">Repository Type : {{repositoryType}}</label>
+ {{#if repositoryType}}
+ <label class="no-margin label-size13-weightbold">Repository Type : {{repositoryType}}</label>
+ {{/if}}
<label class="no-margin label-size13-weightbold"> Date : {{objectCreatedDate}}</label>
<label class="no-margin label-size13-weightbold" > Updated By : {{userName}}</label>
</div>
http://git-wip-us.apache.org/repos/asf/ranger/blob/57783900/security-admin/src/main/webapp/templates/reports/PlugableServicePolicyDeleteDiff_tmpl.html
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/templates/reports/PlugableServicePolicyDeleteDiff_tmpl.html b/security-admin/src/main/webapp/templates/reports/PlugableServicePolicyDeleteDiff_tmpl.html
index 0325c42..93404f0 100644
--- a/security-admin/src/main/webapp/templates/reports/PlugableServicePolicyDeleteDiff_tmpl.html
+++ b/security-admin/src/main/webapp/templates/reports/PlugableServicePolicyDeleteDiff_tmpl.html
@@ -18,7 +18,7 @@
<b>Policy ID : </b><label class="label label-ranger"> {{objectId}}</label>
<label class="no-margin label-size13-weightbold">Policy Name : {{policyName}}</label>
<label class="no-margin label-size13-weightbold"> Deleted Date : {{objectCreatedDate}}</label>
- <label class="no-margin label-size13-weightbold" > Deleted By : {{objectCreatedBy}}</label>
+ <label class="no-margin label-size13-weightbold" > Deleted By : {{userName}}</label>
{{#if collection.length}}
<h5>Policy Details :</h5>
@@ -85,6 +85,83 @@
{{/each}}
</div>
</div>
+{{/if}}
+<!-- Masking Policy Items -->
+{{#if oldMaskPolicyItems}}
+ <h5>Masking Policy Items :</h5>
+ <div class="diff diff-perms" >
+ <div class="diff-right diff-list" data-id="diff">
+ <h3>old Value</h3>
+ {{#each oldMaskPolicyItems}}
+ <ol class="unstyled data">
+ <li class="change-row">Groups:
+ {{#if_eq this.groups compare=0}}
+ <empty>
+ {{else}}
+ {{this.groups}}
+ {{/if_eq}}
+ </li>
+ <li class="change-row">Users:
+ {{#if_eq this.users compare=0}}
+ <empty>
+ {{else}}
+ {{this.users}}
+ {{/if_eq}}
+ </li>
+ <li class="change-row">Accesses:
+ {{#each this.accesses}}
+ {{this.type}} <span>,</span>
+ {{/each}}
+ </li>
+ {{#if this.dataMaskInfo}}
+ <li class="change-row">
+ Data Mask Types:
+ {{this.dataMaskInfo.dataMaskType}}
+ </li>
+ {{/if}}
+ </ol><br/>
+ {{/each}}
+ </div>
+ </div>
+{{/if}}
+
+<!-- Row Filter Policy Items-->
+{{#if oldRowFilterPolicyItems}}
+ <h5>Row Level Filter Policy Items :</h5>
+ <div class="diff diff-perms" >
+ <div class="diff-right diff-list" data-id="diff">
+ <h3>Old Value</h3>
+ {{#each oldRowFilterPolicyItems}}
+ <ol class="unstyled data">
+ <li class="change-row">Groups:
+ {{#if_eq this.groups compare=0}}
+ <empty>
+ {{else}}
+ {{this.groups}}
+ {{/if_eq}}
+ </li>
+ <li class="change-row">Users:
+ {{#if_eq this.users compare=0}}
+ <empty>
+ {{else}}
+ {{this.users}}
+ {{/if_eq}}
+ </li>
+ <li class="change-row">Accesses:
+ {{#each this.accesses}}
+ {{this.type}} <span>,</span>
+ {{/each}}
+ </li>
+ {{#if this.rowFilterInfo}}
+ <li class="change-row">
+ Row Level Filter:
+ {{this.rowFilterInfo.filterExpr}}
+ </li>
+ {{/if}}
+ </ol><br/>
+ {{/each}}
+ </div>
+ </div>
{{/if}}
{{#if oldAllowExceptionPolicyItems}}
http://git-wip-us.apache.org/repos/asf/ranger/blob/57783900/security-admin/src/main/webapp/templates/reports/PlugableServicePolicyDiff_tmpl.html
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/templates/reports/PlugableServicePolicyDiff_tmpl.html b/security-admin/src/main/webapp/templates/reports/PlugableServicePolicyDiff_tmpl.html
index 3018c84..acf6d86 100644
--- a/security-admin/src/main/webapp/templates/reports/PlugableServicePolicyDiff_tmpl.html
+++ b/security-admin/src/main/webapp/templates/reports/PlugableServicePolicyDiff_tmpl.html
@@ -17,9 +17,11 @@
<div class="diff-content">
<b>Policy ID : </b><label class="label label-ranger"> {{objectId}}</label>
<label class="no-margin label-size13-weightbold">Policy Name : {{policyName}}</label>
+ {{#if repositoryType}}
<label class="no-margin label-size13-weightbold">Repository Type : {{repositoryType}}</label>
+ {{/if}}
<label class="no-margin label-size13-weightbold"> Created Date : {{objectCreatedDate}}</label>
- <label class="no-margin label-size13-weightbold" > Created By : {{objectCreatedBy}}</label>
+ <label class="no-margin label-size13-weightbold" > Created By : {{userName}}</label>
{{#if collection.length}}
<h5>Policy Details :</h5>
@@ -170,12 +172,12 @@
</div>
{{/if}}
<!-- Deny Exception PolicyItems -->
-{{#if oldDenyExceptionPolicyItems}}
+{{#if newDenyExceptionPolicyItems}}
<h5>Deny Exception PolicyItems:</h5>
<div class="diff diff-perms" >
<div class="diff-right diff-list" data-id="diff">
<h3>New Value</h3>
- {{#each oldDenyExceptionPolicyItems}}
+ {{#each newDenyExceptionPolicyItems}}
<ol class="unstyled data">
<li class="change-row">Groups:
{{#if_eq this.groups compare=0}}
http://git-wip-us.apache.org/repos/asf/ranger/blob/57783900/security-admin/src/main/webapp/templates/reports/PlugableServicePolicyUpdateDiff_tmpl.html
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/templates/reports/PlugableServicePolicyUpdateDiff_tmpl.html b/security-admin/src/main/webapp/templates/reports/PlugableServicePolicyUpdateDiff_tmpl.html
index c2d6c2d..524b18f 100644
--- a/security-admin/src/main/webapp/templates/reports/PlugableServicePolicyUpdateDiff_tmpl.html
+++ b/security-admin/src/main/webapp/templates/reports/PlugableServicePolicyUpdateDiff_tmpl.html
@@ -19,9 +19,11 @@
<div class="span6">
<b>Policy ID : </b><label class="label label-ranger"> {{objectId}}</label>
<label class="no-margin label-size13-weightbold">Policy Name : {{policyName}}</label>
- <label class="no-margin label-size13-weightbold">Repository Type : {{repositoryType}}</label>
+ {{#if repositoryType}}
+ <label class="no-margin label-size13-weightbold">Repository Type : {{repositoryType}}</label>
+ {{/if}}
<label class="no-margin label-size13-weightbold"> Updated Date : {{objectCreatedDate}}</label>
- <label class="no-margin label-size13-weightbold" > Updated By : {{objectCreatedBy}}</label>
+ <label class="no-margin label-size13-weightbold" > Updated By : {{userName}}</label>
</div>
<div class="span6 text-right">
<div class="add-text legend"></div> Added
http://git-wip-us.apache.org/repos/asf/ranger/blob/57783900/security-admin/src/main/webapp/templates/reports/PolicyDeleteOperationDiff_tmpl.html
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/templates/reports/PolicyDeleteOperationDiff_tmpl.html b/security-admin/src/main/webapp/templates/reports/PolicyDeleteOperationDiff_tmpl.html
index 1449b04..eb37c0b 100644
--- a/security-admin/src/main/webapp/templates/reports/PolicyDeleteOperationDiff_tmpl.html
+++ b/security-admin/src/main/webapp/templates/reports/PolicyDeleteOperationDiff_tmpl.html
@@ -15,7 +15,9 @@
limitations under the License.
--}}
<label class="no-margin label-size13-weightbold">Policy Name : {{policyName}}</label>
-<label class="no-margin label-size13-weightbold">Repository Type : {{repositoryType}}</label>
+{{#if repositoryType}}
+ <label class="no-margin label-size13-weightbold">Repository Type : {{repositoryType}}</label>
+{{/if}}
<label class="no-margin label-size13-weightbold"> Date : {{objectCreatedDate}}</label>
<label class="no-margin label-size13-weightbold" > Deleted By : {{userName}}</label>
http://git-wip-us.apache.org/repos/asf/ranger/blob/57783900/security-admin/src/main/webapp/templates/reports/PolicyOperationDiff_tmpl.html
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/templates/reports/PolicyOperationDiff_tmpl.html b/security-admin/src/main/webapp/templates/reports/PolicyOperationDiff_tmpl.html
index 54248f0..a943813 100644
--- a/security-admin/src/main/webapp/templates/reports/PolicyOperationDiff_tmpl.html
+++ b/security-admin/src/main/webapp/templates/reports/PolicyOperationDiff_tmpl.html
@@ -16,7 +16,9 @@
--}}
<div class="diff-content">
<label class="no-margin label-size13-weightbold">Policy Name : {{policyName}}</label>
- <label class="no-margin label-size13-weightbold">Repository Type : {{repositoryType}}</label>
+ {{#if repositoryType}}
+ <label class="no-margin label-size13-weightbold">Repository Type : {{repositoryType}}</label>
+ {{/if}}
<label class="no-margin label-size13-weightbold"> Date : {{objectCreatedDate}}</label>
<label class="no-margin label-size13-weightbold" > Created By : {{userName}}</label>
http://git-wip-us.apache.org/repos/asf/ranger/blob/57783900/security-admin/src/main/webapp/templates/reports/PolicyUpdateOperationDiff_tmpl.html
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/templates/reports/PolicyUpdateOperationDiff_tmpl.html b/security-admin/src/main/webapp/templates/reports/PolicyUpdateOperationDiff_tmpl.html
index 38de921..58b9efa 100644
--- a/security-admin/src/main/webapp/templates/reports/PolicyUpdateOperationDiff_tmpl.html
+++ b/security-admin/src/main/webapp/templates/reports/PolicyUpdateOperationDiff_tmpl.html
@@ -18,7 +18,9 @@
<div class="row-fluid">
<div class="span6">
<label class="no-margin label-size13-weightbold">Policy Name : {{policyName}}</label>
- <label class="no-margin label-size13-weightbold">Repository Type : {{repositoryType}}</label>
+ {{#if repositoryType}}
+ <label class="no-margin label-size13-weightbold">Repository Type : {{repositoryType}}</label>
+ {{/if}}
<label class="no-margin label-size13-weightbold"> Date : {{objectCreatedDate}}</label>
<label class="no-margin label-size13-weightbold" > Updated By : {{userName}}</label>
</div>