Add features for image members
This commit is contained in:
parent
ae8e5e7d1c
commit
f58a83ffda
1 changed files with 79 additions and 1 deletions
|
@ -34,6 +34,9 @@ class Image {
|
|||
if(isset($opt['name'])){ // string, rendre le nom obligatoire
|
||||
$options['name'] = $opt['name'];
|
||||
}
|
||||
else{
|
||||
//ERROR
|
||||
}
|
||||
if(isset($opt['id'])){ // UUID : nnnnnnnn-nnnn-nnnn-nnnn-nnnnnnnnnnnn
|
||||
$options['id'] = $opt['id'];
|
||||
}
|
||||
|
@ -183,12 +186,87 @@ class Image {
|
|||
*
|
||||
* @param string $id
|
||||
* identifier of the image
|
||||
*/
|
||||
**/
|
||||
public function download_image($id){
|
||||
$service = $this->oidentity;
|
||||
$image = $service->getImage($id);
|
||||
$stream = $image->downloadData();
|
||||
return $stream;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a member to image
|
||||
*
|
||||
* @param string $image_id
|
||||
* identifier of the image
|
||||
*
|
||||
* @param string $member_id
|
||||
* identifier of the member
|
||||
**/
|
||||
public function add_member($image_id, $member_id){
|
||||
$service = $this->oidentity;
|
||||
$member_id = $service>getImage($image_id)->addMember($member_id);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* List members of an image
|
||||
*
|
||||
* @param string $image_id
|
||||
* identifier of the image
|
||||
**/
|
||||
public function list_member($image_id, $member_id){
|
||||
$service = $this->oidentity;
|
||||
$image = $service->getImage($image_id);
|
||||
$members = $image->listMembers();
|
||||
return $members;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show details of a member of an image
|
||||
*
|
||||
* @param string $image_id
|
||||
* identifier of the image
|
||||
*
|
||||
* @param string $member_id
|
||||
* identifier of the member
|
||||
**/
|
||||
public function detail_member($image_id, $member_id){
|
||||
$service = $this->oidentity;
|
||||
$member = $service>getImage($image_id)->getMember($member_id);
|
||||
return $member;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a member of an image
|
||||
*
|
||||
* @param string $image_id
|
||||
* identifier of the image
|
||||
*
|
||||
* @param string $member_id
|
||||
* identifier of the member
|
||||
**/
|
||||
public function remove_member($image_id, $member_id){
|
||||
$service = $this->oidentity;
|
||||
$service>getImage($image_id)->getMember($member_id)->delete();
|
||||
}
|
||||
|
||||
/**
|
||||
* Update a member of an image
|
||||
*
|
||||
* @param string $image_id
|
||||
* identifier of the image
|
||||
*
|
||||
* @param string $member_id
|
||||
* identifier of the member
|
||||
*
|
||||
* @param string $status
|
||||
* new status for the member
|
||||
**/
|
||||
public function update_member($image_id, $member_id, $status){
|
||||
$service = $this->oidentity;
|
||||
$member = $service>getImage($image_id)->getMember($member_id)->updateStatus($status);
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
|
|
Loading…
Add table
Reference in a new issue