Parcourir la source

Merge pull request #12740 from miguelvazq/HPCC-20873

HPCC-20873 LDAP OUs hardcoded

Reviewed-By: Gordon Smith <gordon.smith@lexisnexis.com>
Reviewed-By: Richard Chapman <rchapman@hpccsystems.com>
Richard Chapman il y a 5 ans
Parent
commit
81e9506760

+ 1 - 1
esp/src/eclwatch/ShowIndividualPermissionsWidget.js

@@ -32,7 +32,7 @@ define([
             init: function (params) {
                 if (this.inherited(arguments))
                     return;
-                this.store = WsAccess.CreateIndividualPermissionsStore(params.Basedn, params.Rtype, params.Rtitle, params.Name);
+                this.store = WsAccess.CreateIndividualPermissionsStore(params.Basedn, params.Name);
                 this.grid.setStore(this.store);
                 this._refreshActionState();
             },

+ 14 - 27
esp/src/eclwatch/UserQueryWidget.js

@@ -108,12 +108,8 @@ define([
         _onFileScopeDefaultPermissions: function () {
             var row = this.getRow("FileScope");
             if (row) {
-                var clean = row.basedn.split(/,(.+)?/)[1] //the request does not like the ou with prefix have to issue JIRA to fix this
-                var fileScopeDefaultPermissionsTab = this.ensurePermissionsPane(row.basedn + "FileScope", {
-                    Basedn: clean,
-                    Rtype: "file",
-                    Rtitle: "",
-                    Name: "files",
+                var fileScopeDefaultPermissionsTab = this.ensurePermissionsPane(row.Basedn + "FileScope", {
+                    Basedn: row.Basedn,
                     TabName: this.i18n.title_FileScopeDefaultPermissions,
                     DefaultPermissions: true
                 });
@@ -124,12 +120,8 @@ define([
         _onWorkunitScopeDefaultPermissions: function () {
             var row = this.getRow("WorkunitScope");
             if (row) {
-                var clean = row.basedn.split(/,(.+)?/)[1] //the request does not like the ou with prefix have to issue JIRA to fix this
-                var workunitScopeDefaultPermissionsTab = this.ensurePermissionsPane(row.basedn + "WUScope", {
-                    Basedn: clean,
-                    Rtype: "workunit",
-                    Rtitle: "",
-                    Name: "workunits",
+                var workunitScopeDefaultPermissionsTab = this.ensurePermissionsPane(row.Basedn + "WUScope", {
+                    Basedn: row.Basedn,
                     TabName: this.i18n.title_WorkunitScopeDefaultPermissions,
                     DefaultPermissions: true
                 });
@@ -140,10 +132,8 @@ define([
         _onPhysicalFiles: function () {
             var row = this.getRow("FileScope");
             if (row) {
-                var physicalPermissionsTab = this.ensurePermissionsPane(row.basedn + "PhysicalFiles", {
-                    Basedn: row.basedn,
-                    Rtype: "file",
-                    Rtitle: "FileScope",
+                var physicalPermissionsTab = this.ensurePermissionsPane(row.Basedn + "PhysicalFiles", {
+                    Basedn: row.Basedn,
                     Name: "file",
                     TabName: "Physical Files"
                 });
@@ -374,7 +364,8 @@ define([
         },
 
         _onAddPermissionSubmit: function (event) {
-            var selRow = this.addPermissionType.__hpcc_data[this.addPermissionType.get("value")];
+            var selRow = {}
+            selRow["BasednName"] = this.addPermissionType.get("value");
             if (selRow) {
                 var request = lang.mixin(selRow, domForm.toObject(this.id + "AddPermissionForm"));
                 var context = this;
@@ -433,11 +424,9 @@ define([
             }
         },
 
-        _onPermissionsRowDblClick: function (basedn, rtype, rtitle, name, description) {
+        _onPermissionsRowDblClick: function (basedn, name, description) {
             var permissionsTab = this.ensurePermissionsPane(name, {
                 Basedn: basedn,
-                Rtype: rtype,
-                Rtitle: rtitle,
                 Name: name,
                 Description: description
             });
@@ -719,9 +708,9 @@ define([
                     arrayUtil.forEach(response.BasednsResponse.Basedns.Basedn, function (item, idx) {
                         options.push({
                             label: item.name,
-                            value: item.basedn
+                            value: item.name
                         });
-                        optionMap[item.basedn] = item;
+                        optionMap[item.name] = item;
                     }, this);
                 }
                 this.addPermissionType.set("options", options);
@@ -776,13 +765,13 @@ define([
             this.permissionsGrid.on(".dgrid-row-url:click", function (evt) {
                 if (context._onPermissionsRowDblClick) {
                     var item = context.permissionsGrid.row(evt).data;
-                    context._onPermissionsRowDblClick(item.__hpcc_parent.basedn, item.__hpcc_parent.rtype, item.__hpcc_parent.rtitle, item.name, item.DisplayName);
+                    context._onPermissionsRowDblClick(item.__hpcc_parent.name, item.name, item.DisplayName);
                 }
             });
             this.permissionsGrid.on(".dgrid-row:dblclick", function (evt) {
                 if (context._onPermissionsRowDblClick) {
                     var item = context.permissionsGrid.row(evt).data;
-                    context._onPermissionsRowDblClick(item.__hpcc_parent.basedn, item.__hpcc_parent.rtype, item.__hpcc_parent.rtitle, item.name, item.DisplayName);
+                    context._onPermissionsRowDblClick(item.__hpcc_parent.name, item.name, item.DisplayName);
                 }
             });
             this.permissionsGrid.onSelectionChanged(function (event) {
@@ -878,9 +867,7 @@ define([
                 var context = this;
                 WsAccess.Resources({
                     request: {
-                        basedn: event.rows[0].id,
-                        rtype: "file",
-                        rtitle: "FileScope"
+                        name: event.rows[0].data.Basedn
                     }
                 }).then(function (response) {
                     if (lang.exists("ResourcesResponse.scopeScansStatus", response)) {

+ 1 - 1
esp/src/eclwatch/nls/hpcc.js

@@ -610,7 +610,7 @@ define({root:
     Replicate: "Replicate",
     ReplicatedLost: "Replicated Lost",
     ReplicateOffset: "Replicate Offset",
-   Report: "Report",
+    Report: "Report",
     RepresentsASubset: "represent a subset of the total number of matches. Using a correct filter may reduce the number of matches.",
     RequestSchema: "Request Schema",
     RequiredForFixedSpray: "Required for fixed spray",

+ 32 - 69
esp/src/src/ws_access.ts

@@ -58,9 +58,7 @@ var ResourcesStore = declare([Memory], {
         var request = {
             account_name: this.groupname ? this.groupname : this.username,
             account_type: this.groupname ? 1 : 0,
-            basedn: row.__hpcc_parent.basedn,
-            rtitle: row.__hpcc_parent.rtitle,
-            rtype: row.__hpcc_parent.rtype,
+            BasednName: row.__hpcc_parent.name,
             rname: row.name,
             action: "update"
         };
@@ -79,7 +77,7 @@ var ResourcesStore = declare([Memory], {
         ]).then(lang.hitch(this, function (response) {
             var accountPermissions = {};
             arrayUtil.forEach(response[1], function (item, idx) {
-                accountPermissions[item.PermissionName] = item;
+                accountPermissions[item.ResourceName] = item;
             }, this);
 
             var data = [];
@@ -111,9 +109,7 @@ var ResourcesStore = declare([Memory], {
     refreshResources: function (query) {
         return Resources({
             request: {
-                basedn: this.parentRow.basedn,
-                rtype: this.parentRow.rtype,
-                rtitle: this.parentRow.rtitle
+                name: this.parentRow.name
             }
         }).then(lang.hitch(this, function (response) {
             if (lang.exists("ResourcesResponse.Resources.Resource", response)) {
@@ -152,10 +148,8 @@ var InheritedPermissionStore = declare([Memory], {
         this.get(row.__hpcc_id);
         var retVal = inherited(arguments);
         var request = {
-            basedn: row.basedn,
-            rtype: row.rtype,
-            rname: row.rname,
-            rtitle: row.rtitle,
+            BasednName: row.BasednName,
+            rname: row.ResourceName,
             account_name: row.account_name,
             account_type: 0,
             action: "update"
@@ -174,13 +168,11 @@ var InheritedPermissionStore = declare([Memory], {
         ]).then(lang.hitch(this, function (response) {
             var accountPermissions = {};
             arrayUtil.forEach(response[0], function (item, idx) {
-                accountPermissions[item.PermissionName] = item;
+                accountPermissions[item.ResourceName] = item;
                 data.push(lang.mixin(item, {
                     __hpcc_type: "InheritedPermissions",
-                    __hpcc_id: this.TabName + CONCAT_SYMBOL + this.AccountName + CONCAT_SYMBOL + item.PermissionName + CONCAT_SYMBOL + idx,
-                    rname: item.PermissionName,
-                    rtype: item.RType,
-                    rtitle: item.ResourceName,
+                    __hpcc_id: this.TabName + CONCAT_SYMBOL + this.AccountName + CONCAT_SYMBOL + item.ResourceName + CONCAT_SYMBOL + idx,
+                    rname: item.ResourceName,
                     account_name: this.TabName,
                     allow_access: item ? item.allow_access : false,
                     allow_read: item ? item.allow_read : false,
@@ -234,12 +226,9 @@ var AccountResourcesStore = declare([Memory], {
         this.get(row.__hpcc_id);
         var retVal = inherited(arguments);
         var request = {
-            basedn: row.basedn,
-            rtype: row.rtype,
-            rname: row.rname,
-            rtitle: row.rtitle,
+            BasednName: row.BasednName,
+            rname: row.ResourceName,
             account_name: row.account_name,
-            account_type: 0,
             action: "update"
         };
         lang.mixin(request, row);
@@ -256,13 +245,11 @@ var AccountResourcesStore = declare([Memory], {
         ]).then(lang.hitch(this, function (response) {
             var accountPermissions = {};
             arrayUtil.forEach(response[0], function (item, idx) {
-                accountPermissions[item.PermissionName] = item;
+                accountPermissions[item.ResourceName] = item;
                 data.push(lang.mixin(item, {
                     __hpcc_type: "AccountPermissions",
-                    __hpcc_id: this.AccountName + CONCAT_SYMBOL + item.PermissionName + CONCAT_SYMBOL + idx,
-                    rname: item.PermissionName,
-                    rtype: item.RType,
-                    rtitle: item.ResourceName,
+                    __hpcc_id: this.AccountName + CONCAT_SYMBOL + item.ResourceName + CONCAT_SYMBOL + idx,
+                    rname: item.ResourceName,
                     account_name: this.AccountName,
                     allow_access: item ? item.allow_access : false,
                     allow_read: item ? item.allow_read : false,
@@ -310,10 +297,9 @@ var IndividualPermissionsStore = declare([Memory], {
         this.get(row.__hpcc_id);
         var retVal = inherited(arguments);
         var request = {
-            basedn: row.basedn,
-            rtype: row.rtype,
-            rtitle: row.rtitle,
-            rname: row.name,
+            BasednName: row.BasednName,
+            rname: row.rname,
+            account_name: row.account_name,
             action: "update"
         };
         lang.mixin(request, row);
@@ -334,9 +320,7 @@ var IndividualPermissionsStore = declare([Memory], {
                 data.push(lang.mixin(item, {
                     __hpcc_type: "IndividualPermissions",
                     __hpcc_id: this.name + CONCAT_SYMBOL + idx,
-                    basedn: this.basedn,
-                    rtype: this.rtype,
-                    rtitle: this.rtitle,
+                    BasednName: this.basedn,
                     rname: this.name,
                     account_name: item.account_name,
                     allow_access: item ? item.allow_access : false,
@@ -362,11 +346,8 @@ var IndividualPermissionsStore = declare([Memory], {
         }
         return ResourcePermissions({
             request: {
-                basedn: this.basedn,
-                rtype: this.rtype,
-                rtitle: this.rtitle,
-                name: this.name
-
+                name: this.name,
+                BasednName: this.basedn
             }
         }).then(lang.hitch(this, function (response) {
             if (lang.exists("ResourcePermissionsResponse.Permissions.Permission", response)) {
@@ -428,9 +409,11 @@ var PermissionsStore = declare([Memory], {
                         __hpcc_type: "Permission",
                         __hpcc_id: item.basedn,
                         DisplayName: item.name,
-                        children: lang.mixin(CreateResourcesStore(this.groupname, this.username, item.basedn), {
+                        Basedn: item.name,
+                        children: lang.mixin(CreateResourcesStore(this.groupname, this.username, item.name, item.rname), {
                             parent: this,
-                            parentRow: item
+                            parentRow: item,
+                            Basedn: item.name
                         })
                     }));
                 }, this);
@@ -551,7 +534,11 @@ export function ResourcePermissions(params) {
 }
 
 export function Resources(params) {
-    return _doCall("Resources", params);
+    return _doCall("Resources", {
+        request: {
+            BasednName: params.request.name
+        }
+    });
 }
 
 export function ResourceAdd(params) {
@@ -594,29 +581,6 @@ export function DisableScopeScans() {
     });
 }
 
-export function DefaultPermissions() {
-    return _doCall("ResourcePermissions", {
-        request: {
-            basedn: "ou=ecl,dc=hpccdev,dc=local",
-            rtype: "file",
-            name: "files",
-            action: "Default Permissions"
-        }
-    });
-}
-
-export function PhysicalFiles() {
-    return _doCall("ResourcePermissions", {
-        request: {
-            basedn: "ou=files,ou=ecl,dc=hpccdev,dc=local",
-            rtype: "file",
-            rtitle: "FileScope",
-            name: "file",
-            action: "Physical Files"
-        }
-    });
-}
-
 export function CheckFilePermissions() {
     return _doCall("FilePermission", {
         request: {
@@ -667,19 +631,18 @@ export function CreateInheritedPermissionsStore(IsGroup, IncludeGroup, AccountNa
     return Observable(store);
 }
 
-export function CreateIndividualPermissionsStore(basedn, rtype, rtitle, name) {
+export function CreateIndividualPermissionsStore(basedn, name) {
     var store = new IndividualPermissionsStore();
     store.basedn = basedn;
-    store.rtype = rtype;
-    store.rtitle = rtitle;
     store.name = name;
     return Observable(store);
 }
 
-export function CreateResourcesStore(groupname, username, basedn) {
+export function CreateResourcesStore(groupname, username, basedn, name) {
     var store = new ResourcesStore();
     store.groupname = groupname;
     store.username = username;
     store.basedn = basedn;
+    store.name = name;
     return Observable(store);
-}
+}