Search in sources :

Example 1 with KeystoneCliContext

use of org.platformlayer.keystone.cli.KeystoneCliContext in project platformlayer by platformlayer.

the class ProjectNameAutoCompleter method doComplete.

@Override
public List<String> doComplete(CliContext context, String prefix) throws Exception {
    if (prefix.length() <= 2) {
        // Let's avoid returning thousands of projects
        return null;
    }
    KeystoneCliContext keystoneContext = (KeystoneCliContext) context;
    UserDatabase userRepository = keystoneContext.getUserRepository();
    List<String> userIds = userRepository.listAllProjectNames(prefix);
    addSuffix(userIds, " ");
    return userIds;
}
Also used : KeystoneCliContext(org.platformlayer.keystone.cli.KeystoneCliContext) UserDatabase(org.platformlayer.auth.UserDatabase)

Example 2 with KeystoneCliContext

use of org.platformlayer.keystone.cli.KeystoneCliContext in project platformlayer by platformlayer.

the class UserNameAutoCompleter method doComplete.

@Override
public List<String> doComplete(CliContext context, String prefix) throws Exception {
    if (prefix.length() < 3) {
        // Let's avoid returning thousands of users
        return null;
    }
    KeystoneCliContext keystoneContext = (KeystoneCliContext) context;
    UserDatabase userRepository = keystoneContext.getUserRepository();
    List<String> userIds = userRepository.listAllUserNames(prefix);
    addSuffix(userIds, " ");
    return userIds;
}
Also used : KeystoneCliContext(org.platformlayer.keystone.cli.KeystoneCliContext) UserDatabase(org.platformlayer.auth.UserDatabase)

Aggregations

UserDatabase (org.platformlayer.auth.UserDatabase)2 KeystoneCliContext (org.platformlayer.keystone.cli.KeystoneCliContext)2