Revision 0659115f src/rm/RequestManagerImageInfo.cc

View differences:

src/rm/RequestManagerImageInfo.cc
28 28
{
29 29
    string  session;
30 30

  
31
    int     iid;
32
    int     uid;     // Image owner user id
33
    int     rc;      // Requesting user id 
34
    Image * image;
35

  
31
    int           iid;
32
    int           uid;     // Image owner user id
33
    int           rc;      // Requesting user id 
34
    Image *       image;
35
                  
36 36
    ostringstream oss;
37 37
    
38
    const string        method_name = "ImageInfo";
38
    const string  method_name = "ImageInfo";
39 39

  
40 40
    /*   -- RPC specific vars --  */
41 41
    vector<xmlrpc_c::value> arrayData;
......
65 65
        goto error_authenticate;
66 66
    }
67 67
    
68
    //Authorize the operation
69
    if ( rc != 0 ) // rc == 0 means oneadmin
70
    {
71
        AuthRequest ar(rc);
72

  
73
        ar.add_auth(AuthRequest::IMAGE,
74
                    iid,
75
                    AuthRequest::USE,
76
                    0,
77
                    image->isPublic());
78

  
79
        if (UserPool::authorize(ar) == -1)
80
        {
81
            goto error_authorize;
82
        }
83
    }
84

  
85 68
    oss << *image;
86 69

  
87 70
    image->unlock();
......
107 90
    image->unlock();
108 91
    goto error_common;
109 92

  
110
error_authorize:
111
    oss.str(authorization_error(method_name, "USE", "IMAGE", rc, iid));
112
    image->unlock();
113
    goto error_common;
114

  
115 93
error_common:
116 94
    arrayData.push_back(xmlrpc_c::value_boolean(false)); // FAILURE
117 95
    arrayData.push_back(xmlrpc_c::value_string(oss.str()));

Also available in: Unified diff