2012-01-04 23:14:09 +04:00
/* -------------------------------------------------------------------------- */
2018-01-02 20:27:37 +03:00
/* Copyright 2002-2018, OpenNebula Project, OpenNebula Systems */
2012-01-04 23:14:09 +04:00
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */
/* a copy of the License at */
/* */
/* http://www.apache.org/licenses/LICENSE-2.0 */
/* */
/* Unless required by applicable law or agreed to in writing, software */
/* distributed under the License is distributed on an "AS IS" BASIS, */
/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
/* See the License for the specific language governing permissions and */
/* limitations under the License. */
/* -------------------------------------------------------------------------- */
# ifndef REQUEST_MANAGER_CHMOD_H_
# define REQUEST_MANAGER_CHMOD_H_
# include "Request.h"
# include "Nebula.h"
using namespace std ;
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
class RequestManagerChmod : public Request
{
protected :
2016-04-21 17:08:28 +03:00
RequestManagerChmod ( const string & method_name , const string & help ,
const string & params = " A:siiiiiiiiii " ) :
Request ( method_name , params , help ) { } ;
2016-02-08 18:40:38 +03:00
2012-01-04 23:14:09 +04:00
~ RequestManagerChmod ( ) { } ;
/* -------------------------------------------------------------------- */
2016-04-21 17:08:28 +03:00
void request_execute ( xmlrpc_c : : paramList const & _paramList ,
RequestAttributes & att ) ;
virtual ErrorCode chmod ( PoolSQL * pool , int oid , int owner_u , int owner_m ,
int owner_a , int group_u , int group_m , int group_a , int other_u ,
int other_m , int other_a , bool recursive , RequestAttributes & att ) ;
2012-01-04 23:14:09 +04:00
} ;
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
class VirtualMachineChmod : public RequestManagerChmod
{
public :
VirtualMachineChmod ( ) :
2017-05-07 22:52:34 +03:00
RequestManagerChmod ( " one.vm.chmod " ,
2012-01-18 21:13:19 +04:00
" Changes permission bits of a virtual machine " )
2015-07-01 22:15:40 +03:00
{
2012-01-04 23:14:09 +04:00
Nebula & nd = Nebula : : instance ( ) ;
pool = nd . get_vmpool ( ) ;
auth_object = PoolObjectSQL : : VM ;
} ;
~ VirtualMachineChmod ( ) { } ;
} ;
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
class TemplateChmod : public RequestManagerChmod
{
public :
2012-06-08 13:43:55 +04:00
TemplateChmod ( ) :
2017-05-07 22:52:34 +03:00
RequestManagerChmod ( " one.template.chmod " , " Changes permission bits of a "
2016-04-21 17:08:28 +03:00
" virtual machine template " , " A:siiiiiiiiiib " )
2015-07-01 22:15:40 +03:00
{
2012-01-04 23:14:09 +04:00
Nebula & nd = Nebula : : instance ( ) ;
pool = nd . get_tpool ( ) ;
auth_object = PoolObjectSQL : : TEMPLATE ;
} ;
~ TemplateChmod ( ) { } ;
2016-02-08 18:40:38 +03:00
2016-04-21 17:08:28 +03:00
ErrorCode request_execute ( PoolSQL * pool , int oid , int owner_u , int owner_m ,
int owner_a , int group_u , int group_m , int group_a , int other_u ,
int other_m , int other_a , bool recursive , RequestAttributes & att )
{
return chmod ( pool , oid , owner_u , owner_m , owner_a , group_u , group_m ,
group_a , other_u , other_m , other_a , recursive , att ) ;
}
protected :
ErrorCode chmod ( PoolSQL * pool , int oid , int owner_u , int owner_m ,
int owner_a , int group_u , int group_m , int group_a , int other_u ,
int other_m , int other_a , bool recursive , RequestAttributes & att ) ;
2012-01-04 23:14:09 +04:00
} ;
2016-04-21 17:08:28 +03:00
/* ------------------------------------------------------------- */
2012-01-04 23:14:09 +04:00
/* ------------------------------------------------------------------------- */
class VirtualNetworkChmod : public RequestManagerChmod
{
public :
VirtualNetworkChmod ( ) :
2017-05-07 22:52:34 +03:00
RequestManagerChmod ( " one.vn.chmod " ,
2012-01-18 21:13:19 +04:00
" Changes permission bits of a virtual network " )
2015-07-01 22:15:40 +03:00
{
2012-01-04 23:14:09 +04:00
Nebula & nd = Nebula : : instance ( ) ;
pool = nd . get_vnpool ( ) ;
auth_object = PoolObjectSQL : : NET ;
} ;
~ VirtualNetworkChmod ( ) { } ;
} ;
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
class ImageChmod : public RequestManagerChmod
{
public :
ImageChmod ( ) :
2017-05-07 22:52:34 +03:00
RequestManagerChmod ( " one.image.chmod " ,
2012-01-18 21:13:19 +04:00
" Changes permission bits of an image " )
2015-07-01 22:15:40 +03:00
{
2012-01-04 23:14:09 +04:00
Nebula & nd = Nebula : : instance ( ) ;
pool = nd . get_ipool ( ) ;
auth_object = PoolObjectSQL : : IMAGE ;
} ;
~ ImageChmod ( ) { } ;
2016-04-21 17:08:28 +03:00
ErrorCode request_execute ( PoolSQL * pool , int oid , int owner_u , int owner_m ,
int owner_a , int group_u , int group_m , int group_a , int other_u ,
int other_m , int other_a , RequestAttributes & att )
{
return chmod ( pool , oid , owner_u , owner_m , owner_a , group_u , group_m ,
group_a , other_u , other_m , other_a , false , att ) ;
}
2012-01-04 23:14:09 +04:00
} ;
2012-03-02 19:11:50 +04:00
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
class DatastoreChmod : public RequestManagerChmod
{
public :
DatastoreChmod ( ) :
2017-05-07 22:52:34 +03:00
RequestManagerChmod ( " one.datastore.chmod " ,
2012-03-02 19:11:50 +04:00
" Changes permission bits of a datastore " )
{
Nebula & nd = Nebula : : instance ( ) ;
pool = nd . get_dspool ( ) ;
auth_object = PoolObjectSQL : : DATASTORE ;
} ;
~ DatastoreChmod ( ) { } ;
} ;
2012-06-08 18:00:16 +04:00
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
class DocumentChmod : public RequestManagerChmod
{
public :
DocumentChmod ( ) :
2017-05-07 22:52:34 +03:00
RequestManagerChmod ( " one.document.chmod " ,
2012-06-13 14:44:04 +04:00
" Changes permission bits of a generic document " )
2012-06-08 18:00:16 +04:00
{
Nebula & nd = Nebula : : instance ( ) ;
pool = nd . get_docpool ( ) ;
auth_object = PoolObjectSQL : : DOCUMENT ;
} ;
~ DocumentChmod ( ) { } ;
} ;
2012-06-13 14:44:04 +04:00
2014-09-08 13:50:25 +04:00
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
class SecurityGroupChmod : public RequestManagerChmod
{
public :
SecurityGroupChmod ( ) :
2017-05-07 22:52:34 +03:00
RequestManagerChmod ( " one.secgroup.chmod " ,
2014-09-08 13:50:25 +04:00
" Changes permission bits of a security group " )
{
Nebula & nd = Nebula : : instance ( ) ;
pool = nd . get_secgrouppool ( ) ;
auth_object = PoolObjectSQL : : SECGROUP ;
} ;
~ SecurityGroupChmod ( ) { } ;
} ;
2015-11-30 18:50:23 +03:00
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
class VirtualRouterChmod : public RequestManagerChmod
{
public :
VirtualRouterChmod ( ) :
2017-05-07 22:52:34 +03:00
RequestManagerChmod ( " one.vrouter.chmod " ,
2015-11-30 18:50:23 +03:00
" Changes permission bits of a virtual router " )
{
Nebula & nd = Nebula : : instance ( ) ;
2018-09-10 19:06:51 +03:00
vrpool = nd . get_vrouterpool ( ) ;
pool = nd . get_vmpool ( ) ;
2015-11-30 18:50:23 +03:00
auth_object = PoolObjectSQL : : VROUTER ;
} ;
~ VirtualRouterChmod ( ) { } ;
2018-09-10 19:06:51 +03:00
virtual void request_execute ( xmlrpc_c : : paramList const & _paramList ,
RequestAttributes & att ) ;
private :
VirtualRouterPool * vrpool ;
2015-11-30 18:50:23 +03:00
} ;
2015-12-06 01:52:28 +03:00
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
class MarketPlaceChmod : public RequestManagerChmod
{
public :
MarketPlaceChmod ( ) :
2017-05-07 22:52:34 +03:00
RequestManagerChmod ( " one.market.chmod " ,
2015-12-06 01:52:28 +03:00
" Changes permission bits of a marketplace " )
{
Nebula & nd = Nebula : : instance ( ) ;
2015-12-11 17:53:19 +03:00
pool = nd . get_marketpool ( ) ;
2015-12-06 01:52:28 +03:00
auth_object = PoolObjectSQL : : MARKETPLACE ;
} ;
~ MarketPlaceChmod ( ) { } ;
} ;
2015-12-11 17:53:19 +03:00
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
class MarketPlaceAppChmod : public RequestManagerChmod
{
public :
MarketPlaceAppChmod ( ) :
2017-05-07 22:52:34 +03:00
RequestManagerChmod ( " one.marketapp.chmod " ,
2015-12-11 17:53:19 +03:00
" Changes permission bits of a marketplace app " )
{
Nebula & nd = Nebula : : instance ( ) ;
pool = nd . get_apppool ( ) ;
auth_object = PoolObjectSQL : : MARKETPLACEAPP ;
} ;
~ MarketPlaceAppChmod ( ) { } ;
} ;
2012-01-04 23:14:09 +04:00
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
2017-01-03 23:12:27 +03:00
class VMGroupChmod : public RequestManagerChmod
{
public :
VMGroupChmod ( ) :
2017-05-07 22:52:34 +03:00
RequestManagerChmod ( " one.vmgroup.chmod " ,
2017-01-03 23:12:27 +03:00
" Changes permission bits of a vm group " )
{
Nebula & nd = Nebula : : instance ( ) ;
pool = nd . get_vmgrouppool ( ) ;
auth_object = PoolObjectSQL : : VMGROUP ;
} ;
~ VMGroupChmod ( ) { } ;
} ;
2012-01-04 23:14:09 +04:00
# endif