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