22 #include <boost/algorithm/string.hpp>
23 #include <boost/make_unique.hpp>
26 #include <unordered_set>
33 using DBObjectMap = std::map<DBObjectKey, std::unique_ptr<DBObject>>;
38 virtual bool isUser()
const = 0;
54 std::vector<std::string>
getRoles(
bool only_direct =
true)
const;
78 bool isUser()
const override {
return true; }
86 bool isUser()
const override {
return false; }
DBObjectMap effectivePrivileges_
bool isUser() const override
User(const std::string &name)
bool hasAnyPrivilegesOnDb(int32_t dbId, bool only_direct) const
void revokeAllOnDatabase(int32_t dbId) override
void renameDbObject(const DBObject &object) override
virtual void updatePrivileges()
void reassignObjectOwner(DBObjectKey &object_key, int32_t new_owner_id)
virtual void grantPrivileges(const DBObject &object)
virtual DBObject * revokePrivileges(const DBObject &object)
virtual void addGrantee(Grantee *grantee)
const std::string & getName() const
DBObject * findDbObject(const DBObjectKey &objectKey, bool only_direct) const
void updatePrivileges() override
virtual bool hasAnyPrivileges(const DBObject &objectRequested, bool only_direct) const
virtual void revokeAllOnDatabase(int32_t dbId)
Grantee(const std::string &name)
Class specification and related data structures for DBObject class.
virtual void revokeRole(Role *role)
std::vector< Grantee * > getGrantees() const
std::map< DBObjectKey, std::unique_ptr< DBObject >> DBObjectMap
const DBObjectMap * getDbObjects(bool only_direct) const
virtual bool isUser() const =0
virtual void removeGrantee(Grantee *grantee)
std::unordered_set< Role * > roles_
void checkCycles(Role *newRole)
bool isUser() const override
Role(const std::string &name)
void setName(const std::string &name)
virtual void grantRole(Role *role)
bool hasRole(Role *role, bool only_direct) const
void reassignObjectOwners(const std::set< int32_t > &old_owner_ids, int32_t new_owner_id, int32_t db_id)
std::unordered_set< Grantee * > grantees_
DBObjectMap directPrivileges_
std::vector< std::string > getRoles(bool only_direct=true) const
void getPrivileges(DBObject &object, bool only_direct)
virtual void renameDbObject(const DBObject &object)
virtual bool checkPrivileges(const DBObject &objectRequested) const