Github user dkuppitz commented on a diff in the pull request:

    https://github.com/apache/tinkerpop/pull/833#discussion_r181460071
  
    --- Diff: 
gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/dsl/credential/CredentialTraversalDsl.java
 ---
    @@ -0,0 +1,63 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements.  See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership.  The ASF licenses this file
    + * to you under the Apache License, Version 2.0 (the
    + * "License"); you may not use this file except in compliance
    + * with the License.  You may obtain a copy of the License at
    + *
    + * http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing,
    + * software distributed under the License is distributed on an
    + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    + * KIND, either express or implied.  See the License for the
    + * specific language governing permissions and limitations
    + * under the License.
    + */
    +package org.apache.tinkerpop.gremlin.groovy.jsr223.dsl.credential;
    +
    +import org.apache.tinkerpop.gremlin.process.traversal.dsl.GremlinDsl;
    +import 
org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
    +import org.apache.tinkerpop.gremlin.structure.Vertex;
    +import org.mindrot.jbcrypt.BCrypt;
    +
    +import static 
org.apache.tinkerpop.gremlin.groovy.jsr223.dsl.credential.CredentialGraphTokens.PROPERTY_PASSWORD;
    +import static 
org.apache.tinkerpop.gremlin.groovy.jsr223.dsl.credential.CredentialGraphTokens.PROPERTY_USERNAME;
    +import static 
org.apache.tinkerpop.gremlin.groovy.jsr223.dsl.credential.CredentialGraphTokens.VERTEX_LABEL_USER;
    +
    +/**
    + * A DSL for managing a "credentials graph" used by Gremlin Server for 
simple authentication functions.
    + *
    + * @author Stephen Mallette (http://stephen.genoprime.com)
    + */
    +@GremlinDsl(traversalSource = 
"org.apache.tinkerpop.gremlin.groovy.jsr223.dsl.credential.CredentialTraversalSourceDsl")
    +public interface CredentialTraversalDsl<S,E> extends 
GraphTraversal.Admin<S,E> {
    +    static final int BCRYPT_ROUNDS = 4;
    +
    +    /**
    +     * Finds all users.
    +     */
    +    public default GraphTraversal<S, Vertex> users() {
    +        return (CredentialTraversal<S, Vertex>) 
hasLabel(VERTEX_LABEL_USER);
    +    }
    +
    +    /**
    +     * Finds users by name.
    +     */
    +    public default GraphTraversal<S, Vertex> users(final String username) {
    --- End diff --
    
    Since this method is called `users` and not `user`, it should look more 
like this:
    ```java
        public GraphTraversal<Vertex, Vertex> users(final String username, 
final String... more) {
            if (more.length == 0) {
                return this.clone().V().has(VERTEX_LABEL_USER, 
PROPERTY_USERNAME, username);
            }
            final int lastIndex;
            final String[] usernames = Arrays.copyOf(more, (lastIndex = 
more.length) + 1);
            usernames[lastIndex] = username;
            return this.clone().V().has(VERTEX_LABEL_USER, PROPERTY_USERNAME, 
P.within(usernames));
        }
    ```
    Likewise in `CredentialTraversalSourceDsl`.


---

Reply via email to