Revision fa96d8a7

View differences:

src/cli/oneuser
103 103
* list (Lists all the users in the pool)
104 104
    oneuser list
105 105

  
106
* passwd (Changes the given user's password)
107
    oneuser passwd <id> password
108

  
106 109
EOT
107 110

  
108 111
    def text_commands
......
181 184
            puts "User deleted" if ops[:verbose]
182 185
        end
183 186
    end
184
    
187

  
188
when "passwd"
189
    check_parameters("passwd", 2)
190

  
191
    user_id=get_user_id(ARGV[0])
192

  
193
    user=OpenNebula::User.new_with_id(user_id, get_one_client)
194

  
195
    sha_password = Digest::SHA1.hexdigest(ARGV[1])
196
    result=user.passwd(sha_password)
197

  
198
    if !OpenNebula.is_error?(result)
199
        puts "Password changed" if ops[:verbose]
200
    else
201
        puts
202
    end
203

  
185 204
when "list"
186 205
    if !ops[:xml]
187 206
        uplist=UPShow.new
src/oca/ruby/OpenNebula/User.rb
8 8
        USER_METHODS = {
9 9
            :info     => "user.info",
10 10
            :allocate => "user.allocate",
11
            :delete   => "user.delete"
11
            :delete   => "user.delete",
12
            :passwd   => "user.passwd"
12 13
        }
13 14

  
14 15
        # Creates a User description with just its identifier
......
51 52
        def delete()
52 53
            super(USER_METHODS[:delete])
53 54
        end
55

  
56
        def passwd(password)
57
            return Error.new('ID not defined') if !@pe_id
58

  
59
            rc = @client.call(USER_METHODS[:passwd], @pe_id, password)
60
            rc = nil if !OpenNebula.is_error?(rc)
61

  
62
            return rc
63
        end
64

  
54 65
    end
55 66
end

Also available in: Unified diff