2012-06-08 22:14:40 +02:00
/* -------------------------------------------------------------------------- */
2021-02-09 16:07:56 +01:00
/* Copyright 2002-2021, OpenNebula Project, OpenNebula Systems */
2012-06-08 22:14:40 +02: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_GROUP_H
# define REQUEST_MANAGER_GROUP_H
# include "Request.h"
# include "Nebula.h"
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
class RequestManagerGroup : public Request
{
protected :
2020-07-02 22:42:10 +02:00
RequestManagerGroup ( const std : : string & method_name ,
const std : : string & help ,
const std : : string & params )
2012-06-08 22:14:40 +02:00
: Request ( method_name , params , help )
{
Nebula & nd = Nebula : : instance ( ) ;
pool = nd . get_gpool ( ) ;
auth_object = PoolObjectSQL : : GROUP ;
} ;
2019-07-05 17:23:21 +02:00
~ RequestManagerGroup ( ) { } ;
2012-06-08 22:14:40 +02:00
virtual void request_execute ( xmlrpc_c : : paramList const & _paramList ,
RequestAttributes & att ) = 0 ;
} ;
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
class GroupSetQuota : public RequestManagerGroup
{
public :
GroupSetQuota ( ) :
2017-05-07 21:52:34 +02:00
RequestManagerGroup ( " one.group.quota " ,
2012-06-08 22:14:40 +02:00
" Sets group quota limits " ,
" A:sis " )
{
auth_op = AuthRequest : : ADMIN ;
} ;
~ GroupSetQuota ( ) { } ;
void request_execute ( xmlrpc_c : : paramList const & _paramList ,
2019-07-05 17:23:21 +02:00
RequestAttributes & att ) override ;
2012-06-08 22:14:40 +02:00
} ;
2015-02-02 15:38:42 +01:00
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
class GroupEditAdmin : public Request
{
public :
void request_execute ( xmlrpc_c : : paramList const & _paramList ,
2019-07-05 17:23:21 +02:00
RequestAttributes & att ) override ;
2015-02-02 15:38:42 +01:00
protected :
2020-07-02 22:42:10 +02:00
GroupEditAdmin ( const std : : string & method_name ,
const std : : string & help ,
const std : : string & params )
2015-02-02 15:38:42 +01:00
: Request ( method_name , params , help )
{
Nebula & nd = Nebula : : instance ( ) ;
pool = nd . get_gpool ( ) ;
upool = nd . get_upool ( ) ;
auth_object = PoolObjectSQL : : GROUP ;
auth_op = AuthRequest : : ADMIN ;
} ;
UserPool * upool ;
2020-07-02 22:42:10 +02:00
virtual int edit_admin ( Group * group , int user_id , std : : string & error_msg ) = 0 ;
2015-02-02 15:38:42 +01:00
} ;
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
class GroupAddAdmin : public GroupEditAdmin
{
public :
GroupAddAdmin ( ) :
2017-05-07 21:52:34 +02:00
GroupEditAdmin ( " one.group.addadmin " ,
2015-02-02 15:38:42 +01:00
" Adds a user to the group admin set " ,
" A:sii " ) { } ;
~ GroupAddAdmin ( ) { } ;
2020-07-02 22:42:10 +02:00
int edit_admin ( Group * group , int user_id , std : : string & error_msg ) override ;
2015-02-02 15:38:42 +01:00
} ;
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
class GroupDelAdmin : public GroupEditAdmin
{
public :
GroupDelAdmin ( ) :
2017-05-07 21:52:34 +02:00
GroupEditAdmin ( " one.group.deladmin " ,
2015-02-02 15:38:42 +01:00
" Removes a user from the group admin set " ,
" A:sii " ) { } ;
~ GroupDelAdmin ( ) { } ;
2020-07-02 22:42:10 +02:00
int edit_admin ( Group * group , int user_id , std : : string & error_msg ) override ;
2015-02-02 15:38:42 +01:00
} ;
2012-06-08 22:14:40 +02:00
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
# endif