Repository: incubator-ranger Updated Branches: refs/heads/master a8b093ad4 -> 39136c5d6
Revert "RANGER-429 : Enhancements to Ranger KMS" This reverts commit 8f30ebd353e4f1b2542bf42bd6a13bfc09592a2b. Project: http://git-wip-us.apache.org/repos/asf/incubator-ranger/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ranger/commit/39136c5d Tree: http://git-wip-us.apache.org/repos/asf/incubator-ranger/tree/39136c5d Diff: http://git-wip-us.apache.org/repos/asf/incubator-ranger/diff/39136c5d Branch: refs/heads/master Commit: 39136c5d6dd391caa9b1a365cb02d0675557ce07 Parents: a8b093a Author: Velmurugan Periasamy <[email protected]> Authored: Wed May 6 08:28:32 2015 -0400 Committer: Velmurugan Periasamy <[email protected]> Committed: Wed May 6 08:28:32 2015 -0400 ---------------------------------------------------------------------- kms/config/kms-webapp/dbks-site.xml | 9 ++-- kms/scripts/install.properties | 2 - kms/scripts/setup.sh | 4 +- .../org/apache/ranger/biz/ServiceDBStore.java | 15 +------ .../java/org/apache/ranger/biz/XUserMgr.java | 10 ----- .../apache/ranger/common/UserSessionBase.java | 3 -- .../java/org/apache/ranger/rest/XKeyREST.java | 38 ++++------------ .../ranger/service/RangerServiceDefService.java | 29 ------------ .../service/RangerServiceServiceBase.java | 1 - .../webapp/scripts/controllers/Controller.js | 34 +++++++------- .../src/main/webapp/scripts/modules/XALinks.js | 13 +----- .../scripts/modules/globalize/message/en.js | 6 +-- .../src/main/webapp/scripts/routers/Router.js | 2 +- .../src/main/webapp/scripts/utils/XAGlobals.js | 9 ++-- .../webapp/scripts/views/kms/KMSTableLayout.js | 47 ++++---------------- .../webapp/scripts/views/kms/KmsKeyCreate.js | 3 +- .../main/webapp/scripts/views/kms/KmsKeyForm.js | 44 +++++++++--------- .../scripts/views/policies/RangerPolicyForm.js | 2 - .../scripts/views/service/ConfigurationList.js | 3 +- .../webapp/scripts/views/service/ServiceForm.js | 1 - .../webapp/templates/common/TopNav_tmpl.html | 3 +- .../webapp/templates/kms/KmsKeyForm_tmpl.html | 1 - .../service/ConfigurationList_tmpl.html | 2 +- 23 files changed, 75 insertions(+), 206 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/39136c5d/kms/config/kms-webapp/dbks-site.xml ---------------------------------------------------------------------- diff --git a/kms/config/kms-webapp/dbks-site.xml b/kms/config/kms-webapp/dbks-site.xml index edaff93..734d537 100755 --- a/kms/config/kms-webapp/dbks-site.xml +++ b/kms/config/kms-webapp/dbks-site.xml @@ -20,14 +20,13 @@ <!-- Blacklist for authorization --> - <property> - <name>hadoop.kms.blacklist.DECRYPT_EEK</name> + <!--<property> + <name>hadoop.kms.blacklist.CREATE</name> <value>hdfs</value> <description> - Blacklist for decrypt EncryptedKey - CryptoExtension operations + Blacklist for create-key operations. </description> - </property> + </property>--> <!-- Encryption key Password --> http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/39136c5d/kms/scripts/install.properties ---------------------------------------------------------------------- diff --git a/kms/scripts/install.properties b/kms/scripts/install.properties old mode 100755 new mode 100644 index cfe9adf..0059787 --- a/kms/scripts/install.properties +++ b/kms/scripts/install.properties @@ -225,5 +225,3 @@ postgres_core_file=db/postgres/kms_core_db_postgres.sql sqlserver_core_file=db/sqlserver/kms_core_db_sqlserver.sql cred_keystore_filename=$app_home/WEB-INF/classes/conf/.jceks/rangerkms.jceks - -KMS_BLACKLIST_DECRYPT_EEK=hdfs http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/39136c5d/kms/scripts/setup.sh ---------------------------------------------------------------------- diff --git a/kms/scripts/setup.sh b/kms/scripts/setup.sh index 3071fe2..63237d5 100755 --- a/kms/scripts/setup.sh +++ b/kms/scripts/setup.sh @@ -460,8 +460,8 @@ update_properties() { updatePropertyToFilePy $propertyName $newPropertyValue $to_file fi - propertyName=hadoop.kms.blacklist.DECRYPT_EEK - newPropertyValue="${KMS_BLACKLIST_DECRYPT_EEK}" + propertyName=hadoop.kms.blacklist.CREATE + newPropertyValue="BlacklistUser" updatePropertyToFilePy $propertyName $newPropertyValue $to_file ########### http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/39136c5d/security-admin/src/main/java/org/apache/ranger/biz/ServiceDBStore.java ---------------------------------------------------------------------- diff --git a/security-admin/src/main/java/org/apache/ranger/biz/ServiceDBStore.java b/security-admin/src/main/java/org/apache/ranger/biz/ServiceDBStore.java index b2e8b80..d217f61 100644 --- a/security-admin/src/main/java/org/apache/ranger/biz/ServiceDBStore.java +++ b/security-admin/src/main/java/org/apache/ranger/biz/ServiceDBStore.java @@ -28,7 +28,6 @@ import java.util.Map; import java.util.Map.Entry; import javax.annotation.PostConstruct; -import javax.servlet.http.HttpServletResponse; import org.apache.commons.lang.StringUtils; import org.apache.commons.logging.Log; @@ -116,7 +115,6 @@ import org.apache.ranger.service.XUserService; import org.apache.ranger.view.RangerPolicyList; import org.apache.ranger.view.RangerServiceDefList; import org.apache.ranger.view.RangerServiceList; -import org.apache.ranger.view.VXResponse; import org.apache.ranger.view.VXString; import org.apache.ranger.view.VXUser; import org.springframework.beans.factory.annotation.Autowired; @@ -892,18 +890,7 @@ public class ServiceDBStore extends AbstractServiceStore { RangerServiceDef ret = null; ret = serviceDefService.read(id); - List<String> userRoleList = ContextUtil.getCurrentUserSession().getUserRoleList(); - if(userRoleList != null && !userRoleList.contains(RangerConstants.ROLE_KEY_ADMIN)){ - if(ret!=null && "KMS".equalsIgnoreCase(ret.getName())){ - ret=null; - } - }else{ - if(ret!=null && !"KMS".equalsIgnoreCase(ret.getName())){ - ret=null; - } - } - - + if (LOG.isDebugEnabled()) { LOG.debug("<== ServiceDefDBStore.getServiceDef(" + id + "): " + ret); } http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/39136c5d/security-admin/src/main/java/org/apache/ranger/biz/XUserMgr.java ---------------------------------------------------------------------- diff --git a/security-admin/src/main/java/org/apache/ranger/biz/XUserMgr.java b/security-admin/src/main/java/org/apache/ranger/biz/XUserMgr.java index 49be508..e676bf6 100644 --- a/security-admin/src/main/java/org/apache/ranger/biz/XUserMgr.java +++ b/security-admin/src/main/java/org/apache/ranger/biz/XUserMgr.java @@ -296,16 +296,6 @@ public class XUserMgr extends XUserMgrBase { } else if (role.equals(RangerConstants.ROLE_KEY_ADMIN)) { insertMappingUserPermisson(vXPortalUser.getId(), moduleNameId.get(RangerConstants.MODULE_KMS), isCreate); - insertMappingUserPermisson(vXPortalUser.getId(), - moduleNameId.get(RangerConstants.MODULE_ANALYTICS), - isCreate); - insertMappingUserPermisson( - vXPortalUser.getId(), - moduleNameId.get(RangerConstants.MODULE_POLICY_MANAGER), - isCreate); - insertMappingUserPermisson(vXPortalUser.getId(), - moduleNameId.get(RangerConstants.MODULE_AUDIT), - isCreate); } } http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/39136c5d/security-admin/src/main/java/org/apache/ranger/common/UserSessionBase.java ---------------------------------------------------------------------- diff --git a/security-admin/src/main/java/org/apache/ranger/common/UserSessionBase.java b/security-admin/src/main/java/org/apache/ranger/common/UserSessionBase.java index 20894dc..842015b 100644 --- a/security-admin/src/main/java/org/apache/ranger/common/UserSessionBase.java +++ b/security-admin/src/main/java/org/apache/ranger/common/UserSessionBase.java @@ -96,9 +96,6 @@ public class UserSessionBase implements Serializable { public void setUserRoleList(List<String> strRoleList) { this.userRoleList = strRoleList; } - public List<String> getUserRoleList() { - return this.userRoleList; - } public int getAuthProvider() { return this.authProvider; http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/39136c5d/security-admin/src/main/java/org/apache/ranger/rest/XKeyREST.java ---------------------------------------------------------------------- diff --git a/security-admin/src/main/java/org/apache/ranger/rest/XKeyREST.java b/security-admin/src/main/java/org/apache/ranger/rest/XKeyREST.java index 47ec0c1..baab333 100755 --- a/security-admin/src/main/java/org/apache/ranger/rest/XKeyREST.java +++ b/security-admin/src/main/java/org/apache/ranger/rest/XKeyREST.java @@ -1,6 +1,7 @@ package org.apache.ranger.rest; import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; import javax.ws.rs.DELETE; import javax.ws.rs.GET; import javax.ws.rs.POST; @@ -19,16 +20,12 @@ import org.apache.ranger.common.SearchUtil; import org.apache.ranger.common.annotation.RangerAnnotationJSMgrName; import org.apache.ranger.view.VXKmsKey; import org.apache.ranger.view.VXKmsKeyList; -import org.codehaus.jettison.json.JSONException; -import org.codehaus.jettison.json.JSONObject; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; -import com.sun.jersey.api.client.UniformInterfaceException; - @Path("keys") @Component @@ -64,7 +61,8 @@ public class XKeyREST { vxKmsKeyList = keyMgr.searchKeys(provider); vxKmsKeyList = keyMgr.getFilteredKeyList(request, vxKmsKeyList); }catch(Exception e){ - handleError(e); + e.printStackTrace(); + handleError(e.getMessage()); } return vxKmsKeyList; } @@ -85,12 +83,9 @@ public class XKeyREST { throw restErrorUtil.createRESTException("Please provide a valid " + "alias.", MessageEnums.INVALID_INPUT_DATA); } - if(vXKey.getCipher() == null || vXKey.getCipher().trim().isEmpty()){ - vXKey.setCipher(null); - } vxKmsKey = keyMgr.rolloverKey(provider, vXKey); }catch(Exception e){ - handleError(e); + handleError(e.getMessage()); } return vxKmsKey; } @@ -111,7 +106,7 @@ public class XKeyREST { } keyMgr.deleteKey(provider, name); }catch(Exception e){ - handleError(e); + handleError(e.getMessage()); } } @@ -131,12 +126,9 @@ public class XKeyREST { throw restErrorUtil.createRESTException("Please provide a valid " + "alias.", MessageEnums.INVALID_INPUT_DATA); } - if(vXKey.getCipher() == null || vXKey.getCipher().trim().isEmpty()){ - vXKey.setCipher(null); - } vxKmsKey = keyMgr.createKey(provider, vXKey); }catch(Exception e){ - handleError(e); + handleError(e.getMessage()); } return vxKmsKey; } @@ -159,26 +151,12 @@ public class XKeyREST { } vxKmsKey = keyMgr.getKey(provider, name); }catch(Exception e){ - handleError(e); + handleError(e.getMessage()); } return vxKmsKey; } - private void handleError(Exception e) { - String message = e.getMessage(); - if (e instanceof UniformInterfaceException){ - UniformInterfaceException uie=(UniformInterfaceException)e; - message = uie.getResponse().getEntity(String.class); - logger.error(message); - try { - JSONObject objRE = new JSONObject(message); - message = objRE.getString("RemoteException"); - JSONObject obj = new JSONObject(message); - message = obj.getString("message"); - } catch (JSONException e1) { - message = e1.getMessage(); - } - } + private void handleError(String message) { if(!(message==null) && !(message.isEmpty()) && message.contains("Connection refused")){ message = "Connection refused : Please check the KMS provider URL and whether the Ranger KMS is running"; }else if(!(message==null) && !(message.isEmpty()) && message.contains("response status of 403")){ http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/39136c5d/security-admin/src/main/java/org/apache/ranger/service/RangerServiceDefService.java ---------------------------------------------------------------------- diff --git a/security-admin/src/main/java/org/apache/ranger/service/RangerServiceDefService.java b/security-admin/src/main/java/org/apache/ranger/service/RangerServiceDefService.java index ecf0b16..98d10d8 100644 --- a/security-admin/src/main/java/org/apache/ranger/service/RangerServiceDefService.java +++ b/security-admin/src/main/java/org/apache/ranger/service/RangerServiceDefService.java @@ -20,8 +20,6 @@ package org.apache.ranger.service; import java.util.ArrayList; import java.util.List; -import org.apache.ranger.common.ContextUtil; -import org.apache.ranger.common.RangerConstants; import org.apache.ranger.common.SearchField; import org.apache.ranger.common.SortField; import org.apache.ranger.common.SearchField.DATA_TYPE; @@ -41,7 +39,6 @@ import org.apache.ranger.plugin.model.RangerServiceDef.RangerPolicyConditionDef; import org.apache.ranger.plugin.model.RangerServiceDef.RangerResourceDef; import org.apache.ranger.plugin.model.RangerServiceDef.RangerServiceConfigDef; import org.apache.ranger.plugin.util.SearchFilter; -import org.apache.ranger.view.RangerServiceDefList; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Service; @@ -157,31 +154,5 @@ public class RangerServiceDefService extends RangerServiceDefServiceBase<XXServi public RangerServiceDef getPopulatedViewObject(XXServiceDef xServiceDef) { return this.populateViewBean(xServiceDef); } - @Override - @SuppressWarnings("unchecked") - public RangerServiceDefList searchRangerServiceDefs(SearchFilter searchFilter) { - List<RangerServiceDef> serviceDefList = new ArrayList<RangerServiceDef>(); - RangerServiceDefList retList = new RangerServiceDefList(); - - List<XXServiceDef> xSvcDefList = (List<XXServiceDef>) searchResources(searchFilter, searchFields, sortFields, retList); - List<String> userRoleList = ContextUtil.getCurrentUserSession().getUserRoleList(); - for (XXServiceDef xSvcDef : xSvcDefList) { - if(userRoleList != null && !userRoleList.contains(RangerConstants.ROLE_KEY_ADMIN)){ - if(xSvcDef!=null && !"KMS".equalsIgnoreCase(xSvcDef.getName())){ - serviceDefList.add(populateViewBean(xSvcDef)); - } - } - else if(userRoleList != null && userRoleList.contains(RangerConstants.ROLE_KEY_ADMIN)){ - if(xSvcDef!=null && "KMS".equalsIgnoreCase(xSvcDef.getName())){ - serviceDefList.add(populateViewBean(xSvcDef)); - break; - } - } - } - retList.setServiceDefs(serviceDefList); - - return retList; - } - } http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/39136c5d/security-admin/src/main/java/org/apache/ranger/service/RangerServiceServiceBase.java ---------------------------------------------------------------------- diff --git a/security-admin/src/main/java/org/apache/ranger/service/RangerServiceServiceBase.java b/security-admin/src/main/java/org/apache/ranger/service/RangerServiceServiceBase.java old mode 100755 new mode 100644 index 66f02fe..6883d98 --- a/security-admin/src/main/java/org/apache/ranger/service/RangerServiceServiceBase.java +++ b/security-admin/src/main/java/org/apache/ranger/service/RangerServiceServiceBase.java @@ -92,7 +92,6 @@ public abstract class RangerServiceServiceBase<T extends XXServiceBase, V extend vObj.setDescription(xObj.getDescription()); vObj.setPolicyVersion(xObj.getPolicyVersion()); vObj.setPolicyUpdateTime(xObj.getPolicyUpdateTime()); - vObj.setIsEnabled(xObj.getIsenabled()); return vObj; } http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/39136c5d/security-admin/src/main/webapp/scripts/controllers/Controller.js ---------------------------------------------------------------------- diff --git a/security-admin/src/main/webapp/scripts/controllers/Controller.js b/security-admin/src/main/webapp/scripts/controllers/Controller.js old mode 100755 new mode 100644 index 96a458d..df820e5 --- a/security-admin/src/main/webapp/scripts/controllers/Controller.js +++ b/security-admin/src/main/webapp/scripts/controllers/Controller.js @@ -408,26 +408,26 @@ define(function(require) { var KmsKey = require('models/VXKmsKey'); App.rContent.show(new view({ - model : new KmsKey({'length' : 128, 'cipher' : 'AES' }), + model : new KmsKey(), kmsServiceName : kmsServiceName })); }, -// kmsKeyEditAction : function(kmsServiceName, keyName){ -// MAppState.set({ 'currentTab' : XAGlobals.AppTabs.KMS.value }); -// var view = require('views/kms/KmsKeyCreate'); -// var VXKmsKey = require('models/VXKmsKey'); -// var kmsKeyModel = new VXKmsKey({'name' : keyName}); -// var data = {'provider': kmsServiceName} -// kmsKeyModel.fetch({ -// cache : true, -// data : data -// }).done(function(){ -// App.rContent.show(new view({ -// model : kmsKeyModel, -// kmsServiceName : kmsServiceName -// })); -// }); -// }, + kmsKeyEditAction : function(kmsServiceName, keyName){ + MAppState.set({ 'currentTab' : XAGlobals.AppTabs.KMS.value }); + var view = require('views/kms/KmsKeyCreate'); + var VXKmsKey = require('models/VXKmsKey'); + var kmsKeyModel = new VXKmsKey({'name' : keyName}); + var data = {'provider': kmsServiceName} + kmsKeyModel.fetch({ + cache : true, + data : data + }).done(function(){ + App.rContent.show(new view({ + model : kmsKeyModel, + kmsServiceName : kmsServiceName + })); + }); + }, /**************** ERROR PAGE ******************************/ pageNotFoundAction : function() { var XAUtils = require('utils/XAUtils'); http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/39136c5d/security-admin/src/main/webapp/scripts/modules/XALinks.js ---------------------------------------------------------------------- diff --git a/security-admin/src/main/webapp/scripts/modules/XALinks.js b/security-admin/src/main/webapp/scripts/modules/XALinks.js old mode 100755 new mode 100644 index b4d4483..747b6e6 --- a/security-admin/src/main/webapp/scripts/modules/XALinks.js +++ b/security-admin/src/main/webapp/scripts/modules/XALinks.js @@ -65,7 +65,7 @@ define(function(require) { title: 'h.usersOrGroups' }, Kms : { - href : '#!/kms/keys/new/manage/service', + href : '#!/kms/keys', text : 'h.kms', title: 'h.kms' }, @@ -309,17 +309,6 @@ define(function(require) { text : options.kmsService.get('name'), title: options.kmsService.get('name') }; - }, - KmsManage : function(options) { - var href = "javascript:void(0);"; - if(_.has(options,'kmsService')){ - href = '#!/kms/keys/edit/manage/'+options.kmsService; - } - return { - href : href, - text : 'h.kms', - title: 'h.kms' - }; } }; http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/39136c5d/security-admin/src/main/webapp/scripts/modules/globalize/message/en.js ---------------------------------------------------------------------- diff --git a/security-admin/src/main/webapp/scripts/modules/globalize/message/en.js b/security-admin/src/main/webapp/scripts/modules/globalize/message/en.js index 30450e2..48cb766 100644 --- a/security-admin/src/main/webapp/scripts/modules/globalize/message/en.js +++ b/security-admin/src/main/webapp/scripts/modules/globalize/message/en.js @@ -222,8 +222,7 @@ define(function(require) { length : 'Length', version : 'Version', attributes : 'Attributes', - material : 'Material', - addNewConfig : 'Add New Configurations' + material : 'Material' }, btn : { add : 'Add', @@ -317,8 +316,7 @@ define(function(require) { repoDoesNotExistAnymore : 'Repository does not exist anymore..', policyDisabledMsg : 'This policy is currently in disabled state.', noRecordsFound : 'No Records Found', - keyDeleteMsg : 'Key deleted successfully', - rolloverSuccessfully : 'Key rollover successfully' + keyDeleteMsg : 'Key deleted successfully' http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/39136c5d/security-admin/src/main/webapp/scripts/routers/Router.js ---------------------------------------------------------------------- diff --git a/security-admin/src/main/webapp/scripts/routers/Router.js b/security-admin/src/main/webapp/scripts/routers/Router.js index 127b418..e706cdf 100644 --- a/security-admin/src/main/webapp/scripts/routers/Router.js +++ b/security-admin/src/main/webapp/scripts/routers/Router.js @@ -65,7 +65,7 @@ function(Backbone, Marionette, localization, MAppState, XAUtil){ /************ KMS ***************************/ "!/kms/keys/:isService/manage/:serviceName" : "kmsManagerAction", "!/kms/keys/:serviceName/create" : "kmsKeyCreateAction", -// "!/kms/keys/:serviceName/edit/:id" : "kmsKeyEditAction", + "!/kms/keys/:serviceName/edit/:id" : "kmsKeyEditAction", /*************** ERROR PAGE ***********************/ "*actions" : "pageNotFoundAction" http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/39136c5d/security-admin/src/main/webapp/scripts/utils/XAGlobals.js ---------------------------------------------------------------------- diff --git a/security-admin/src/main/webapp/scripts/utils/XAGlobals.js b/security-admin/src/main/webapp/scripts/utils/XAGlobals.js index 1de57bc..f772e3c 100644 --- a/security-admin/src/main/webapp/scripts/utils/XAGlobals.js +++ b/security-admin/src/main/webapp/scripts/utils/XAGlobals.js @@ -67,10 +67,9 @@ define(function(require){ XAGlobals.ListOfModuleActions = { 'Policy Manager':['serviceManagerAction','serviceCreateAction','serviceEditAction', 'policyManageAction','RangerPolicyCreateAction','RangerPolicyEditAction'], 'Users/Groups' : ['userManagerAction','userCreateAction','userEditAction','groupCreateAction','groupEditAction'], - 'Analytics' : ['userAccessReportAction'], - 'Audit' : ['auditReportAction','loginSessionDetail'], - 'Permissions' : ['modulePermissionsAction','modulePermissionEditAction'], - 'KMS' : ['kmsManagerAction','kmsKeyCreateAction'] - }; + 'Analytics' : ['userAccessReportAction'], + 'Audit' : ['auditReportAction','loginSessionDetail'], + 'Permissions' : ['modulePermissionsAction','modulePermissionEditAction'] + }; return XAGlobals; }); http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/39136c5d/security-admin/src/main/webapp/scripts/views/kms/KMSTableLayout.js ---------------------------------------------------------------------- diff --git a/security-admin/src/main/webapp/scripts/views/kms/KMSTableLayout.js b/security-admin/src/main/webapp/scripts/views/kms/KMSTableLayout.js old mode 100755 new mode 100644 index 467a318..c3e8f4a --- a/security-admin/src/main/webapp/scripts/views/kms/KMSTableLayout.js +++ b/security-admin/src/main/webapp/scripts/views/kms/KMSTableLayout.js @@ -42,7 +42,7 @@ define(function(require){ templateHelpers : function(){ // return { kmsServiceName : this.kmsServiceName }; }, - breadCrumbs :[XALinks.get('KmsManage')], + breadCrumbs :[XALinks.get('Kms')], /** Layout sub regions */ regions: { 'rTableList' :'div[data-id="r_tableList"]', @@ -54,8 +54,7 @@ define(function(require){ addNewKey : '[data-id="addNewKey"]', deleteKeyBtn : '[data-name="deleteKey"]', visualSearch: '.visual_search', - selectServiceName : '[data-js="serviceName"]', - rolloverBtn : '[data-name="rolloverKey"]', + selectServiceName : '[data-js="serviceName"]' }, /** ui events hash */ @@ -63,7 +62,6 @@ define(function(require){ var events = {}; events['click '+this.ui.tab+' li a'] = 'onTabChange'; events['click '+this.ui.deleteKeyBtn] = 'onDelete'; - events['click '+this.ui.rolloverBtn] = 'onRollover'; return events; }, @@ -119,7 +117,7 @@ define(function(require){ this.renderKeyTab(); } if(this.isKnownKmsServicePage){ - this.ui.selectServiceName.val(this.kmsServiceName); + this.ui.selectServiceName.val(this.ksmServiceName); this.ui.addNewKey.attr('disabled',false); this.ui.addNewKey.attr('href','#!/kms/keys/'+ this.kmsServiceName +'/create') @@ -161,10 +159,12 @@ define(function(require){ name : { label : localization.tt("lbl.keyName"), - cell :'string', + href: function(model){ + return '#!/kms/keys/'+that.kmsServiceName+'/edit/'+model.get('name'); + }, editable:false, sortable:false, - + cell :'uri' }, cipher : { label : localization.tt("lbl.cipher"), @@ -220,7 +220,7 @@ define(function(require){ label : localization.tt("lbl.action"), formatter: _.extend({}, Backgrid.CellFormatter.prototype, { fromRaw: function (rawValue,model) { - return '<a href="javascript:void(0);" data-name ="rolloverKey" data-id="'+model.get('name')+'" class="btn btn-mini" title="Rollover"><i class="icon-edit" /></a>\ + return '<a href="#!/kms/keys/'+that.kmsServiceName+'/edit/'+model.get('name')+'" class="btn btn-mini" title="Rollover"><i class="icon-edit" /></a>\ <a href="javascript:void(0);" data-name ="deleteKey" data-id="'+model.get('name')+'" class="btn btn-mini btn-danger" title="Delete"><i class="icon-trash" /></a>'; //You can use rawValue to custom your html, you can change this value using the name parameter. } @@ -334,35 +334,6 @@ define(function(require){ } }); }, - onRollover :function(e){ - var that = this; - var obj = this.collection.get($(e.currentTarget).data('id')); - var model = new KmsKey({ 'name' : obj.attributes.name }); - model.collection = this.collection; - var url = model.urlRoot+"?provider="+ this.kmsServiceName; - XAUtil.confirmPopup({ - msg :'Are you sure want to rollover ?', - callback : function(){ - XAUtil.blockUI(); - - model.save({},{ - 'type' : 'PUT', - 'url' : url, - 'success': function(model, response) { - XAUtil.blockUI('unblock'); - that.collection.remove(model.get('id')); - XAUtil.notifySuccess('Success', localization.tt('msg.rolloverSuccessfully')); - that.renderKeyTab(); - that.collection.fetch(); - }, - 'error': function (model, response, options) { - XAUtil.blockUI('unblock'); - XAUtil.notifyError('Error', 'Error rollovering key!'); - } - }); - } - }); - }, /** on close */ onClose: function(){ XAUtil.allowNavigation(); @@ -371,4 +342,4 @@ define(function(require){ }); return KmsTableLayout; -}); \ No newline at end of file +}); http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/39136c5d/security-admin/src/main/webapp/scripts/views/kms/KmsKeyCreate.js ---------------------------------------------------------------------- diff --git a/security-admin/src/main/webapp/scripts/views/kms/KmsKeyCreate.js b/security-admin/src/main/webapp/scripts/views/kms/KmsKeyCreate.js index 1ee0b3d..4bf9bd1 100644 --- a/security-admin/src/main/webapp/scripts/views/kms/KmsKeyCreate.js +++ b/security-admin/src/main/webapp/scripts/views/kms/KmsKeyCreate.js @@ -50,7 +50,8 @@ define(function(require){ breadCrumbs :function(){ var opts = { 'kmsService' : this.kmsService, 'kmsServiceDefModel' : this.kmsServiceDefModel } if(this.model.isNew()) - return [XALinks.get('KmsManage',opts), XALinks.get('KmsServiceForKey', opts), XALinks.get('KmsKeyCreate')]; + return [XALinks.get('Kms'), XALinks.get('KmsServiceForKey', opts), XALinks.get('KmsKeyCreate')]; + return [XALinks.get('Kms'), XALinks.get('KmsServiceForKey', opts), XALinks.get('KmsKeyEdit')]; } , /** Layout sub regions */ http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/39136c5d/security-admin/src/main/webapp/scripts/views/kms/KmsKeyForm.js ---------------------------------------------------------------------- diff --git a/security-admin/src/main/webapp/scripts/views/kms/KmsKeyForm.js b/security-admin/src/main/webapp/scripts/views/kms/KmsKeyForm.js index 7d7262a..25b2691 100755 --- a/security-admin/src/main/webapp/scripts/views/kms/KmsKeyForm.js +++ b/security-admin/src/main/webapp/scripts/views/kms/KmsKeyForm.js @@ -24,7 +24,6 @@ define(function(require){ var Backbone = require('backbone'); var XAEnums = require('utils/XAEnums'); var localization = require('utils/XALangSupport'); - var KeyValuePairList= require('views/service/ConfigurationList') require('backbone-forms'); require('backbone-forms.templates'); @@ -40,9 +39,8 @@ define(function(require){ initialize: function(options) { console.log("initialized a KmsKeyForm Form View"); _.extend(this, _.pick(options,'')); - this.attributesColl = new Backbone.Collection(); - this.setupFormForEditMode(); - Backbone.Form.prototype.initialize.call(this, options); + Backbone.Form.prototype.initialize.call(this, options); + this.bindEvents(); }, /** all events binding here */ @@ -58,16 +56,21 @@ define(function(require){ cipher : { type : 'Text', title : localization.tt("lbl.cipher"), + fieldAttrs : {style : 'display:none;'}, + editorAttrs : {'disabled' : true} }, length : { type : 'Number', title : localization.tt("lbl.length"), - validators : [{type : 'regexp', regexp : /^\d+$/, message : 'Please enter valid integer value.'}], + fieldAttrs : {style : 'display:none;'}, + editorAttrs : {'disabled' : true} }, - /*material : { + material : { type : 'Text', title : localization.tt("lbl.material"), - },*/ + fieldAttrs : {style : 'display:none;'}, + editorAttrs : {'disabled' : true} + }, description : { type : 'TextArea', title : localization.tt("lbl.description"), @@ -78,28 +81,23 @@ define(function(require){ render: function(options) { Backbone.Form.prototype.render.call(this, options); this.initializePlugins(); - this.renderCustomFields(); - }, - /** all custom field rendering */ - renderCustomFields: function(){ - this.$('.attributes').html(new KeyValuePairList({ - collection : this.attributesColl, - model : this.model, - fieldLabel : localization.tt("lbl.attributes"), - }).render().el); - }, - setupFormForEditMode : function() { - if(!this.model.isNew() && !_.isUndefined(this.model.get('attributes'))){ - _.map(this.model.get('attributes'), function(value, key) { this.attributesColl.add({'name' : key, 'value' : value}) }, this) + if(this.model.has('versions')){ + this.fields.cipher.$el.show(); + this.fields.length.$el.show(); + this.fields.description.editor.$el.attr('disabled',true); } }, /** all post render plugin initialization */ initializePlugins: function(){ }, beforeSave : function(){ - var attributes = {}; - this.attributesColl.each(function(obj){ attributes[obj.get('name')] = obj.get('value'); }) - this.model.set('attributes',attributes); + //to check model is new or not + if(this.model.has('versions')){ + this.model.attributes = { 'name' : this.model.get('name') }; + }else{ + this.model.attributes = { 'name' : this.model.get('name'), 'description' : this.model.get('description')}; + } + } }); http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/39136c5d/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 2396955..a6b6539 100644 --- a/security-admin/src/main/webapp/scripts/views/policies/RangerPolicyForm.js +++ b/security-admin/src/main/webapp/scripts/views/policies/RangerPolicyForm.js @@ -422,8 +422,6 @@ define(function(require){ }).length === 0) { if(!_.isUndefined(options.regExpValidation) && !options.regExpValidation.regexp.test(term)){ validRegExpString = false; - }else if($.inArray(term, this.val()) >= 0){ - return null; }else{ return { id : term, http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/39136c5d/security-admin/src/main/webapp/scripts/views/service/ConfigurationList.js ---------------------------------------------------------------------- diff --git a/security-admin/src/main/webapp/scripts/views/service/ConfigurationList.js b/security-admin/src/main/webapp/scripts/views/service/ConfigurationList.js index 598db83..17ab912 100644 --- a/security-admin/src/main/webapp/scripts/views/service/ConfigurationList.js +++ b/security-admin/src/main/webapp/scripts/views/service/ConfigurationList.js @@ -72,7 +72,6 @@ define(function(require) { _msvName : 'ConfigurationList', template : require('hbs!tmpl/service/ConfigurationList_tmpl'), templateHelpers :function(){ - return { 'fieldLabel' : this.fieldLabel }; }, getItemView : function(item){ if(!item){ @@ -90,7 +89,7 @@ define(function(require) { 'click [data-action="addGroup"]' : 'addNew' }, initialize : function(options) { - _.extend(this, _.pick(options, 'fieldLabel')); + _.extend(this, _.pick(options, '')); // this.listenTo(this.groupList, 'sync', this.render, this); if(this.collection.length == 0) this.collection.add(new Backbone.Model()); http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/39136c5d/security-admin/src/main/webapp/scripts/views/service/ServiceForm.js ---------------------------------------------------------------------- diff --git a/security-admin/src/main/webapp/scripts/views/service/ServiceForm.js b/security-admin/src/main/webapp/scripts/views/service/ServiceForm.js index a3ac650..9d4fddc 100644 --- a/security-admin/src/main/webapp/scripts/views/service/ServiceForm.js +++ b/security-admin/src/main/webapp/scripts/views/service/ServiceForm.js @@ -133,7 +133,6 @@ define(function(require){ this.$('.extraServiceConfigs').html(new ConfigurationList({ collection : this.extraConfigColl, model : this.model, - fieldLabel : localization.tt('lbl.addNewConfig') }).render().el); }, http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/39136c5d/security-admin/src/main/webapp/templates/common/TopNav_tmpl.html ---------------------------------------------------------------------- diff --git a/security-admin/src/main/webapp/templates/common/TopNav_tmpl.html b/security-admin/src/main/webapp/templates/common/TopNav_tmpl.html index d59527c..148ff85 100644 --- a/security-admin/src/main/webapp/templates/common/TopNav_tmpl.html +++ b/security-admin/src/main/webapp/templates/common/TopNav_tmpl.html @@ -44,10 +44,9 @@ <a href="#!/permissions" id="nav6"><i class=" icon-file-alt"></i> {{tt 'h.permissions'}} </a> </li> {{/isSystemAdmin}} - {{#hasAccessToTab 'KMS'}} + <li> <a href="#!/kms/keys/new/manage/service" id="nav7"><i class="icon-key"></i> {{tt 'h.kms'}} </a> </li> - {{/hasAccessToTab}} </ul> </div> http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/39136c5d/security-admin/src/main/webapp/templates/kms/KmsKeyForm_tmpl.html ---------------------------------------------------------------------- diff --git a/security-admin/src/main/webapp/templates/kms/KmsKeyForm_tmpl.html b/security-admin/src/main/webapp/templates/kms/KmsKeyForm_tmpl.html index 109db4e..7a0d4c0 100644 --- a/security-admin/src/main/webapp/templates/kms/KmsKeyForm_tmpl.html +++ b/security-admin/src/main/webapp/templates/kms/KmsKeyForm_tmpl.html @@ -16,5 +16,4 @@ --}} <form class="form-horizontal" > <div class="" data-fields="*"></div> - <div class="attributes" ></div> </form> http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/39136c5d/security-admin/src/main/webapp/templates/service/ConfigurationList_tmpl.html ---------------------------------------------------------------------- diff --git a/security-admin/src/main/webapp/templates/service/ConfigurationList_tmpl.html b/security-admin/src/main/webapp/templates/service/ConfigurationList_tmpl.html index dbc0d65..dc68ef9 100644 --- a/security-admin/src/main/webapp/templates/service/ConfigurationList_tmpl.html +++ b/security-admin/src/main/webapp/templates/service/ConfigurationList_tmpl.html @@ -15,7 +15,7 @@ limitations under the License. --}} <div class="control-group"> - <label class="control-label">{{fieldLabel}}</label> + <label class="control-label">Add New Configurations</label> <div class="controls"> <table class="table table-bordered table-condensed" style="width:30%"> <thead>
