Revision 0a132883 src/rm/RequestManagerAllocate.cc

View differences:

src/rm/RequestManagerAllocate.cc
96 96
/* -------------------------------------------------------------------------- */
97 97
/* -------------------------------------------------------------------------- */
98 98

  
99
bool VirtualMachineAllocate::allocate_authorization(Template * tmpl)
100
{
101
    if ( uid == 0 )
102
    {
103
        return true;
104
    }
105

  
106
    AuthRequest ar(uid);
107
    string      t64;
108

  
109
    VirtualMachineTemplate * ttmpl = static_cast<VirtualMachineTemplate *>(tmpl);
110

  
111
    ar.add_auth(auth_object,tmpl->to_xml(t64),auth_op,uid,false);
112

  
113
    VirtualMachine::set_auth_request(uid, ar, ttmpl);
114

  
115
   if (UserPool::authorize(ar) == -1)
116
   {
117
        failure_response(AUTHORIZATION, //TODO
118
                 authorization_error("INFO","USER",uid,-1));
119

  
120
        return false;
121
    }
122

  
123
    return true;
124
}
125

  
126
/* -------------------------------------------------------------------------- */
127
/* -------------------------------------------------------------------------- */
128

  
99 129
void RequestManagerAllocate::request_execute(xmlrpc_c::paramList const& params)
100 130
{
101 131
    Template * tmpl = 0;
......
140 170
/* -------------------------------------------------------------------------- */
141 171
/* -------------------------------------------------------------------------- */
142 172

  
173
int VirtualMachineAllocate::pool_allocate(xmlrpc_c::paramList const& paramList, 
174
                                          Template * tmpl,
175
                                          int& id, 
176
                                          string& error_str)
177
{
178
    VirtualMachineTemplate * ttmpl = static_cast<VirtualMachineTemplate *>(tmpl);
179
    VirtualMachinePool * vmpool    = static_cast<VirtualMachinePool *>(pool);
180

  
181
    return vmpool->allocate(uid, gid, ttmpl, &id, error_str, false);
182
}
183

  
184

  
185
/* -------------------------------------------------------------------------- */
186
/* -------------------------------------------------------------------------- */
187

  
143 188
int VirtualNetworkAllocate::pool_allocate(xmlrpc_c::paramList const& _paramList, 
144 189
                                          Template * tmpl,
145 190
                                          int& id, 

Also available in: Unified diff