OmniSciDB  04ee39c94c
Parser::RenameUserStmt Class Reference

#include <ParserNode.h>

+ Inheritance diagram for Parser::RenameUserStmt:
+ Collaboration diagram for Parser::RenameUserStmt:

Public Member Functions

 RenameUserStmt (std::string *username, std::string *new_username)
 
auto const & getOldUserName ()
 
auto const & getNewUserName ()
 
void execute (const Catalog_Namespace::SessionInfo &session) override
 
- Public Member Functions inherited from Parser::DDLStmt
void setColumnDescriptor (ColumnDescriptor &cd, const ColumnDef *coldef)
 
- Public Member Functions inherited from Parser::Node
virtual ~Node ()
 

Private Attributes

std::unique_ptr< std::string > username_
 
std::unique_ptr< std::string > new_username_
 

Detailed Description

Definition at line 1208 of file ParserNode.h.

Constructor & Destructor Documentation

◆ RenameUserStmt()

Parser::RenameUserStmt::RenameUserStmt ( std::string *  username,
std::string *  new_username 
)
inline

Definition at line 1210 of file ParserNode.h.

1211  : username_(username), new_username_(new_username) {}
std::unique_ptr< std::string > username_
Definition: ParserNode.h:1217
std::unique_ptr< std::string > new_username_
Definition: ParserNode.h:1218

Member Function Documentation

◆ execute()

void Parser::RenameUserStmt::execute ( const Catalog_Namespace::SessionInfo session)
overridevirtual

Implements Parser::DDLStmt.

Definition at line 2832 of file ParserNode.cpp.

References Catalog_Namespace::SessionInfo::get_currentUser(), Catalog_Namespace::UserMetadata::isSuper, and anonymous_namespace{DBObjectPrivilegesTest.cpp}::user.

2832  {
2833  if (!session.get_currentUser().isSuper) {
2834  throw std::runtime_error("Only a super user can rename users.");
2835  }
2836 
2838  if (!SysCatalog::instance().getMetadataForUser(*username_, user)) {
2839  throw std::runtime_error("User " + *username_ + " does not exist.");
2840  }
2841 
2842  SysCatalog::instance().renameUser(*username_, *new_username_);
2843 }
std::unique_ptr< std::string > username_
Definition: ParserNode.h:1217
std::unique_ptr< std::string > new_username_
Definition: ParserNode.h:1218
const UserMetadata & get_currentUser() const
Definition: SessionInfo.h:93
+ Here is the call graph for this function:

◆ getNewUserName()

auto const& Parser::RenameUserStmt::getNewUserName ( )
inline

Definition at line 1213 of file ParserNode.h.

References session.

1213 { return new_username_; }
std::unique_ptr< std::string > new_username_
Definition: ParserNode.h:1218

◆ getOldUserName()

auto const& Parser::RenameUserStmt::getOldUserName ( )
inline

Definition at line 1212 of file ParserNode.h.

1212 { return username_; }
std::unique_ptr< std::string > username_
Definition: ParserNode.h:1217

Member Data Documentation

◆ new_username_

std::unique_ptr<std::string> Parser::RenameUserStmt::new_username_
private

Definition at line 1218 of file ParserNode.h.

◆ username_

std::unique_ptr<std::string> Parser::RenameUserStmt::username_
private

Definition at line 1217 of file ParserNode.h.


The documentation for this class was generated from the following files: