@ CommandArgument public void adduser ( @ OptionArgument ( "username" ) String username , @ OptionArgument ( "password" ) String password , @ OptionArgument ( "roles" ) String roles ) { if ( users . containsKey ( username ) ) { System . err . println ( String . format ( "User '%s' already exists" , username ) ) ; } else { User user = new User ( username ) ; user . salt = passwd . generateSalt ( ) ; user . hash = passwd . getEncryptedPassword ( password , user . salt ) ; user . roles . addAll ( Arrays . asList ( roles . split ( "," ) ) ) ; users . put ( username , user ) ; } }
Adds a new user .