Statistics
| Branch: | Tag: | Revision:

one / src / rm / RequestManagerPoolInfo.cc @ 01d932ad

History | View | Annotate | Download (2.37 KB)

1
/* -------------------------------------------------------------------------- */
2
/* Copyright 2002-2011, OpenNebula Project Leads (OpenNebula.org)             */
3
/*                                                                            */
4
/* Licensed under the Apache License, Version 2.0 (the "License"); you may    */
5
/* not use this file except in compliance with the License. You may obtain    */
6
/* a copy of the License at                                                   */
7
/*                                                                            */
8
/* http://www.apache.org/licenses/LICENSE-2.0                                 */
9
/*                                                                            */
10
/* Unless required by applicable law or agreed to in writing, software        */
11
/* distributed under the License is distributed on an "AS IS" BASIS,          */
12
/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   */
13
/* See the License for the specific language governing permissions and        */
14
/* limitations under the License.                                             */
15
/* -------------------------------------------------------------------------- */
16

    
17
#include "RequestManagerPoolInfo.h"
18

    
19
using namespace std;
20

    
21
/* ------------------------------------------------------------------------- */
22
/* ------------------------------------------------------------------------- */
23

    
24
void RequestManagerPoolInfo::request_execute(
25
    int uid, 
26
    int gid,
27
    xmlrpc_c::paramList const& paramList)
28
{
29
    ostringstream oss;
30
    int rc;
31

    
32
    //Authorize the operation
33
    if ( uid != 0 ) // uid == 0 means oneadmin
34
    {
35
        AuthRequest ar(uid);
36

    
37
        ar.add_auth(auth_object,
38
                    -1,
39
                    AuthRequest::INFO_POOL,
40
                    0,
41
                    false);
42

    
43
        if (UserPool::authorize(ar) == -1)
44
        {
45
            goto error_authorize;
46
        }
47
    }
48

    
49
    // Call the template pool dump
50
    rc = pool->dump(oss,"");
51

    
52
    if ( rc != 0 )
53
    {
54
        goto error_dump;
55
    }
56

    
57
    success_response(oss.str());
58

    
59
    return;
60
//TODO Get the object name from the AuthRequest Class
61
error_authorize:
62
    failure_response(AUTHORIZATION,
63
                     authorization_error("INFO","USER",uid,-1));
64
    return;
65

    
66
error_dump: //TBD Improve Error messages for DUMP
67
    failure_response(INTERNAL,"Internal Error");
68
    return;
69
}
70