mirror of
https://github.com/OpenNebula/one.git
synced 2024-12-25 23:21:29 +03:00
feature #200: Making ImageInfo aware of the Public attribute
This commit is contained in:
parent
125690380a
commit
1a956aa355
@ -98,6 +98,15 @@ public:
|
||||
{
|
||||
return name;
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns Image's name
|
||||
* @return name Image's name
|
||||
*/
|
||||
bool is_public()
|
||||
{
|
||||
return public_img == "YES";
|
||||
};
|
||||
|
||||
/**
|
||||
* Set enum type
|
||||
|
@ -56,10 +56,9 @@ void RequestManager::ImageInfo::execute(
|
||||
// Check if it is a valid user
|
||||
rc = ImageInfo::upool->authenticate(session);
|
||||
|
||||
if ( rc != 0 && rc != uid)
|
||||
if ( rc != 0 && rc != uid && !image->is_public())
|
||||
{
|
||||
goto error_authenticate;
|
||||
// TODO and if it is public!!!
|
||||
goto error_authenticate;
|
||||
}
|
||||
|
||||
oss << *image;
|
||||
@ -83,7 +82,8 @@ error_image_get:
|
||||
goto error_common;
|
||||
|
||||
error_authenticate:
|
||||
oss << "User not authenticated, ImageInfo call aborted.";
|
||||
oss << "User doesn't exist, or not authorized to use image with " <<
|
||||
"ID = " << iid << " , ImageInfo call aborted.";
|
||||
goto error_common;
|
||||
|
||||
error_common:
|
||||
|
Loading…
Reference in New Issue
Block a user