Repository: incubator-ranger
Updated Branches:
  refs/heads/master 782126465 -> 2d8d15aeb


RANGER-941: Getting Access denied page while creating kms service on Ranger UI

Signed-off-by: Gautam Borad <[email protected]>


Project: http://git-wip-us.apache.org/repos/asf/incubator-ranger/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ranger/commit/2d8d15ae
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ranger/tree/2d8d15ae
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ranger/diff/2d8d15ae

Branch: refs/heads/master
Commit: 2d8d15aebe6b19cd70d994614afe10a328bf8db0
Parents: 7821264
Author: Mehul Parikh <[email protected]>
Authored: Thu Apr 21 17:56:19 2016 +0530
Committer: Gautam Borad <[email protected]>
Committed: Thu Apr 28 12:10:18 2016 +0530

----------------------------------------------------------------------
 .../src/main/webapp/scripts/controllers/Controller.js |  2 +-
 .../src/main/webapp/scripts/routers/Router.js         |  2 +-
 .../src/main/webapp/scripts/utils/XAGlobals.js        |  5 +++--
 .../src/main/webapp/scripts/utils/XAUtils.js          | 14 +++++++++-----
 .../src/main/webapp/templates/helpers/XAHelpers.js    |  1 -
 5 files changed, 14 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/2d8d15ae/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
index 4af460c..b6dee8d 100755
--- a/security-admin/src/main/webapp/scripts/controllers/Controller.js
+++ b/security-admin/src/main/webapp/scripts/controllers/Controller.js
@@ -290,7 +290,7 @@ define(function(require) {
                           collection : rangerPolicyList
                   }));
           },
-          RangerPolicyCreateByTypeAction :function(serviceId, policyType){
+          RangerPolicyCreateAction :function(serviceId, policyType){
           MAppState.set({ 'currentTab' : XAGlobals.AppTabs.AccessManager.value 
});
 
                   var view                     = 
require('views/policies/RangerPolicyCreate');

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/2d8d15ae/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 b508e64..c8391e6 100644
--- a/security-admin/src/main/webapp/scripts/routers/Router.js
+++ b/security-admin/src/main/webapp/scripts/routers/Router.js
@@ -56,7 +56,7 @@ function(Backbone, Marionette, localization, MAppState, 
XAUtil){
                        "!/service/:serviceType/edit/:id"       : 
"serviceEditAction",
                        
                        "!/service/:serviceId/policies/:policyType"             
        : "policyManageAction",
-                       "!/service/:serviceId/policies/create/:policyType"      
: "RangerPolicyCreateByTypeAction",
+                       "!/service/:serviceId/policies/create/:policyType"      
: "RangerPolicyCreateAction",
                        "!/service/:serviceId/policies/:id/edit"                
        : "RangerPolicyEditAction",
 
                        /************PERMISSIONS VIEWS 
*****************************************/

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/2d8d15ae/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 092dee2..d16e5de 100644
--- a/security-admin/src/main/webapp/scripts/utils/XAGlobals.js
+++ b/security-admin/src/main/webapp/scripts/utils/XAGlobals.js
@@ -64,8 +64,9 @@ define(function(require){
        
        XAGlobals.ListOfModuleActions = {
                        'Access Manager' : { 'Resource Based Policies' : 
['serviceManagerAction','serviceCreateAction','serviceEditAction', 
'policyManageAction','RangerPolicyCreateAction','RangerPolicyEditAction'],
-                                                                'Reports' : 
['userAccessReportAction'],
-                                                               'Tag Based 
Policies' : ['serviceCreateAction','serviceEditAction', 
'policyManageAction','RangerPolicyCreateAction','RangerPolicyEditAction']},
+                                                                'Reports'      
                           : ['userAccessReportAction'],
+                                                                'Tag Based 
Policies'      : 
['serviceManagerAction','serviceCreateAction','serviceEditAction', 
'policyManageAction','RangerPolicyCreateAction','RangerPolicyEditAction']
+                                                               },
                        'Audit'                  : 
['auditReportAction','loginSessionDetail'],
                        'Encryption'     : {'Key Manager' : 
['kmsManagerAction','kmsKeyCreateAction'] },
                        'Settings'               : {'Users/Groups' : 
['userManagerAction','userCreateAction','userEditAction','groupCreateAction','groupEditAction'],

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/2d8d15ae/security-admin/src/main/webapp/scripts/utils/XAUtils.js
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/scripts/utils/XAUtils.js 
b/security-admin/src/main/webapp/scripts/utils/XAUtils.js
index d97cefc..71b01a3 100644
--- a/security-admin/src/main/webapp/scripts/utils/XAUtils.js
+++ b/security-admin/src/main/webapp/scripts/utils/XAUtils.js
@@ -1075,19 +1075,23 @@ define(function(require) {
                        
                        var denyControllerActions = [], denyModulesObj = [];
                        var userModuleNames = 
_.pluck(vXPortalUser.get('userPermList'),'moduleName');
-                       //TODO Temporary fix for tag based policies : need to 
come from server
-//                     userModuleNames.push('Tag Based Policies')
                        //add by default permission module to admin user
                        if (SessionMgr.isSystemAdmin()){
                                userModuleNames.push('Permissions')
                        }
-                       var groupModuleNames = 
_.pluck(vXPortalUser.get('groupPermissions'), 'moduleName');
-                       var moduleNames = _.union(userModuleNames, 
groupModuleNames);
+                       var groupModuleNames = 
_.pluck(vXPortalUser.get('groupPermissions'), 'moduleName'),
+                       moduleNames = _.union(userModuleNames, 
groupModuleNames),
+                       tagBasedPolicyStr = 'Tag Based Policies', 
resourceBasedPolicyStr = 'Resource Based Policies';
                        
                        _.each(XAGlobals.ListOfModuleActions,function(val,key){
                                if(!_.isArray(val)){
                                        _.each(val,function(val1,key1){
-                                               if($.inArray(key1,moduleNames) 
< 0){
+                                               if($.inArray(key1,moduleNames) 
< 0 ){
+                                                       //we are using same 
controller actions for resource and tag based service and policies 
creation/updation/listing page
+                                                       if( key1 == 
tagBasedPolicyStr && $.inArray(resourceBasedPolicyStr, moduleNames) >= 0 
+                                                                       || key1 
== resourceBasedPolicyStr && $.inArray(tagBasedPolicyStr, moduleNames) >= 0){
+                                                               return;
+                                                       }
                                                        denyModulesObj = 
val1.concat(denyModulesObj)
                                                }
                                        });

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/2d8d15ae/security-admin/src/main/webapp/templates/helpers/XAHelpers.js
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/templates/helpers/XAHelpers.js 
b/security-admin/src/main/webapp/templates/helpers/XAHelpers.js
index 192bb06..08d18cf 100644
--- a/security-admin/src/main/webapp/templates/helpers/XAHelpers.js
+++ b/security-admin/src/main/webapp/templates/helpers/XAHelpers.js
@@ -534,7 +534,6 @@
                return str.toUpperCase();
        });
        Handlebars.registerHelper('hasAccessToTab', function(tabName,options) {
-//             if(tabName == 'Tag Based Policies') return  options.fn(this);
                var vxPortalUser = SessionMgr.getUserProfile();
                var userModules = _.pluck(vxPortalUser.get('userPermList'), 
'moduleName');
                var groupModules = 
_.pluck(vxPortalUser.get('groupPermissions'), 'moduleName');

Reply via email to