Paging has been enabled on self-service permissions and delegations
list pages. The search facet's get_pkeys() has been fixed to handle
non-array value. New test data files have been added as well.

Ticket #2092

This patch depends on Martin's patch #180.

--
Endi S. Dewata
From e731e78e7c02cbf176722c8ba47c36f67dd7e9dd Mon Sep 17 00:00:00 2001
From: Endi Sukma Dewata <edew...@redhat.com>
Date: Fri, 9 Dec 2011 18:12:25 -0600
Subject: [PATCH] Enabled paging on self-service permissions and delegations.

Paging has been enabled on self-service permissions and delegations
list pages. The search facet's get_pkeys() has been fixed to handle
non-array value. New test data files have been added as well.

Ticket #2092
---
 install/ui/aci.js                                 |    2 -
 install/ui/search.js                              |    7 ++-
 install/ui/test/data/delegation_find_pkeys.json   |   14 ++++
 install/ui/test/data/delegation_get_records.json  |   30 +++++++++
 install/ui/test/data/selfservice_find_pkeys.json  |   17 +++++
 install/ui/test/data/selfservice_get_records.json |   69 +++++++++++++++++++++
 6 files changed, 135 insertions(+), 4 deletions(-)
 create mode 100644 install/ui/test/data/delegation_find_pkeys.json
 create mode 100644 install/ui/test/data/delegation_get_records.json
 create mode 100644 install/ui/test/data/selfservice_find_pkeys.json
 create mode 100644 install/ui/test/data/selfservice_get_records.json

diff --git a/install/ui/aci.js b/install/ui/aci.js
index c1f1ce9cc5546ea6d62461b299c1abf0bf0e9920..2e9d02c935ee74a3010964a0870cd7d77647bf37 100644
--- a/install/ui/aci.js
+++ b/install/ui/aci.js
@@ -315,7 +315,6 @@ IPA.aci.selfservice_entity = function(spec) {
         that.entity_init();
 
         that.builder.search_facet({
-            pagination: false,
             columns: [ 'aciname' ]
         }).
         details_facet({
@@ -357,7 +356,6 @@ IPA.aci.delegation_entity = function(spec) {
         that.entity_init();
 
         that.builder.search_facet({
-            pagination: false,
             columns: [ 'aciname' ]
         }).
         details_facet({
diff --git a/install/ui/search.js b/install/ui/search.js
index ffeafd0b2390415c3f5d4d01ee1c1b8d39a38e12..264e8d14d58604085ee0759293e62f8d3b2fdb94 100644
--- a/install/ui/search.js
+++ b/install/ui/search.js
@@ -170,8 +170,11 @@ IPA.search_facet = function(spec) {
         var pkeys = [];
         for (var i=0; i<result.length; i++) {
             var record = result[i];
-            var values = record[pkey_name];
-            pkeys.push(values[0]);
+            var value = record[pkey_name];
+            if (value instanceof Array) {
+                value = value[0];
+            }
+            pkeys.push(value);
         }
         return pkeys;
     };
diff --git a/install/ui/test/data/delegation_find_pkeys.json b/install/ui/test/data/delegation_find_pkeys.json
new file mode 100644
index 0000000000000000000000000000000000000000..502737565d58b1aa6b4e73a1a1f297f5b00370ba
--- /dev/null
+++ b/install/ui/test/data/delegation_find_pkeys.json
@@ -0,0 +1,14 @@
+{
+    "error": null,
+    "id": null,
+    "result": {
+        "count": 1,
+        "result": [
+            {
+                "aciname": "Test Delegation"
+            }
+        ],
+        "summary": "1 delegation matched",
+        "truncated": false
+    }
+}
diff --git a/install/ui/test/data/delegation_get_records.json b/install/ui/test/data/delegation_get_records.json
new file mode 100644
index 0000000000000000000000000000000000000000..3012b04a627184216b5bc52d2bf9adb667a1f986
--- /dev/null
+++ b/install/ui/test/data/delegation_get_records.json
@@ -0,0 +1,30 @@
+{
+    "error": null,
+    "id": null,
+    "result": {
+        "count": 1,
+        "results": [
+            {
+                "error": null,
+                "result": {
+                    "aciname": "Test Delegation",
+                    "attrs": [
+                        "cn",
+                        "displayname",
+                        "givenname",
+                        "initials",
+                        "sn",
+                        "title"
+                    ],
+                    "group": "editors",
+                    "memberof": "ipausers",
+                    "permissions": [
+                        "write"
+                    ]
+                },
+                "summary": null,
+                "value": "Test Delegation"
+            }
+        ]
+    }
+}
diff --git a/install/ui/test/data/selfservice_find_pkeys.json b/install/ui/test/data/selfservice_find_pkeys.json
new file mode 100644
index 0000000000000000000000000000000000000000..0aee1fe478e7e1cef7cf4617b355d0993151512d
--- /dev/null
+++ b/install/ui/test/data/selfservice_find_pkeys.json
@@ -0,0 +1,17 @@
+{
+    "error": null,
+    "id": null,
+    "result": {
+        "count": 2,
+        "result": [
+            {
+                "aciname": "Self can write own password"
+            },
+            {
+                "aciname": "User Self service"
+            }
+        ],
+        "summary": "2 selfservices matched",
+        "truncated": false
+    }
+}
diff --git a/install/ui/test/data/selfservice_get_records.json b/install/ui/test/data/selfservice_get_records.json
new file mode 100644
index 0000000000000000000000000000000000000000..ee0caafd5573c441144313cf62ad72cc6d648f8e
--- /dev/null
+++ b/install/ui/test/data/selfservice_get_records.json
@@ -0,0 +1,69 @@
+{
+    "error": null,
+    "id": null,
+    "result": {
+        "count": 2,
+        "results": [
+            {
+                "error": null,
+                "result": {
+                    "aciname": "Self can write own password",
+                    "attrs": [
+                        "userpassword",
+                        "krbprincipalkey",
+                        "sambalmpassword",
+                        "sambantpassword"
+                    ],
+                    "permissions": [
+                        "write"
+                    ],
+                    "selfaci": true
+                },
+                "summary": null,
+                "value": "Self can write own password"
+            },
+            {
+                "error": null,
+                "result": {
+                    "aciname": "User Self service",
+                    "attrs": [
+                        "givenname",
+                        "sn",
+                        "cn",
+                        "displayname",
+                        "title",
+                        "initials",
+                        "loginshell",
+                        "gecos",
+                        "homephone",
+                        "mobile",
+                        "pager",
+                        "facsimiletelephonenumber",
+                        "telephonenumber",
+                        "street",
+                        "roomnumber",
+                        "l",
+                        "st",
+                        "postalcode",
+                        "manager",
+                        "secretary",
+                        "description",
+                        "carlicense",
+                        "labeleduri",
+                        "inetuserhttpurl",
+                        "seealso",
+                        "employeetype",
+                        "businesscategory",
+                        "ou"
+                    ],
+                    "permissions": [
+                        "write"
+                    ],
+                    "selfaci": true
+                },
+                "summary": null,
+                "value": "User Self service"
+            }
+        ]
+    }
+}
-- 
1.7.5.1

_______________________________________________
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel

Reply via email to