[ 
https://issues.apache.org/jira/browse/DIRKRB-321?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14621829#comment-14621829
 ] 

Lin Chen commented on DIRKRB-321:
---------------------------------

The patch looks great!

While I have two minor wonder:
1.
{code}
--- 
a/kerby-backend/ldap-backend/src/main/java/org/apache/kerby/kerberos/kdc/identitybackend/LdapIdentityBackend.java
+++ 
b/kerby-backend/ldap-backend/src/main/java/org/apache/kerby/kerberos/kdc/identitybackend/LdapIdentityBackend.java
@@ -211,7 +211,7 @@ public class LdapIdentityBackend extends 
AbstractIdentityBackend {
         } catch (LdapException e) {
             throw new KrbException("Failed to add identity", e);
         }
-        return identity;
+        return getIdentity(principalName);
     }
 
     /**
@@ -275,7 +275,7 @@ public class LdapIdentityBackend extends 
AbstractIdentityBackend {
             throw new KrbException("Failed to update identity", e);
         }
 
-        return identity;
+        return getIdentity(principalName);
     }
{code}
After adding and updating identity, the patch returns a identity from backend 
by getting. Should other backends like {{JsonBackend}} and {{ZookeeperBackend}} 
be changed, too?
2.
{code}
 /**
@@ -170,7 +172,7 @@ public class Kadmin {
     public void exportKeytab(File keytabFile) throws KrbException {
         Keytab keytab = AdminHelper.createOrLoadKeytab(keytabFile);
 
-        List<String> principals = backend.getIdentities(0, -1);
+        List<String> principals = (List<String>) backend.getIdentities();
       
@@ -243,8 +245,13 @@ public class Kadmin {
     }
 
     public List<String> getPrincipals() throws KrbException {
-        List<String> principalNames = backend.getIdentities(0, -1);
-        return principalNames;
+        Iterable<String> principalNames = backend.getIdentities();
+        List<String> principalList = new LinkedList<>();
+        Iterator<String> iterator = principalNames.iterator();
+        while (iterator.hasNext()) {
+            principalList.add(iterator.next());
+        }
+        return principalList;
     }
{code}

Why sometimes we use cast while sometimes we add principalNames one by one?

> Removing Page and Sort Search in the backend
> --------------------------------------------
>
>                 Key: DIRKRB-321
>                 URL: https://issues.apache.org/jira/browse/DIRKRB-321
>             Project: Directory Kerberos
>          Issue Type: Improvement
>            Reporter: Xu Yaning
>            Assignee: Xu Yaning
>         Attachments: DIRKRB-321-v1.patch
>
>
> Sort and paged search is favored by the kadmin, but it seems doable for us to 
> implement in the initial version. We'll  just use getIdentities() to get all 
> principal names in the first version, and leave the great features like sort, 
> paged and cursor support for the following version.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to