diff --git a/catalogue/Catalogue.hpp b/catalogue/Catalogue.hpp index 3ae18222a85d33987d83e7a32ff21a5804df562e..f2d354f9bad9f47a5173e3c740e3636b3b347954 100644 --- a/catalogue/Catalogue.hpp +++ b/catalogue/Catalogue.hpp @@ -78,12 +78,12 @@ public: */ virtual ~Catalogue() = 0; - virtual void createBootstrapAdminAndHostNoAuth(const common::dataStructures::SecurityIdentity &cliIdentity, const common::dataStructures::UserIdentity &user, const std::string &hostName, const std::string &comment) = 0; + virtual void createBootstrapAdminAndHostNoAuth(const common::dataStructures::SecurityIdentity &cliIdentity, const std::string &username, const std::string &hostName, const std::string &comment) = 0; - virtual void createAdminUser(const common::dataStructures::SecurityIdentity &cliIdentity, const common::dataStructures::UserIdentity &user, const std::string &comment) = 0; - virtual void deleteAdminUser(const common::dataStructures::UserIdentity &user) = 0; + virtual void createAdminUser(const common::dataStructures::SecurityIdentity &cliIdentity, const std::string &username, const std::string &comment) = 0; + virtual void deleteAdminUser(const std::string &username) = 0; virtual std::list<common::dataStructures::AdminUser> getAdminUsers() const = 0; - virtual void modifyAdminUserComment(const common::dataStructures::SecurityIdentity &cliIdentity, const common::dataStructures::UserIdentity &user, const std::string &comment) = 0; + virtual void modifyAdminUserComment(const common::dataStructures::SecurityIdentity &cliIdentity, const std::string &username, const std::string &comment) = 0; virtual void createAdminHost(const common::dataStructures::SecurityIdentity &cliIdentity, const std::string &hostName, const std::string &comment) = 0; virtual void deleteAdminHost(const std::string &hostName) = 0; diff --git a/catalogue/CatalogueFactoryTest.cpp b/catalogue/CatalogueFactoryTest.cpp index 89898e163953bbd16eed30e7ff88855da199b9c6..238d4dca8438712fdeab3c54753be29a09779353 100644 --- a/catalogue/CatalogueFactoryTest.cpp +++ b/catalogue/CatalogueFactoryTest.cpp @@ -30,19 +30,13 @@ public: cta_catalogue_CatalogueFactoryTest(): m_bootstrapComment("bootstrap") { - m_cliUI.group = "cli_group_name"; - m_cliUI.name = "cli_user_name"; - m_cliSI.user = m_cliUI; + m_cliSI.username = "cli_user_name"; m_cliSI.host = "cli_host"; - m_bootstrapAdminUI.group = "bootstrap_admin_group_name"; - m_bootstrapAdminUI.name = "bootstrap_admin_user_name"; - m_bootstrapAdminSI.user = m_bootstrapAdminUI; + m_bootstrapAdminSI.username = "bootstrap_admin_user_name"; m_bootstrapAdminSI.host = "bootstrap_host"; - m_adminUI.group = "admin_group_name"; - m_adminUI.name = "admin_user_name"; - m_adminSI.user = m_adminUI; + m_adminSI.username = "admin_user_name"; m_adminSI.host = "admin_host"; } @@ -55,11 +49,8 @@ protected: } const std::string m_bootstrapComment; - cta::common::dataStructures::UserIdentity m_cliUI; cta::common::dataStructures::SecurityIdentity m_cliSI; - cta::common::dataStructures::UserIdentity m_bootstrapAdminUI; cta::common::dataStructures::SecurityIdentity m_bootstrapAdminSI; - cta::common::dataStructures::UserIdentity m_adminUI; cta::common::dataStructures::SecurityIdentity m_adminSI; }; @@ -75,7 +66,7 @@ TEST_F(cta_catalogue_CatalogueFactoryTest, instance_in_memory) { ASSERT_TRUE(catalogue->getAdminHosts().empty()); catalogue->createBootstrapAdminAndHostNoAuth( - m_cliSI, m_bootstrapAdminUI, m_bootstrapAdminSI.host, m_bootstrapComment); + m_cliSI, m_bootstrapAdminSI.username, m_bootstrapAdminSI.host, m_bootstrapComment); { std::list<common::dataStructures::AdminUser> admins; @@ -86,7 +77,7 @@ TEST_F(cta_catalogue_CatalogueFactoryTest, instance_in_memory) { ASSERT_EQ(m_bootstrapComment, admin.comment); const common::dataStructures::EntryLog creationLog = admin.creationLog; - ASSERT_EQ(m_cliSI.user.name, creationLog.user.name); + ASSERT_EQ(m_cliSI.username, creationLog.username); ASSERT_EQ(m_cliSI.host, creationLog.host); const common::dataStructures::EntryLog lastModificationLog = @@ -103,7 +94,7 @@ TEST_F(cta_catalogue_CatalogueFactoryTest, instance_in_memory) { ASSERT_EQ(m_bootstrapComment, host.comment); const common::dataStructures::EntryLog creationLog = host.creationLog; - ASSERT_EQ(m_cliSI.user.name, creationLog.user.name); + ASSERT_EQ(m_cliSI.username, creationLog.username); ASSERT_EQ(m_cliSI.host, creationLog.host); const common::dataStructures::EntryLog lastModificationLog = diff --git a/catalogue/InMemoryCatalogueTest.cpp b/catalogue/InMemoryCatalogueTest.cpp index 8d79d92add7062923910d4ee1227e9f8cd142c52..a4831a591bedd18cb527af6f31596c77f06ba058 100644 --- a/catalogue/InMemoryCatalogueTest.cpp +++ b/catalogue/InMemoryCatalogueTest.cpp @@ -55,19 +55,13 @@ public: cta_catalogue_InMemoryCatalogueTest(): m_bootstrapComment("bootstrap") { - m_cliUI.group = "cli_group_name"; - m_cliUI.name = "cli_user_name"; - m_cliSI.user = m_cliUI; + m_cliSI.username = "cli_user_name"; m_cliSI.host = "cli_host"; - m_bootstrapAdminUI.group = "bootstrap_admin_group_name"; - m_bootstrapAdminUI.name = "bootstrap_admin_user_name"; - m_bootstrapAdminSI.user = m_bootstrapAdminUI; + m_bootstrapAdminSI.username = "bootstrap_admin_user_name"; m_bootstrapAdminSI.host = "bootstrap_host"; - m_adminUI.group = "admin_group_name"; - m_adminUI.name = "admin_user_name"; - m_adminSI.user = m_adminUI; + m_adminSI.username = "admin_user_name"; m_adminSI.host = "admin_host"; } @@ -86,11 +80,8 @@ protected: std::unique_ptr<cta::catalogue::RdbmsCatalogue> m_catalogue; const std::string m_bootstrapComment; - cta::common::dataStructures::UserIdentity m_cliUI; cta::common::dataStructures::SecurityIdentity m_cliSI; - cta::common::dataStructures::UserIdentity m_bootstrapAdminUI; cta::common::dataStructures::SecurityIdentity m_bootstrapAdminSI; - cta::common::dataStructures::UserIdentity m_adminUI; cta::common::dataStructures::SecurityIdentity m_adminSI; }; @@ -101,7 +92,7 @@ TEST_F(cta_catalogue_InMemoryCatalogueTest, createBootstrapAdminAndHostNoAuth) { ASSERT_TRUE(m_catalogue->getAdminHosts().empty()); m_catalogue->createBootstrapAdminAndHostNoAuth( - m_cliSI, m_bootstrapAdminUI, m_bootstrapAdminSI.host, m_bootstrapComment); + m_cliSI, m_bootstrapAdminSI.username, m_bootstrapAdminSI.host, m_bootstrapComment); { std::list<common::dataStructures::AdminUser> admins; @@ -112,7 +103,7 @@ TEST_F(cta_catalogue_InMemoryCatalogueTest, createBootstrapAdminAndHostNoAuth) { ASSERT_EQ(m_bootstrapComment, admin.comment); const common::dataStructures::EntryLog creationLog = admin.creationLog; - ASSERT_EQ(m_cliSI.user.name, creationLog.user.name); + ASSERT_EQ(m_cliSI.username, creationLog.username); ASSERT_EQ(m_cliSI.host, creationLog.host); const common::dataStructures::EntryLog lastModificationLog = @@ -129,7 +120,7 @@ TEST_F(cta_catalogue_InMemoryCatalogueTest, createBootstrapAdminAndHostNoAuth) { ASSERT_EQ(m_bootstrapComment, host.comment); const common::dataStructures::EntryLog creationLog = host.creationLog; - ASSERT_EQ(m_cliSI.user.name, creationLog.user.name); + ASSERT_EQ(m_cliSI.username, creationLog.username); ASSERT_EQ(m_cliSI.host, creationLog.host); const common::dataStructures::EntryLog lastModificationLog = @@ -144,7 +135,7 @@ TEST_F(cta_catalogue_InMemoryCatalogueTest, createAdminUser) { ASSERT_TRUE(m_catalogue->getAdminUsers().empty()); m_catalogue->createBootstrapAdminAndHostNoAuth( - m_cliSI, m_bootstrapAdminUI, m_bootstrapAdminSI.host, m_bootstrapComment); + m_cliSI, m_bootstrapAdminSI.username, m_bootstrapAdminSI.host, m_bootstrapComment); { std::list<common::dataStructures::AdminUser> admins; @@ -155,7 +146,7 @@ TEST_F(cta_catalogue_InMemoryCatalogueTest, createAdminUser) { ASSERT_EQ(m_bootstrapComment, admin.comment); const common::dataStructures::EntryLog creationLog = admin.creationLog; - ASSERT_EQ(m_cliSI.user.name, creationLog.user.name); + ASSERT_EQ(m_cliSI.username, creationLog.username); ASSERT_EQ(m_cliSI.host, creationLog.host); const common::dataStructures::EntryLog lastModificationLog = @@ -164,7 +155,7 @@ TEST_F(cta_catalogue_InMemoryCatalogueTest, createAdminUser) { } const std::string createAdminUserComment = "create admin user"; - m_catalogue->createAdminUser(m_bootstrapAdminSI, m_adminUI, createAdminUserComment); + m_catalogue->createAdminUser(m_bootstrapAdminSI, m_adminSI.username, createAdminUserComment); { std::list<common::dataStructures::AdminUser> admins; @@ -176,36 +167,36 @@ TEST_F(cta_catalogue_InMemoryCatalogueTest, createAdminUser) { const common::dataStructures::AdminUser a2 = admins.front(); ASSERT_NE(a1, a2); - ASSERT_TRUE((a1.name == m_bootstrapAdminUI.name && a2.name == m_adminUI.name) || - (a2.name == m_bootstrapAdminUI.name && a1.name == m_adminUI.name)); + ASSERT_TRUE((a1.name == m_bootstrapAdminSI.username && a2.name == m_adminSI.username) || + (a2.name == m_bootstrapAdminSI.username && a1.name == m_adminSI.username)); - if(a1.name == m_bootstrapAdminUI.name) { - ASSERT_EQ(m_bootstrapAdminUI.name, a1.name); + if(a1.name == m_bootstrapAdminSI.username) { + ASSERT_EQ(m_bootstrapAdminSI.username, a1.name); ASSERT_EQ(m_bootstrapComment, a1.comment); - ASSERT_EQ(m_cliSI.user.name, a1.creationLog.user.name); + ASSERT_EQ(m_cliSI.username, a1.creationLog.username); ASSERT_EQ(m_cliSI.host, a1.creationLog.host); - ASSERT_EQ(m_cliSI.user.name, a1.lastModificationLog.user.name); + ASSERT_EQ(m_cliSI.username, a1.lastModificationLog.username); ASSERT_EQ(m_cliSI.host, a1.lastModificationLog.host); - ASSERT_EQ(m_adminUI.name, a2.name); + ASSERT_EQ(m_adminSI.username, a2.name); ASSERT_EQ(createAdminUserComment, a2.comment); - ASSERT_EQ(m_bootstrapAdminSI.user.name, a2.creationLog.user.name); + ASSERT_EQ(m_bootstrapAdminSI.username, a2.creationLog.username); ASSERT_EQ(m_bootstrapAdminSI.host, a2.creationLog.host); - ASSERT_EQ(m_bootstrapAdminSI.user.name, a2.lastModificationLog.user.name); + ASSERT_EQ(m_bootstrapAdminSI.username, a2.lastModificationLog.username); ASSERT_EQ(m_bootstrapAdminSI.host, a2.lastModificationLog.host); } else { - ASSERT_EQ(m_bootstrapAdminUI.name, a2.name); + ASSERT_EQ(m_bootstrapAdminSI.username, a2.name); ASSERT_EQ(m_bootstrapComment, a2.comment); - ASSERT_EQ(m_cliSI.user.name, a2.creationLog.user.name); + ASSERT_EQ(m_cliSI.username, a2.creationLog.username); ASSERT_EQ(m_cliSI.host, a2.creationLog.host); - ASSERT_EQ(m_cliSI.user.name, a2.lastModificationLog.user.name); + ASSERT_EQ(m_cliSI.username, a2.lastModificationLog.username); ASSERT_EQ(m_cliSI.host, a2.lastModificationLog.host); - ASSERT_EQ(m_adminUI.name, a1.name); + ASSERT_EQ(m_adminSI.username, a1.name); ASSERT_EQ(createAdminUserComment, a1.comment); - ASSERT_EQ(m_bootstrapAdminSI.user, a1.creationLog.user); + ASSERT_EQ(m_bootstrapAdminSI.username, a1.creationLog.username); ASSERT_EQ(m_bootstrapAdminSI.host, a1.creationLog.host); - ASSERT_EQ(m_bootstrapAdminSI.user.name, a1.lastModificationLog.user.name); + ASSERT_EQ(m_bootstrapAdminSI.username, a1.lastModificationLog.username); ASSERT_EQ(m_bootstrapAdminSI.host, a1.lastModificationLog.host); } } @@ -215,7 +206,7 @@ TEST_F(cta_catalogue_InMemoryCatalogueTest, createAdminUser_same_twice) { using namespace cta; m_catalogue->createBootstrapAdminAndHostNoAuth( - m_cliSI, m_bootstrapAdminUI, m_bootstrapAdminSI.host, m_bootstrapComment); + m_cliSI, m_bootstrapAdminSI.username, m_bootstrapAdminSI.host, m_bootstrapComment); { std::list<common::dataStructures::AdminUser> admins; @@ -226,7 +217,7 @@ TEST_F(cta_catalogue_InMemoryCatalogueTest, createAdminUser_same_twice) { ASSERT_EQ(m_bootstrapComment, admin.comment); const common::dataStructures::EntryLog creationLog = admin.creationLog; - ASSERT_EQ(m_cliSI.user.name, creationLog.user.name); + ASSERT_EQ(m_cliSI.username, creationLog.username); ASSERT_EQ(m_cliSI.host, creationLog.host); const common::dataStructures::EntryLog lastModificationLog = @@ -234,9 +225,9 @@ TEST_F(cta_catalogue_InMemoryCatalogueTest, createAdminUser_same_twice) { ASSERT_EQ(creationLog, lastModificationLog); } - m_catalogue->createAdminUser(m_bootstrapAdminSI, m_adminUI, "comment 1"); + m_catalogue->createAdminUser(m_bootstrapAdminSI, m_adminSI.username, "comment 1"); - ASSERT_THROW(m_catalogue->createAdminUser(m_bootstrapAdminSI, m_adminUI, + ASSERT_THROW(m_catalogue->createAdminUser(m_bootstrapAdminSI, m_adminSI.username, "comment 2"), exception::Exception); } @@ -246,7 +237,7 @@ TEST_F(cta_catalogue_InMemoryCatalogueTest, createAdminHost) { ASSERT_TRUE(m_catalogue->getAdminHosts().empty()); m_catalogue->createBootstrapAdminAndHostNoAuth( - m_cliSI, m_bootstrapAdminUI, m_bootstrapAdminSI.host, m_bootstrapComment); + m_cliSI, m_bootstrapAdminSI.username, m_bootstrapAdminSI.host, m_bootstrapComment); { std::list<common::dataStructures::AdminUser> admins; @@ -257,7 +248,7 @@ TEST_F(cta_catalogue_InMemoryCatalogueTest, createAdminHost) { ASSERT_EQ(m_bootstrapComment, admin.comment); const common::dataStructures::EntryLog creationLog = admin.creationLog; - ASSERT_EQ(m_cliSI.user.name, creationLog.user.name); + ASSERT_EQ(m_cliSI.username, creationLog.username); ASSERT_EQ(m_cliSI.host, creationLog.host); const common::dataStructures::EntryLog lastModificationLog = @@ -289,30 +280,30 @@ TEST_F(cta_catalogue_InMemoryCatalogueTest, createAdminHost) { if(h1.name == m_bootstrapAdminSI.host) { ASSERT_EQ(m_bootstrapAdminSI.host, h1.name); ASSERT_EQ(m_bootstrapComment, h1.comment); - ASSERT_EQ(m_cliSI.user.name, h1.creationLog.user.name); + ASSERT_EQ(m_cliSI.username, h1.creationLog.username); ASSERT_EQ(m_cliSI.host, h1.creationLog.host); - ASSERT_EQ(m_cliSI.user.name, h1.lastModificationLog.user.name); + ASSERT_EQ(m_cliSI.username, h1.lastModificationLog.username); ASSERT_EQ(m_cliSI.host, h1.lastModificationLog.host); ASSERT_EQ(anotherAdminHost, h2.name); ASSERT_EQ(createAdminHostComment, h2.comment); - ASSERT_EQ(m_bootstrapAdminSI.user.name, h2.creationLog.user.name); + ASSERT_EQ(m_bootstrapAdminSI.username, h2.creationLog.username); ASSERT_EQ(m_bootstrapAdminSI.host, h2.creationLog.host); - ASSERT_EQ(m_bootstrapAdminSI.user.name, h2.lastModificationLog.user.name); + ASSERT_EQ(m_bootstrapAdminSI.username, h2.lastModificationLog.username); ASSERT_EQ(m_bootstrapAdminSI.host, h2.lastModificationLog.host); } else { ASSERT_EQ(m_bootstrapAdminSI.host, h2.name); ASSERT_EQ(m_bootstrapComment, h2.comment); - ASSERT_EQ(m_cliSI.user.name, h2.creationLog.user.name); + ASSERT_EQ(m_cliSI.username, h2.creationLog.username); ASSERT_EQ(m_cliSI.host, h2.creationLog.host); - ASSERT_EQ(m_cliSI.user.name, h2.lastModificationLog.user.name); + ASSERT_EQ(m_cliSI.username, h2.lastModificationLog.username); ASSERT_EQ(m_cliSI.host, h2.lastModificationLog.host); ASSERT_EQ(anotherAdminHost, h1.name); ASSERT_EQ(createAdminHostComment, h1.comment); - ASSERT_EQ(m_bootstrapAdminSI.user.name, h1.creationLog.user.name); + ASSERT_EQ(m_bootstrapAdminSI.username, h1.creationLog.username); ASSERT_EQ(m_bootstrapAdminSI.host, h1.creationLog.host); - ASSERT_EQ(m_bootstrapAdminSI.user.name, h1.lastModificationLog.user.name); + ASSERT_EQ(m_bootstrapAdminSI.username, h1.lastModificationLog.username); ASSERT_EQ(m_bootstrapAdminSI.host, h1.lastModificationLog.host); } } @@ -322,7 +313,7 @@ TEST_F(cta_catalogue_InMemoryCatalogueTest, createAdminHost_same_twice) { using namespace cta; m_catalogue->createBootstrapAdminAndHostNoAuth( - m_cliSI, m_bootstrapAdminUI, m_bootstrapAdminSI.host, m_bootstrapComment); + m_cliSI, m_bootstrapAdminSI.username, m_bootstrapAdminSI.host, m_bootstrapComment); { std::list<common::dataStructures::AdminUser> admins; @@ -333,7 +324,7 @@ TEST_F(cta_catalogue_InMemoryCatalogueTest, createAdminHost_same_twice) { ASSERT_EQ(m_bootstrapComment, admin.comment); const common::dataStructures::EntryLog creationLog = admin.creationLog; - ASSERT_EQ(m_cliSI.user.name, creationLog.user.name); + ASSERT_EQ(m_cliSI.username, creationLog.username); ASSERT_EQ(m_cliSI.host, creationLog.host); const common::dataStructures::EntryLog lastModificationLog = @@ -359,7 +350,7 @@ TEST_F(cta_catalogue_InMemoryCatalogueTest, isAdmin_true) { using namespace cta; m_catalogue->createBootstrapAdminAndHostNoAuth( - m_cliSI, m_bootstrapAdminUI, m_bootstrapAdminSI.host, m_bootstrapComment); + m_cliSI, m_bootstrapAdminSI.username, m_bootstrapAdminSI.host, m_bootstrapComment); ASSERT_TRUE(m_catalogue->isAdmin(m_bootstrapAdminSI)); } @@ -386,7 +377,7 @@ TEST_F(cta_catalogue_InMemoryCatalogueTest, createStorageClass) { ASSERT_EQ(comment, storageClass.comment); const common::dataStructures::EntryLog creationLog = storageClass.creationLog; - ASSERT_EQ(m_cliSI.user.name, creationLog.user.name); + ASSERT_EQ(m_cliSI.username, creationLog.username); ASSERT_EQ(m_cliSI.host, creationLog.host); const common::dataStructures::EntryLog lastModificationLog = @@ -429,7 +420,7 @@ TEST_F(cta_catalogue_InMemoryCatalogueTest, createTapePool) { ASSERT_EQ(comment, pool.comment); const common::dataStructures::EntryLog creationLog = pool.creationLog; - ASSERT_EQ(m_cliSI.user.name, creationLog.user.name); + ASSERT_EQ(m_cliSI.username, creationLog.username); ASSERT_EQ(m_cliSI.host, creationLog.host); const common::dataStructures::EntryLog lastModificationLog = @@ -482,7 +473,7 @@ TEST_F(cta_catalogue_InMemoryCatalogueTest, createArchiveRoute) { ASSERT_EQ(comment, route.comment); const common::dataStructures::EntryLog creationLog = route.creationLog; - ASSERT_EQ(m_cliSI.user.name, creationLog.user.name); + ASSERT_EQ(m_cliSI.username, creationLog.username); ASSERT_EQ(m_cliSI.host, creationLog.host); const common::dataStructures::EntryLog lastModificationLog = @@ -550,7 +541,7 @@ TEST_F(cta_catalogue_InMemoryCatalogueTest, createArchiveRoute_deleteStorageClas ASSERT_EQ(comment, route.comment); const common::dataStructures::EntryLog creationLog = route.creationLog; - ASSERT_EQ(m_cliSI.user.name, creationLog.user.name); + ASSERT_EQ(m_cliSI.username, creationLog.username); ASSERT_EQ(m_cliSI.host, creationLog.host); const common::dataStructures::EntryLog lastModificationLog = @@ -586,7 +577,7 @@ TEST_F(cta_catalogue_InMemoryCatalogueTest, createLogicalLibrary) { ASSERT_EQ(comment, lib.comment); const common::dataStructures::EntryLog creationLog = lib.creationLog; - ASSERT_EQ(m_cliSI.user.name, creationLog.user.name); + ASSERT_EQ(m_cliSI.username, creationLog.username); ASSERT_EQ(m_cliSI.host, creationLog.host); const common::dataStructures::EntryLog lastModificationLog = @@ -642,7 +633,7 @@ TEST_F(cta_catalogue_InMemoryCatalogueTest, createTape) { ASSERT_EQ(comment, tape.comment); const common::dataStructures::EntryLog creationLog = tape.creationLog; - ASSERT_EQ(m_cliSI.user.name, creationLog.user.name); + ASSERT_EQ(m_cliSI.username, creationLog.username); ASSERT_EQ(m_cliSI.host, creationLog.host); const common::dataStructures::EntryLog lastModificationLog = @@ -748,7 +739,7 @@ TEST_F(cta_catalogue_InMemoryCatalogueTest, createMountPolicy) { ASSERT_EQ(comment, group.comment); const common::dataStructures::EntryLog creationLog = group.creationLog; - ASSERT_EQ(m_cliSI.user.name, creationLog.user.name); + ASSERT_EQ(m_cliSI.username, creationLog.username); ASSERT_EQ(m_cliSI.host, creationLog.host); const common::dataStructures::EntryLog lastModificationLog = @@ -828,7 +819,7 @@ TEST_F(cta_catalogue_InMemoryCatalogueTest, createUser) { ASSERT_EQ(userName, user.name); ASSERT_EQ(mountPolicyName, user.mountPolicy); ASSERT_EQ(comment, user.comment); - ASSERT_EQ(m_cliSI.user.name, user.creationLog.user.name); + ASSERT_EQ(m_cliSI.username, user.creationLog.username); ASSERT_EQ(m_cliSI.host, user.creationLog.host); ASSERT_EQ(user.creationLog, user.lastModificationLog); @@ -914,7 +905,7 @@ TEST_F(cta_catalogue_InMemoryCatalogueTest, prepareForNewFile) { ASSERT_EQ(userName, user.name); ASSERT_EQ(mountPolicyName, user.mountPolicy); ASSERT_EQ(userComment, user.comment); - ASSERT_EQ(m_cliSI.user.name, user.creationLog.user.name); + ASSERT_EQ(m_cliSI.username, user.creationLog.username); ASSERT_EQ(m_cliSI.host, user.creationLog.host); ASSERT_EQ(user.creationLog, user.lastModificationLog); @@ -957,7 +948,7 @@ TEST_F(cta_catalogue_InMemoryCatalogueTest, prepareForNewFile) { ASSERT_EQ(archiveRouteComment, route.comment); const common::dataStructures::EntryLog creationLog = route.creationLog; - ASSERT_EQ(m_cliSI.user.name, creationLog.user.name); + ASSERT_EQ(m_cliSI.username, creationLog.username); ASSERT_EQ(m_cliSI.host, creationLog.host); const common::dataStructures::EntryLog lastModificationLog = @@ -1021,7 +1012,7 @@ TEST_F(cta_catalogue_InMemoryCatalogueTest, prepareToRetrieveFile) { ASSERT_EQ(comment, tape.comment); const common::dataStructures::EntryLog creationLog = tape.creationLog; - ASSERT_EQ(m_cliSI.user.name, creationLog.user.name); + ASSERT_EQ(m_cliSI.username, creationLog.username); ASSERT_EQ(m_cliSI.host, creationLog.host); const common::dataStructures::EntryLog lastModificationLog = @@ -1041,7 +1032,7 @@ TEST_F(cta_catalogue_InMemoryCatalogueTest, prepareToRetrieveFile) { ASSERT_EQ(comment, tape.comment); const common::dataStructures::EntryLog creationLog = tape.creationLog; - ASSERT_EQ(m_cliSI.user.name, creationLog.user.name); + ASSERT_EQ(m_cliSI.username, creationLog.username); ASSERT_EQ(m_cliSI.host, creationLog.host); const common::dataStructures::EntryLog lastModificationLog = @@ -1185,7 +1176,7 @@ TEST_F(cta_catalogue_InMemoryCatalogueTest, prepareToRetrieveFile) { ASSERT_EQ(userName, user.name); ASSERT_EQ(mountPolicyName, user.mountPolicy); ASSERT_EQ(userComment, user.comment); - ASSERT_EQ(m_cliSI.user.name, user.creationLog.user.name); + ASSERT_EQ(m_cliSI.username, user.creationLog.username); ASSERT_EQ(m_cliSI.host, user.creationLog.host); ASSERT_EQ(user.creationLog, user.lastModificationLog); @@ -1248,7 +1239,7 @@ TEST_F(cta_catalogue_InMemoryCatalogueTest, fileWrittenToTape_2_tape_files_diffe ASSERT_EQ(comment, tape.comment); const common::dataStructures::EntryLog creationLog = tape.creationLog; - ASSERT_EQ(m_cliSI.user.name, creationLog.user.name); + ASSERT_EQ(m_cliSI.username, creationLog.username); ASSERT_EQ(m_cliSI.host, creationLog.host); const common::dataStructures::EntryLog lastModificationLog = @@ -1268,7 +1259,7 @@ TEST_F(cta_catalogue_InMemoryCatalogueTest, fileWrittenToTape_2_tape_files_diffe ASSERT_EQ(comment, tape.comment); const common::dataStructures::EntryLog creationLog = tape.creationLog; - ASSERT_EQ(m_cliSI.user.name, creationLog.user.name); + ASSERT_EQ(m_cliSI.username, creationLog.username); ASSERT_EQ(m_cliSI.host, creationLog.host); const common::dataStructures::EntryLog lastModificationLog = @@ -1435,7 +1426,7 @@ TEST_F(cta_catalogue_InMemoryCatalogueTest, fileWrittenToTape_2_tape_files_same_ ASSERT_EQ(comment, tape.comment); const common::dataStructures::EntryLog creationLog = tape.creationLog; - ASSERT_EQ(m_cliSI.user.name, creationLog.user.name); + ASSERT_EQ(m_cliSI.username, creationLog.username); ASSERT_EQ(m_cliSI.host, creationLog.host); const common::dataStructures::EntryLog lastModificationLog = @@ -1556,7 +1547,7 @@ TEST_F(cta_catalogue_InMemoryCatalogueTest, fileWrittenToTape_2_tape_files_corru ASSERT_EQ(comment, tape.comment); const common::dataStructures::EntryLog creationLog = tape.creationLog; - ASSERT_EQ(m_cliSI.user.name, creationLog.user.name); + ASSERT_EQ(m_cliSI.username, creationLog.username); ASSERT_EQ(m_cliSI.host, creationLog.host); const common::dataStructures::EntryLog lastModificationLog = diff --git a/catalogue/RdbmsCatalogue.cpp b/catalogue/RdbmsCatalogue.cpp index 9a51624eb619dea74f7f847e1aaac91c0d1119a3..dd3351648eaebac2c7c002fe0ca48016f8c77fa0 100644 --- a/catalogue/RdbmsCatalogue.cpp +++ b/catalogue/RdbmsCatalogue.cpp @@ -48,11 +48,11 @@ RdbmsCatalogue::~RdbmsCatalogue() { //------------------------------------------------------------------------------ void RdbmsCatalogue::createBootstrapAdminAndHostNoAuth( const common::dataStructures::SecurityIdentity &cliIdentity, - const common::dataStructures::UserIdentity &user, + const std::string &username, const std::string &hostName, const std::string &comment) { try { - createAdminUser(cliIdentity, user, comment); + createAdminUser(cliIdentity, username, comment); createAdminHost(cliIdentity, hostName, comment); } catch(exception::Exception &ex) { throw exception::Exception(std::string(__FUNCTION__) + " failed: " + ex.getMessage().str()); @@ -64,7 +64,7 @@ void RdbmsCatalogue::createBootstrapAdminAndHostNoAuth( //------------------------------------------------------------------------------ void RdbmsCatalogue::createAdminUser( const common::dataStructures::SecurityIdentity &cliIdentity, - const common::dataStructures::UserIdentity &user, + const std::string &username, const std::string &comment) { try { const uint64_t now = time(NULL); @@ -95,15 +95,15 @@ void RdbmsCatalogue::createAdminUser( ":LAST_UPDATE_TIME)"; std::unique_ptr<DbStmt> stmt(m_conn->createStmt(sql)); - stmt->bindString(":ADMIN_USER_NAME", user.name); + stmt->bindString(":ADMIN_USER_NAME", username); stmt->bindString(":USER_COMMENT", comment); - stmt->bindString(":CREATION_LOG_USER_NAME", cliIdentity.user.name); + stmt->bindString(":CREATION_LOG_USER_NAME", cliIdentity.username); stmt->bindString(":CREATION_LOG_HOST_NAME", cliIdentity.host); stmt->bindUint64(":CREATION_LOG_TIME", now); - stmt->bindString(":LAST_UPDATE_USER_NAME", cliIdentity.user.name); + stmt->bindString(":LAST_UPDATE_USER_NAME", cliIdentity.username); stmt->bindString(":LAST_UPDATE_HOST_NAME", cliIdentity.host); stmt->bindUint64(":LAST_UPDATE_TIME", now); @@ -116,7 +116,7 @@ void RdbmsCatalogue::createAdminUser( //------------------------------------------------------------------------------ // deleteAdminUser //------------------------------------------------------------------------------ -void RdbmsCatalogue::deleteAdminUser(const common::dataStructures::UserIdentity &user) { +void RdbmsCatalogue::deleteAdminUser(const std::string &username) { throw exception::Exception(std::string(__FUNCTION__) + " not implemented"); } @@ -151,21 +151,15 @@ std::list<common::dataStructures::AdminUser> admin.comment = rset->columnText("USER_COMMENT"); - common::dataStructures::UserIdentity creatorUI; - creatorUI.name = rset->columnText("CREATION_LOG_USER_NAME"); - common::dataStructures::EntryLog creationLog; - creationLog.user = creatorUI; + creationLog.username = rset->columnText("CREATION_LOG_USER_NAME"); creationLog.host = rset->columnText("CREATION_LOG_HOST_NAME"); creationLog.time = rset->columnUint64("CREATION_LOG_TIME"); admin.creationLog = creationLog; - common::dataStructures::UserIdentity updaterUI; - updaterUI.name = rset->columnText("LAST_UPDATE_USER_NAME"); - common::dataStructures::EntryLog updateLog; - updateLog.user = updaterUI; + updateLog.username = rset->columnText("LAST_UPDATE_USER_NAME"); updateLog.host = rset->columnText("LAST_UPDATE_HOST_NAME"); updateLog.time = rset->columnUint64("LAST_UPDATE_TIME"); @@ -183,7 +177,7 @@ std::list<common::dataStructures::AdminUser> //------------------------------------------------------------------------------ // modifyAdminUserComment //------------------------------------------------------------------------------ -void RdbmsCatalogue::modifyAdminUserComment(const common::dataStructures::SecurityIdentity &cliIdentity, const common::dataStructures::UserIdentity &user, const std::string &comment) { +void RdbmsCatalogue::modifyAdminUserComment(const common::dataStructures::SecurityIdentity &cliIdentity, const std::string &username, const std::string &comment) { throw exception::Exception(std::string(__FUNCTION__) + " not implemented"); } @@ -227,11 +221,11 @@ void RdbmsCatalogue::createAdminHost( stmt->bindString(":USER_COMMENT", comment); - stmt->bindString(":CREATION_LOG_USER_NAME", cliIdentity.user.name); + stmt->bindString(":CREATION_LOG_USER_NAME", cliIdentity.username); stmt->bindString(":CREATION_LOG_HOST_NAME", cliIdentity.host); stmt->bindUint64(":CREATION_LOG_TIME", now); - stmt->bindString(":LAST_UPDATE_USER_NAME", cliIdentity.user.name); + stmt->bindString(":LAST_UPDATE_USER_NAME", cliIdentity.username); stmt->bindString(":LAST_UPDATE_HOST_NAME", cliIdentity.host); stmt->bindUint64(":LAST_UPDATE_TIME", now); @@ -281,7 +275,7 @@ std::list<common::dataStructures::AdminHost> RdbmsCatalogue::getAdminHosts() con creatorUI.name = rset->columnText("CREATION_LOG_USER_NAME"); common::dataStructures::EntryLog creationLog; - creationLog.user = creatorUI; + creationLog.username = rset->columnText("CREATION_LOG_USER_NAME"); creationLog.host = rset->columnText("CREATION_LOG_HOST_NAME"); creationLog.time = rset->columnUint64("CREATION_LOG_TIME"); @@ -291,7 +285,7 @@ std::list<common::dataStructures::AdminHost> RdbmsCatalogue::getAdminHosts() con updaterUI.name = rset->columnText("LAST_UPDATE_USER_NAME"); common::dataStructures::EntryLog updateLog; - updateLog.user = updaterUI; + updateLog.username = rset->columnText("LAST_UPDATE_USER_NAME"); updateLog.host = rset->columnText("LAST_UPDATE_HOST_NAME"); updateLog.time = rset->columnUint64("LAST_UPDATE_TIME"); @@ -357,11 +351,11 @@ void RdbmsCatalogue::createStorageClass( stmt->bindString(":USER_COMMENT", comment); - stmt->bindString(":CREATION_LOG_USER_NAME", cliIdentity.user.name); + stmt->bindString(":CREATION_LOG_USER_NAME", cliIdentity.username); stmt->bindString(":CREATION_LOG_HOST_NAME", cliIdentity.host); stmt->bindUint64(":CREATION_LOG_TIME", now); - stmt->bindString(":LAST_UPDATE_USER_NAME", cliIdentity.user.name); + stmt->bindString(":LAST_UPDATE_USER_NAME", cliIdentity.username); stmt->bindString(":LAST_UPDATE_HOST_NAME", cliIdentity.host); stmt->bindUint64(":LAST_UPDATE_TIME", now); @@ -427,7 +421,7 @@ std::list<common::dataStructures::StorageClass> creatorUI.name = rset->columnText("CREATION_LOG_USER_NAME"); common::dataStructures::EntryLog creationLog; - creationLog.user = creatorUI; + creationLog.username = rset->columnText("CREATION_LOG_USER_NAME"); creationLog.host = rset->columnText("CREATION_LOG_HOST_NAME"); creationLog.time = rset->columnUint64("CREATION_LOG_TIME"); @@ -437,7 +431,7 @@ std::list<common::dataStructures::StorageClass> updaterUI.name = rset->columnText("LAST_UPDATE_USER_NAME"); common::dataStructures::EntryLog updateLog; - updateLog.user = updaterUI; + updateLog.username = rset->columnText("LAST_UPDATE_USER_NAME"); updateLog.host = rset->columnText("LAST_UPDATE_HOST_NAME"); updateLog.time = rset->columnUint64("LAST_UPDATE_TIME"); @@ -514,11 +508,11 @@ void RdbmsCatalogue::createTapePool( stmt->bindString(":USER_COMMENT", comment); - stmt->bindString(":CREATION_LOG_USER_NAME", cliIdentity.user.name); + stmt->bindString(":CREATION_LOG_USER_NAME", cliIdentity.username); stmt->bindString(":CREATION_LOG_HOST_NAME", cliIdentity.host); stmt->bindUint64(":CREATION_LOG_TIME", now); - stmt->bindString(":LAST_UPDATE_USER_NAME", cliIdentity.user.name); + stmt->bindString(":LAST_UPDATE_USER_NAME", cliIdentity.username); stmt->bindString(":LAST_UPDATE_HOST_NAME", cliIdentity.host); stmt->bindUint64(":LAST_UPDATE_TIME", now); @@ -574,7 +568,7 @@ std::list<common::dataStructures::TapePool> creatorUI.name = rset->columnText("CREATION_LOG_USER_NAME"); common::dataStructures::EntryLog creationLog; - creationLog.user = creatorUI; + creationLog.username = rset->columnText("CREATION_LOG_USER_NAME"); creationLog.host = rset->columnText("CREATION_LOG_HOST_NAME"); creationLog.time = rset->columnUint64("CREATION_LOG_TIME"); @@ -584,7 +578,7 @@ std::list<common::dataStructures::TapePool> updaterUI.name = rset->columnText("LAST_UPDATE_USER_NAME"); common::dataStructures::EntryLog updateLog; - updateLog.user = updaterUI; + updateLog.username = rset->columnText("LAST_UPDATE_USER_NAME"); updateLog.host = rset->columnText("LAST_UPDATE_HOST_NAME"); updateLog.time = rset->columnUint64("LAST_UPDATE_TIME"); @@ -668,11 +662,11 @@ void RdbmsCatalogue::createArchiveRoute( stmt->bindString(":USER_COMMENT", comment); - stmt->bindString(":CREATION_LOG_USER_NAME", cliIdentity.user.name); + stmt->bindString(":CREATION_LOG_USER_NAME", cliIdentity.username); stmt->bindString(":CREATION_LOG_HOST_NAME", cliIdentity.host); stmt->bindUint64(":CREATION_LOG_TIME", now); - stmt->bindString(":LAST_UPDATE_USER_NAME", cliIdentity.user.name); + stmt->bindString(":LAST_UPDATE_USER_NAME", cliIdentity.username); stmt->bindString(":LAST_UPDATE_HOST_NAME", cliIdentity.host); stmt->bindUint64(":LAST_UPDATE_TIME", now); @@ -728,7 +722,7 @@ std::list<common::dataStructures::ArchiveRoute> creatorUI.name = rset->columnText("CREATION_LOG_USER_NAME"); common::dataStructures::EntryLog creationLog; - creationLog.user = creatorUI; + creationLog.username = rset->columnText("CREATION_LOG_USER_NAME"); creationLog.host = rset->columnText("CREATION_LOG_HOST_NAME"); creationLog.time = rset->columnUint64("CREATION_LOG_TIME"); @@ -738,7 +732,7 @@ std::list<common::dataStructures::ArchiveRoute> updaterUI.name = rset->columnText("LAST_UPDATE_USER_NAME"); common::dataStructures::EntryLog updateLog; - updateLog.user = updaterUI; + updateLog.username = rset->columnText("LAST_UPDATE_USER_NAME"); updateLog.host = rset->columnText("LAST_UPDATE_HOST_NAME"); updateLog.time = rset->columnUint64("LAST_UPDATE_TIME"); @@ -807,11 +801,11 @@ void RdbmsCatalogue::createLogicalLibrary( stmt->bindString(":USER_COMMENT", comment); - stmt->bindString(":CREATION_LOG_USER_NAME", cliIdentity.user.name); + stmt->bindString(":CREATION_LOG_USER_NAME", cliIdentity.username); stmt->bindString(":CREATION_LOG_HOST_NAME", cliIdentity.host); stmt->bindUint64(":CREATION_LOG_TIME", now); - stmt->bindString(":LAST_UPDATE_USER_NAME", cliIdentity.user.name); + stmt->bindString(":LAST_UPDATE_USER_NAME", cliIdentity.username); stmt->bindString(":LAST_UPDATE_HOST_NAME", cliIdentity.host); stmt->bindUint64(":LAST_UPDATE_TIME", now); @@ -863,7 +857,7 @@ std::list<common::dataStructures::LogicalLibrary> creatorUI.name = rset->columnText("CREATION_LOG_USER_NAME"); common::dataStructures::EntryLog creationLog; - creationLog.user = creatorUI; + creationLog.username = rset->columnText("CREATION_LOG_USER_NAME"); creationLog.host = rset->columnText("CREATION_LOG_HOST_NAME"); creationLog.time = rset->columnUint64("CREATION_LOG_TIME"); @@ -873,7 +867,7 @@ std::list<common::dataStructures::LogicalLibrary> updaterUI.name = rset->columnText("LAST_UPDATE_USER_NAME"); common::dataStructures::EntryLog updateLog; - updateLog.user = updaterUI; + updateLog.username = rset->columnText("LAST_UPDATE_USER_NAME"); updateLog.host = rset->columnText("LAST_UPDATE_HOST_NAME"); updateLog.time = rset->columnUint64("LAST_UPDATE_TIME"); @@ -995,11 +989,11 @@ void RdbmsCatalogue::createTape( stmt->bindString(":USER_COMMENT", comment); - stmt->bindString(":CREATION_LOG_USER_NAME", cliIdentity.user.name); + stmt->bindString(":CREATION_LOG_USER_NAME", cliIdentity.username); stmt->bindString(":CREATION_LOG_HOST_NAME", cliIdentity.host); stmt->bindUint64(":CREATION_LOG_TIME", now); - stmt->bindString(":LAST_UPDATE_USER_NAME", cliIdentity.user.name); + stmt->bindString(":LAST_UPDATE_USER_NAME", cliIdentity.username); stmt->bindString(":LAST_UPDATE_HOST_NAME", cliIdentity.host); stmt->bindUint64(":LAST_UPDATE_TIME", now); @@ -1149,7 +1143,7 @@ std::list<common::dataStructures::Tape> RdbmsCatalogue::getTapes( creatorUI.name = rset->columnText("CREATION_LOG_USER_NAME"); common::dataStructures::EntryLog creationLog; - creationLog.user = creatorUI; + creationLog.username = rset->columnText("CREATION_LOG_USER_NAME"); creationLog.host = rset->columnText("CREATION_LOG_HOST_NAME"); creationLog.time = rset->columnUint64("CREATION_LOG_TIME"); @@ -1159,7 +1153,7 @@ std::list<common::dataStructures::Tape> RdbmsCatalogue::getTapes( updaterUI.name = rset->columnText("LAST_UPDATE_USER_NAME"); common::dataStructures::EntryLog updateLog; - updateLog.user = updaterUI; + updateLog.username = rset->columnText("LAST_UPDATE_USER_NAME"); updateLog.host = rset->columnText("LAST_UPDATE_HOST_NAME"); updateLog.time = rset->columnUint64("LAST_UPDATE_TIME"); @@ -1309,11 +1303,11 @@ void RdbmsCatalogue::createRequester( stmt->bindString(":USER_COMMENT", comment); - stmt->bindString(":CREATION_LOG_USER_NAME", cliIdentity.user.name); + stmt->bindString(":CREATION_LOG_USER_NAME", cliIdentity.username); stmt->bindString(":CREATION_LOG_HOST_NAME", cliIdentity.host); stmt->bindUint64(":CREATION_LOG_TIME", now); - stmt->bindString(":LAST_UPDATE_USER_NAME", cliIdentity.user.name); + stmt->bindString(":LAST_UPDATE_USER_NAME", cliIdentity.username); stmt->bindString(":LAST_UPDATE_HOST_NAME", cliIdentity.host); stmt->bindUint64(":LAST_UPDATE_TIME", now); @@ -1368,7 +1362,7 @@ std::list<common::dataStructures::Requester> creatorUI.name = rset->columnText("CREATION_LOG_USER_NAME"); common::dataStructures::EntryLog creationLog; - creationLog.user = creatorUI; + creationLog.username = rset->columnText("CREATION_LOG_USER_NAME"); creationLog.host = rset->columnText("CREATION_LOG_HOST_NAME"); creationLog.time = rset->columnUint64("CREATION_LOG_TIME"); @@ -1378,7 +1372,7 @@ std::list<common::dataStructures::Requester> updaterUI.name = rset->columnText("LAST_UPDATE_USER_NAME"); common::dataStructures::EntryLog updateLog; - updateLog.user = updaterUI; + updateLog.username = rset->columnText("LAST_UPDATE_USER_NAME"); updateLog.host = rset->columnText("LAST_UPDATE_HOST_NAME"); updateLog.time = rset->columnUint64("LAST_UPDATE_TIME"); @@ -1476,11 +1470,11 @@ void RdbmsCatalogue::createMountPolicy( stmt->bindString(":USER_COMMENT", comment); - stmt->bindString(":CREATION_LOG_USER_NAME", cliIdentity.user.name); + stmt->bindString(":CREATION_LOG_USER_NAME", cliIdentity.username); stmt->bindString(":CREATION_LOG_HOST_NAME", cliIdentity.host); stmt->bindUint64(":CREATION_LOG_TIME", now); - stmt->bindString(":LAST_UPDATE_USER_NAME", cliIdentity.user.name); + stmt->bindString(":LAST_UPDATE_USER_NAME", cliIdentity.username); stmt->bindString(":LAST_UPDATE_HOST_NAME", cliIdentity.host); stmt->bindUint64(":LAST_UPDATE_TIME", now); @@ -1552,7 +1546,7 @@ std::list<common::dataStructures::MountPolicy> creatorUI.name = rset->columnText("CREATION_LOG_USER_NAME"); common::dataStructures::EntryLog creationLog; - creationLog.user = creatorUI; + creationLog.username = rset->columnText("CREATION_LOG_USER_NAME"); creationLog.host = rset->columnText("CREATION_LOG_HOST_NAME"); creationLog.time = rset->columnUint64("CREATION_LOG_TIME"); @@ -1562,7 +1556,7 @@ std::list<common::dataStructures::MountPolicy> updaterUI.name = rset->columnText("LAST_UPDATE_USER_NAME"); common::dataStructures::EntryLog updateLog; - updateLog.user = updaterUI; + updateLog.username = rset->columnText("LAST_UPDATE_USER_NAME"); updateLog.host = rset->columnText("LAST_UPDATE_HOST_NAME"); updateLog.time = rset->columnUint64("LAST_UPDATE_TIME"); @@ -2063,21 +2057,15 @@ common::dataStructures::MountPolicy RdbmsCatalogue:: policy.comment = rset->columnText("USER_COMMENT"); - common::dataStructures::UserIdentity creatorUI; - creatorUI.name = rset->columnText("CREATION_LOG_USER_NAME"); - common::dataStructures::EntryLog creationLog; - creationLog.user = creatorUI; + creationLog.username = rset->columnText("CREATION_LOG_USER_NAME"); creationLog.host = rset->columnText("CREATION_LOG_HOST_NAME"); creationLog.time = rset->columnUint64("CREATION_LOG_TIME"); policy.creationLog = creationLog; - common::dataStructures::UserIdentity updaterUI; - updaterUI.name = rset->columnText("LAST_UPDATE_USER_NAME"); - common::dataStructures::EntryLog updateLog; - updateLog.user = updaterUI; + updateLog.username = rset->columnText("LAST_UPDATE_USER_NAME"); updateLog.host = rset->columnText("LAST_UPDATE_HOST_NAME"); updateLog.time = rset->columnUint64("LAST_UPDATE_TIME"); @@ -2220,7 +2208,7 @@ common::dataStructures::Tape RdbmsCatalogue::selectTapeForUpdate(const std::stri creatorUI.name = rset->columnText("CREATION_LOG_USER_NAME"); common::dataStructures::EntryLog creationLog; - creationLog.user = creatorUI; + creationLog.username = rset->columnText("CREATION_LOG_USER_NAME"); creationLog.host = rset->columnText("CREATION_LOG_HOST_NAME"); creationLog.time = rset->columnUint64("CREATION_LOG_TIME"); @@ -2230,7 +2218,7 @@ common::dataStructures::Tape RdbmsCatalogue::selectTapeForUpdate(const std::stri updaterUI.name = rset->columnText("LAST_UPDATE_USER_NAME"); common::dataStructures::EntryLog updateLog; - updateLog.user = updaterUI; + updateLog.username = rset->columnText("LAST_UPDATE_USER_NAME"); updateLog.host = rset->columnText("LAST_UPDATE_HOST_NAME"); updateLog.time = rset->columnUint64("LAST_UPDATE_TIME"); @@ -2369,7 +2357,7 @@ std::map<uint64_t, common::dataStructures::TapeFile> RdbmsCatalogue::getTapeFile // isAdmin //------------------------------------------------------------------------------ bool RdbmsCatalogue::isAdmin(const common::dataStructures::SecurityIdentity &cliIdentity) const { - return userIsAdmin(cliIdentity.user.name) && hostIsAdmin(cliIdentity.host); + return userIsAdmin(cliIdentity.username) && hostIsAdmin(cliIdentity.host); } //------------------------------------------------------------------------------ diff --git a/catalogue/RdbmsCatalogue.hpp b/catalogue/RdbmsCatalogue.hpp index ed5f590695ff0694f7800fc78d13e041bda9ce96..c17a628c5ee15d068682898d2ed53db6823b04cc 100644 --- a/catalogue/RdbmsCatalogue.hpp +++ b/catalogue/RdbmsCatalogue.hpp @@ -62,12 +62,12 @@ public: */ virtual ~RdbmsCatalogue(); - virtual void createBootstrapAdminAndHostNoAuth(const common::dataStructures::SecurityIdentity &cliIdentity, const common::dataStructures::UserIdentity &user, const std::string &hostName, const std::string &comment); + virtual void createBootstrapAdminAndHostNoAuth(const common::dataStructures::SecurityIdentity &cliIdentity, const std::string &username, const std::string &hostName, const std::string &comment); - virtual void createAdminUser(const common::dataStructures::SecurityIdentity &cliIdentity, const common::dataStructures::UserIdentity &user, const std::string &comment); - virtual void deleteAdminUser(const common::dataStructures::UserIdentity &user); + virtual void createAdminUser(const common::dataStructures::SecurityIdentity &cliIdentity, const std::string &username, const std::string &comment); + virtual void deleteAdminUser(const std::string &username); virtual std::list<common::dataStructures::AdminUser> getAdminUsers() const; - virtual void modifyAdminUserComment(const common::dataStructures::SecurityIdentity &cliIdentity, const common::dataStructures::UserIdentity &user, const std::string &comment); + virtual void modifyAdminUserComment(const common::dataStructures::SecurityIdentity &cliIdentity, const std::string &username, const std::string &comment); virtual void createAdminHost(const common::dataStructures::SecurityIdentity &cliIdentity, const std::string &hostName, const std::string &comment); virtual void deleteAdminHost(const std::string &hostName); diff --git a/common/dataStructures/EntryLog.cpp b/common/dataStructures/EntryLog.cpp index 7c0d5475dea8bcd1efa161b5a80df895edfbfc7e..1fddad3f857f96debc7fc4487d111f8cc264a76b 100644 --- a/common/dataStructures/EntryLog.cpp +++ b/common/dataStructures/EntryLog.cpp @@ -33,15 +33,15 @@ EntryLog::EntryLog(): //------------------------------------------------------------------------------ // constructor //------------------------------------------------------------------------------ -EntryLog::EntryLog(const UserIdentity& user, const std::string& host, const time_t time): - user(user), host(host), time(time) {} +EntryLog::EntryLog(const std::string & username, const std::string& host, const time_t time): + username(username), host(host), time(time) {} //------------------------------------------------------------------------------ // operator== //------------------------------------------------------------------------------ bool EntryLog::operator==(const EntryLog &rhs) const { - return user==rhs.user + return username==rhs.username && host==rhs.host && time==rhs.time; } @@ -57,7 +57,7 @@ bool EntryLog::operator!=(const EntryLog &rhs) const { // operator<< //------------------------------------------------------------------------------ std::ostream &operator<<(std::ostream &os, const EntryLog &obj) { - os << "(user=" << obj.user + os << "(username=" << obj.username << " host=" << obj.host << " time=" << obj.time << ")"; return os; diff --git a/common/dataStructures/EntryLog.hpp b/common/dataStructures/EntryLog.hpp index 02b13e9e61c4a46106a44a4a86ed5408dcbafcf1..5a29b9cf5fa9f188a2cef1913ef4b2acc5709193 100644 --- a/common/dataStructures/EntryLog.hpp +++ b/common/dataStructures/EntryLog.hpp @@ -37,13 +37,13 @@ struct EntryLog { EntryLog(); - EntryLog(const UserIdentity & user, const std::string & host, const time_t time); + EntryLog(const std::string & username, const std::string & host, const time_t time); bool operator==(const EntryLog &rhs) const; bool operator!=(const EntryLog &rhs) const; - UserIdentity user; + std::string username; std::string host; time_t time; diff --git a/common/dataStructures/SecurityIdentity.cpp b/common/dataStructures/SecurityIdentity.cpp index e677e29fdcfed6cbc8194ec45e54f36b5d596b75..3893679679f3bc3d2adfbe687b0973b813d6fc40 100644 --- a/common/dataStructures/SecurityIdentity.cpp +++ b/common/dataStructures/SecurityIdentity.cpp @@ -33,7 +33,7 @@ SecurityIdentity::SecurityIdentity() {} // operator== //------------------------------------------------------------------------------ bool SecurityIdentity::operator==(const SecurityIdentity &rhs) const { - return user==rhs.user + return username==rhs.username && host==rhs.host; } @@ -48,7 +48,7 @@ bool SecurityIdentity::operator!=(const SecurityIdentity &rhs) const { // operator<< //------------------------------------------------------------------------------ std::ostream &operator<<(std::ostream &os, const SecurityIdentity &obj) { - os << "(user=" << obj.user + os << "(username=" << obj.username << " host=" << obj.host << ")"; return os; } diff --git a/common/dataStructures/SecurityIdentity.hpp b/common/dataStructures/SecurityIdentity.hpp index 9c7b0ffcf61b84b1191e0d2ff248924011b4ae97..3363c469d3b815d0586614f37a4f878b3d8a894f 100644 --- a/common/dataStructures/SecurityIdentity.hpp +++ b/common/dataStructures/SecurityIdentity.hpp @@ -23,8 +23,6 @@ #include <stdint.h> #include <string> -#include "common/dataStructures/UserIdentity.hpp" - namespace cta { namespace common { namespace dataStructures { @@ -41,7 +39,7 @@ struct SecurityIdentity { bool operator!=(const SecurityIdentity &rhs) const; - UserIdentity user; + std::string username; std::string host; }; // struct SecurityIdentity diff --git a/objectstore/ArchiveRequest.cpp b/objectstore/ArchiveRequest.cpp index ae0cf4ff4bd1649112ce406b9a1bcbf1b8b47b99..c5c0a5b14ca932c309f26ced4532a96dac5a460c 100644 --- a/objectstore/ArchiveRequest.cpp +++ b/objectstore/ArchiveRequest.cpp @@ -387,8 +387,7 @@ void ArchiveRequest::setCreationLog(const cta::common::dataStructures::EntryLog auto payloadCreationLog = m_payload.mutable_creationlog(); payloadCreationLog->set_time(creationLog.time); payloadCreationLog->set_host(creationLog.host); - payloadCreationLog->set_name(creationLog.user.name); - payloadCreationLog->set_group(creationLog.user.group); + payloadCreationLog->set_username(creationLog.username); } //------------------------------------------------------------------------------ @@ -399,9 +398,7 @@ cta::common::dataStructures::EntryLog ArchiveRequest::getCreationLog() { cta::common::dataStructures::EntryLog creationLog; cta::common::dataStructures::UserIdentity user; auto payloadCreationLog = m_payload.creationlog(); - user.name=payloadCreationLog.name(); - user.group=payloadCreationLog.group(); - creationLog.user=user; + creationLog.username=payloadCreationLog.username(); creationLog.host=payloadCreationLog.host(); creationLog.time=payloadCreationLog.time(); return creationLog; @@ -560,8 +557,7 @@ std::string ArchiveRequest::dump() { json_object * jaf = json_object_new_object(); json_object_object_add(jaf, "host", json_object_new_string(m_payload.creationlog().host().c_str())); json_object_object_add(jaf, "time", json_object_new_int64(m_payload.creationlog().time())); - json_object_object_add(jaf, "name", json_object_new_string(m_payload.creationlog().name().c_str())); - json_object_object_add(jaf, "group", json_object_new_string(m_payload.creationlog().group().c_str())); + json_object_object_add(jaf, "username", json_object_new_string(m_payload.creationlog().username().c_str())); json_object_object_add(jo, "creationlog", jaf); // Array for jobs json_object * jja = json_object_new_array(); diff --git a/objectstore/ArchiveToFileRequestTest.cpp b/objectstore/ArchiveToFileRequestTest.cpp index 368b89a9e5ff5d4271b33eb5d0ad0562a6717f02..6d67aa58587f46894faff40a3fd2e41d9cd49383 100644 --- a/objectstore/ArchiveToFileRequestTest.cpp +++ b/objectstore/ArchiveToFileRequestTest.cpp @@ -40,7 +40,7 @@ TEST(ObjectStore, ArchiveToFileRequestBasicAccess) { atfr.setRemoteFile(cta::RemotePathAndStatus(cta::RemotePath("eos://dir2/file2"), cta::RemoteFileStatus(cta::common::dataStructures::UserIdentity("user0", "group0"), 0744, 12345678))); cta::common::dataStructures::EntryLog el; - el.user = cta::common::dataStructures::UserIdentity("user0", "group0"); + el.username = "user0"; el.host = "testHost"; el.time = now = time(NULL); atfr.setEntryLog(el); @@ -56,8 +56,7 @@ TEST(ObjectStore, ArchiveToFileRequestBasicAccess) { ASSERT_EQ("eos://dir2/file2", atfr.getRemoteFile().path.getRaw()); ASSERT_EQ(12345678, atfr.getRemoteFile().status.size); cta::objectstore::EntryLog log(atfr.getCreationLog()); - ASSERT_EQ("user0", log.user.name); - ASSERT_EQ("group0", log.user.group); + ASSERT_EQ("user0", log.username); ASSERT_EQ("testHost", log.host); ASSERT_EQ(now, log.time); } diff --git a/objectstore/BackendPopulator.cpp b/objectstore/BackendPopulator.cpp index 5c4a7fb223e619e6660f7c9fccff3bac0728a871..aa43b8b187a4317185b85dd7e4648032415cd25b 100644 --- a/objectstore/BackendPopulator.cpp +++ b/objectstore/BackendPopulator.cpp @@ -31,7 +31,7 @@ BackendPopulator::BackendPopulator(cta::objectstore::Backend & be): m_backend(be re.fetch(); m_agent.generateName("OStoreDBFactory"); m_agent.initialize(); - cta::objectstore::EntryLog cl(cta::common::dataStructures::UserIdentity("user0", "group0"), "systemhost", time(NULL)); + cta::objectstore::EntryLog cl("user0", "systemhost", time(NULL)); re.addOrGetAgentRegisterPointerAndCommit(m_agent,cl); rel.release(); m_agent.insertAndRegisterSelf(); diff --git a/objectstore/DriveRegister.cpp b/objectstore/DriveRegister.cpp index 423db080efeb85b08879638681ad391b7de2243d..ad2fd2bc3876313acaef38fc62aa51086795c88f 100644 --- a/objectstore/DriveRegister.cpp +++ b/objectstore/DriveRegister.cpp @@ -279,7 +279,7 @@ void cta::objectstore::DriveRegister::reportDriveStatus(const std::string& drive if (!alreadyInSessionStatuses.count((int)status)) { // TODO: the creation should be moved to another place to better logging // Explicitely by scheduler? To be decided. - EntryLog el(UserIdentity("name0","group0"), "", reportTime); + EntryLog el("name0", "", reportTime); addDrive(driveName, logicalLibary, el); } else { throw NoSuchDrive("In DriveRegister::reportDriveStatus(): No such drive"); diff --git a/objectstore/EntryLog.hpp b/objectstore/EntryLog.hpp index 49565eff48f1b0501a6725aedfe8275d07a02683..07e6aab9de7c2e16d71b467b529e1c6528fd2d94 100644 --- a/objectstore/EntryLog.hpp +++ b/objectstore/EntryLog.hpp @@ -34,8 +34,8 @@ class EntryLog: public cta::common::dataStructures::EntryLog { public: EntryLog (): cta::common::dataStructures::EntryLog() {} EntryLog (const cta::common::dataStructures::EntryLog & el): cta::common::dataStructures::EntryLog(el) {} - EntryLog (const cta::common::dataStructures::UserIdentity& u, const std::string & hn, uint64_t t): cta::common::dataStructures::EntryLog() { - user=u; + EntryLog (const std::string & un, const std::string & hn, uint64_t t): cta::common::dataStructures::EntryLog() { + username=un; host=hn; time=t; } @@ -43,14 +43,12 @@ public: return cta::common::dataStructures::EntryLog(*this); } void serialize (cta::objectstore::serializers::CreationLog & log) const { - log.mutable_user()->set_name(user.name); - log.mutable_user()->set_group(user.group); + log.set_username(username); log.set_host(host); log.set_time(time); } void deserialize (const cta::objectstore::serializers::CreationLog & log) { - user.name=log.user().name(); - user.group=log.user().group(); + username=log.username(); host = log.host(); time = log.time(); } diff --git a/objectstore/GarbageCollectorTest.cpp b/objectstore/GarbageCollectorTest.cpp index 491a8a71f8bb68b80f4999a9e660c2981e56d242..2e65d33a38ae1568a03ed31cb807fb7f817bd908 100644 --- a/objectstore/GarbageCollectorTest.cpp +++ b/objectstore/GarbageCollectorTest.cpp @@ -42,7 +42,7 @@ TEST(ObjectStore, GarbageCollectorBasicFuctionnality) { re.initialize(); re.insert(); // Create the agent register - cta::objectstore::EntryLog el(cta::common::dataStructures::UserIdentity("user0", "group0"), + cta::objectstore::EntryLog el("user0", "unittesthost", time(NULL)); cta::objectstore::ScopedExclusiveLock rel(re); re.addOrGetAgentRegisterPointerAndCommit(agent, el); @@ -90,7 +90,7 @@ TEST(ObjectStore, GarbageCollectorRegister) { re.initialize(); re.insert(); // Create the agent register - cta::objectstore::EntryLog el(cta::common::dataStructures::UserIdentity("user0", "group0"), + cta::objectstore::EntryLog el("user0", "unittesthost", time(NULL)); cta::objectstore::ScopedExclusiveLock rel(re); re.addOrGetAgentRegisterPointerAndCommit(agent, el); @@ -147,7 +147,7 @@ TEST(ObjectStore, GarbageCollectorArchiveQueue) { re.initialize(); re.insert(); // Create the agent register - cta::objectstore::EntryLog el(cta::common::dataStructures::UserIdentity("user0", "group0"), + cta::objectstore::EntryLog el("user0", "unittesthost", time(NULL)); cta::objectstore::ScopedExclusiveLock rel(re); re.addOrGetAgentRegisterPointerAndCommit(agent, el); @@ -204,7 +204,7 @@ TEST(ObjectStore, GarbageCollectorDriveRegister) { re.initialize(); re.insert(); // Create the agent register - cta::objectstore::EntryLog el(cta::common::dataStructures::UserIdentity("user0", "group0"), + cta::objectstore::EntryLog el("user0", "unittesthost", time(NULL)); cta::objectstore::ScopedExclusiveLock rel(re); re.addOrGetAgentRegisterPointerAndCommit(agent, el); @@ -261,7 +261,7 @@ TEST(ObjectStore, GarbageCollectorArchiveRequest) { re.initialize(); re.insert(); // Create the agent register - cta::objectstore::EntryLog el(cta::common::dataStructures::UserIdentity("user0", "group0"), + cta::objectstore::EntryLog el("user0", "unittesthost", time(NULL)); cta::objectstore::ScopedExclusiveLock rel(re); re.addOrGetAgentRegisterPointerAndCommit(agent, el); @@ -326,7 +326,7 @@ TEST(ObjectStore, GarbageCollectorArchiveRequest) { ar.setRequester(cta::common::dataStructures::UserIdentity("user0", "group0")); ar.setSrcURL("root://eoseos/myFile"); ar.setStorageClass("sc"); - ar.setCreationLog(cta::common::dataStructures::EntryLog(cta::common::dataStructures::UserIdentity("user0", "group0"), "host0", time(nullptr))); + ar.setCreationLog(cta::common::dataStructures::EntryLog("user0", "host0", time(nullptr))); ar.insert(); cta::objectstore::ScopedExclusiveLock atfrl(ar); if (pass < 2) { pass++; continue; } diff --git a/objectstore/RetrieveQueueTest.cpp b/objectstore/RetrieveQueueTest.cpp index d9a2caa6f8e1478e4bd6979e7fc46a2d27f88ba4..04daa65ac237aed60dc194805f2809cb791c2467 100644 --- a/objectstore/RetrieveQueueTest.cpp +++ b/objectstore/RetrieveQueueTest.cpp @@ -32,7 +32,7 @@ TEST(ObjectStore, RetrieveQueueBasicAccess) { // Try to create the tape entry cta::objectstore::RetrieveQueue rq(retrieveQueueAddress, be); cta::common::dataStructures::EntryLog el; - el.user=cta::common::dataStructures::UserIdentity("user0", "group0"); + el.username="user0"; el.host="unittesthost"; el.time=time(NULL); rq.initialize("V12345", "LIB0", el); diff --git a/objectstore/RetrieveRequest.cpp b/objectstore/RetrieveRequest.cpp index 21b9c0d58bb283ca1deb31e735081479c3ba456b..128447f7ce0f62794d5744f1a795ffbd8c6823a8 100644 --- a/objectstore/RetrieveRequest.cpp +++ b/objectstore/RetrieveRequest.cpp @@ -193,8 +193,7 @@ void cta::objectstore::RetrieveRequest::setCreationLog(const cta::common::dataSt auto payloadCreationLog = m_payload.mutable_creationlog(); payloadCreationLog->set_time(creationLog.time); payloadCreationLog->set_host(creationLog.host); - payloadCreationLog->set_name(creationLog.user.name); - payloadCreationLog->set_group(creationLog.user.group); + payloadCreationLog->set_username(creationLog.username); } //------------------------------------------------------------------------------ @@ -203,11 +202,8 @@ void cta::objectstore::RetrieveRequest::setCreationLog(const cta::common::dataSt cta::common::dataStructures::EntryLog cta::objectstore::RetrieveRequest::getCreationLog() { checkPayloadReadable(); cta::common::dataStructures::EntryLog creationLog; - cta::common::dataStructures::UserIdentity user; auto payloadCreationLog = m_payload.creationlog(); - user.name=payloadCreationLog.name(); - user.group=payloadCreationLog.group(); - creationLog.user=user; + creationLog.username=payloadCreationLog.username(); creationLog.host=payloadCreationLog.host(); creationLog.time=payloadCreationLog.time(); return creationLog; @@ -257,8 +253,7 @@ std::string cta::objectstore::RetrieveRequest::dump() { json_object * jaf = json_object_new_object(); json_object_object_add(jaf, "host", json_object_new_string(m_payload.creationlog().host().c_str())); json_object_object_add(jaf, "time", json_object_new_int64(m_payload.creationlog().time())); - json_object_object_add(jaf, "name", json_object_new_string(m_payload.creationlog().name().c_str())); - json_object_object_add(jaf, "group", json_object_new_string(m_payload.creationlog().group().c_str())); + json_object_object_add(jaf, "username", json_object_new_string(m_payload.creationlog().username().c_str())); json_object_object_add(jo, "creationlog", jaf); // Array for jobs json_object * jja = json_object_new_array(); diff --git a/objectstore/RootEntry.cpp b/objectstore/RootEntry.cpp index aa804e525d3b456852551dd57ea64d2d5aeb822b..d01e825ca696afc6f6f15910034c566228dbe426 100644 --- a/objectstore/RootEntry.cpp +++ b/objectstore/RootEntry.cpp @@ -478,8 +478,7 @@ std::string cta::objectstore::RootEntry::dump () { json_object_object_add(jlog, "host", json_object_new_string(m_payload.driveregisterpointer().log().host().c_str())); json_object_object_add(jlog, "time", json_object_new_int64(m_payload.driveregisterpointer().log().time())); json_object * id = json_object_new_object(); - json_object_object_add(id, "name", json_object_new_string(m_payload.driveregisterpointer().log().user().name().c_str())); - json_object_object_add(id, "group", json_object_new_string(m_payload.driveregisterpointer().log().user().group().c_str())); + json_object_object_add(id, "name", json_object_new_string(m_payload.driveregisterpointer().log().username().c_str())); json_object_object_add(jlog, "user", id); json_object_object_add(pointer, "log", jlog); json_object_object_add(jo, "driveregisterpointer", pointer); @@ -492,8 +491,7 @@ std::string cta::objectstore::RootEntry::dump () { json_object_object_add(jlog, "host", json_object_new_string(m_payload.agentregisterpointer().log().host().c_str())); json_object_object_add(jlog, "time", json_object_new_int64(m_payload.agentregisterpointer().log().time())); json_object * id = json_object_new_object(); - json_object_object_add(id, "name", json_object_new_string(m_payload.driveregisterpointer().log().user().name().c_str())); - json_object_object_add(id, "group", json_object_new_string(m_payload.driveregisterpointer().log().user().group().c_str())); + json_object_object_add(id, "name", json_object_new_string(m_payload.driveregisterpointer().log().username().c_str())); json_object_object_add(jlog, "user", id); json_object_object_add(pointer, "log", jlog); json_object_object_add(jo, "agentregisterpointer", pointer); @@ -506,8 +504,7 @@ std::string cta::objectstore::RootEntry::dump () { json_object_object_add(jlog, "host", json_object_new_string(m_payload.schedulerlockpointer().log().host().c_str())); json_object_object_add(jlog, "time", json_object_new_int64(m_payload.schedulerlockpointer().log().time())); json_object * id = json_object_new_object(); - json_object_object_add(id, "name", json_object_new_string(m_payload.driveregisterpointer().log().user().name().c_str())); - json_object_object_add(id, "group", json_object_new_string(m_payload.driveregisterpointer().log().user().group().c_str())); + json_object_object_add(id, "name", json_object_new_string(m_payload.driveregisterpointer().log().username().c_str())); json_object_object_add(jlog, "user", id); json_object_object_add(pointer, "log", jlog); json_object_object_add(jo, "schedulerlockpointer", pointer); diff --git a/objectstore/RootEntryTest.cpp b/objectstore/RootEntryTest.cpp index e0220737dda083f03e5817d42d6b4ccf88e46e4a..4df312b7879fdd6f61ce974063fd4cef4872e2ca 100644 --- a/objectstore/RootEntryTest.cpp +++ b/objectstore/RootEntryTest.cpp @@ -52,7 +52,7 @@ TEST(ObjectStore, RootEntryBasicAccess) { cta::objectstore::Agent agent(be); agent.generateName("unitTest"); re.fetch(); - cta::objectstore::EntryLog el(cta::common::dataStructures::UserIdentity("user0", "group0"), + cta::objectstore::EntryLog el("user0", "unittesthost", time(NULL)); re.addOrGetAgentRegisterPointerAndCommit(agent, el); ASSERT_NO_THROW(re.getAgentRegisterAddress()); @@ -70,7 +70,7 @@ TEST(ObjectStore, RootEntryBasicAccess) { TEST (ObjectStore, RootEntryArchiveQueues) { cta::objectstore::BackendVFS be; - cta::objectstore::EntryLog el(cta::common::dataStructures::UserIdentity("user0", "group0"), + cta::objectstore::EntryLog el("user0", "unittesthost", time(NULL)); cta::objectstore::Agent ag(be); ag.initialize(); @@ -136,7 +136,7 @@ TEST (ObjectStore, RootEntryDriveRegister) { re.initialize(); re.insert(); } - cta::objectstore::EntryLog el(cta::common::dataStructures::UserIdentity("user0", "group0"), + cta::objectstore::EntryLog el("user0", "unittesthost", time(NULL)); cta::objectstore::Agent ag(be); ag.initialize(); @@ -190,7 +190,7 @@ TEST(ObjectStore, RootEntryAgentRegister) { re.initialize(); re.insert(); } - cta::objectstore::EntryLog el(cta::common::dataStructures::UserIdentity("user0", "group0"), + cta::objectstore::EntryLog el("user0", "unittesthost", time(NULL)); cta::objectstore::Agent ag(be); ag.generateName("UnitTests"); @@ -237,7 +237,7 @@ TEST (ObjectStore, RootEntrySchedulerGlobalLock) { re.initialize(); re.insert(); } - cta::objectstore::EntryLog el(cta::common::dataStructures::UserIdentity("user0", "group0"), + cta::objectstore::EntryLog el("user0", "unittesthost", time(NULL)); cta::objectstore::Agent ag(be); ag.initialize(); diff --git a/objectstore/cta.proto b/objectstore/cta.proto index df2b4c9a433d28cfe64333c56c33205fb5e70c1e..0a63a776b9c70f82519fb1e6b6f9af77b0dc6dea 100644 --- a/objectstore/cta.proto +++ b/objectstore/cta.proto @@ -88,7 +88,7 @@ message UserIdentity { // The creation log attached to each element message CreationLog { - required UserIdentity user = 20; + required string username = 20; required string host = 21; required uint64 time = 22; optional string comment = 23; @@ -342,8 +342,7 @@ message DRData { } message EntryLog { - required string name = 8950; - required string group = 8955; + required string username = 8950; required string host = 8960; required uint64 time = 8970; } diff --git a/objectstore/makeMinimalVFS.cpp b/objectstore/makeMinimalVFS.cpp index 2f19f0a70d3f4824eca788a173141ff2b1e42955..8cb3dc34f3330dde0a4a0ac8a657c911b38428e4 100644 --- a/objectstore/makeMinimalVFS.cpp +++ b/objectstore/makeMinimalVFS.cpp @@ -53,8 +53,7 @@ int main(int argc, char ** argv) { cta::objectstore::Agent ag(*be); ag.generateName("makeMinimalVFS"); ag.initialize(); - cta::objectstore::EntryLog el(cta::common::dataStructures::UserIdentity("user0", "group0"), - "systemhost", time(NULL)); + cta::objectstore::EntryLog el("user0", "systemhost", time(NULL)); re.addOrGetAgentRegisterPointerAndCommit(ag,el); rel.release(); ag.insertAndRegisterSelf(); diff --git a/scheduler/OStoreDB/OStoreDBFactory.hpp b/scheduler/OStoreDB/OStoreDBFactory.hpp index e7d1ca1bf9000f3de5dfaf04814957f5272534d4..844fb1b0ef95a5337d4818f4f93d6d3c3f49dfc5 100644 --- a/scheduler/OStoreDB/OStoreDBFactory.hpp +++ b/scheduler/OStoreDB/OStoreDBFactory.hpp @@ -117,8 +117,7 @@ m_OStoreDB(*m_backend), m_agent(*m_backend) { re.fetch(); m_agent.generateName("OStoreDBFactory"); m_agent.initialize(); - objectstore::EntryLog cl(cta::common::dataStructures::UserIdentity("user0", "group0"), "systemhost", - time(NULL)); + objectstore::EntryLog cl("user0", "systemhost", time(NULL)); re.addOrGetAgentRegisterPointerAndCommit(m_agent, cl); rel.release(); m_agent.insertAndRegisterSelf(); @@ -149,8 +148,7 @@ m_OStoreDB(*m_backend), m_agent(*m_backend) { re.fetch(); m_agent.generateName("OStoreDBFactory"); m_agent.initialize(); - objectstore::EntryLog cl(cta::common::dataStructures::UserIdentity("user0", "group0"), "systemhost", - time(NULL)); + objectstore::EntryLog cl("user0", "systemhost", time(NULL)); re.addOrGetAgentRegisterPointerAndCommit(m_agent, cl); rel.release(); m_agent.insertAndRegisterSelf(); diff --git a/scheduler/Scheduler.cpp b/scheduler/Scheduler.cpp index 0a2d07c8477887888d41b13bb2cdd2dd5f1357e4..d87bbfb4e1962b8c18f8dfc3ba27ee40ef239d87 100644 --- a/scheduler/Scheduler.cpp +++ b/scheduler/Scheduler.cpp @@ -65,7 +65,7 @@ void cta::Scheduler::queueRetrieve( const cta::common::dataStructures::SecurityIdentity &cliIdentity, const cta::common::dataStructures::RetrieveRequest &request) { const common::dataStructures::RetrieveFileQueueCriteria queueCriteria = - m_catalogue.prepareToRetrieveFile(request.archiveFileID, cliIdentity.user); + m_catalogue.prepareToRetrieveFile(request.archiveFileID, request.requester); m_db.queue(request, queueCriteria); } diff --git a/scheduler/SchedulerTest.cpp b/scheduler/SchedulerTest.cpp index 8f7c3ccb1e5ae34a9a7a150f55b6f4b7534772bd..d86b7b59c90ec7bdc2f76e9c0be9b7b292c6455c 100644 --- a/scheduler/SchedulerTest.cpp +++ b/scheduler/SchedulerTest.cpp @@ -129,12 +129,9 @@ TEST_P(SchedulerTest, DISABLED_archive_to_new_file) { catalogue::Catalogue &catalogue = getCatalogue(); Scheduler &scheduler = getScheduler(); - - cta::common::dataStructures::UserIdentity admin; - admin.name="admin1"; - admin.group="group1"; + cta::common::dataStructures::SecurityIdentity s_adminOnAdminHost; - s_adminOnAdminHost.user=admin; + s_adminOnAdminHost.username="admin1"; s_adminOnAdminHost.host="host1"; const std::string mountPolicyName = "mount_group"; @@ -186,7 +183,7 @@ TEST_P(SchedulerTest, DISABLED_archive_to_new_file) { ASSERT_EQ(userName, user.name); ASSERT_EQ(mountPolicyName, user.mountPolicy); ASSERT_EQ(userComment, user.comment); - ASSERT_EQ(s_adminOnAdminHost.user, user.creationLog.user); + ASSERT_EQ(s_adminOnAdminHost.username, user.creationLog.username); ASSERT_EQ(s_adminOnAdminHost.host, user.creationLog.host); ASSERT_EQ(user.creationLog, user.lastModificationLog); @@ -211,7 +208,7 @@ TEST_P(SchedulerTest, DISABLED_archive_to_new_file) { cta::common::dataStructures::EntryLog creationLog; creationLog.host="host2"; creationLog.time=0; - creationLog.user=admin; + creationLog.username="admin1"; cta::common::dataStructures::DRData drData; drData.drBlob="blob"; drData.drGroup="group2"; diff --git a/xroot_plugins/XrdCtaFile.cpp b/xroot_plugins/XrdCtaFile.cpp index 1c3f90889c97ffe825da4722771b513d9102045a..811600afc3cbc2c5321237b9db55f08eb6c73bf8 100644 --- a/xroot_plugins/XrdCtaFile.cpp +++ b/xroot_plugins/XrdCtaFile.cpp @@ -66,10 +66,8 @@ cta::common::dataStructures::SecurityIdentity XrdCtaFile::checkClient(const XrdS } } std::cout << "Request received from client. Username: " << client->name << " uid: " << pwd.pw_uid << " gid: " << pwd.pw_gid << std::endl; - cta::common::dataStructures::UserIdentity user; - user.name=client->name; - //user.group=client->grps; //seg faults - cliIdentity.user=user; + //client->grps; //seg faults + cliIdentity.username=client->name; cliIdentity.host=client->host; return cliIdentity; } @@ -415,12 +413,10 @@ std::string XrdCtaFile::formatResponse(const std::vector<std::vector<std::string // addLogInfoToResponseRow //------------------------------------------------------------------------------ void XrdCtaFile::addLogInfoToResponseRow(std::vector<std::string> &responseRow, const cta::common::dataStructures::EntryLog &creationLog, const cta::common::dataStructures::EntryLog &lastModificationLog) { - responseRow.push_back(creationLog.user.name); - responseRow.push_back(creationLog.user.group); + responseRow.push_back(creationLog.username); responseRow.push_back(creationLog.host); responseRow.push_back(timeToString(creationLog.time)); - responseRow.push_back(lastModificationLog.user.name); - responseRow.push_back(lastModificationLog.user.group); + responseRow.push_back(lastModificationLog.username); responseRow.push_back(lastModificationLog.host); responseRow.push_back(timeToString(lastModificationLog.time)); } @@ -443,20 +439,16 @@ uint64_t XrdCtaFile::stringParameterToUint64(const std::string ¶meterName, c //------------------------------------------------------------------------------ int XrdCtaFile::xCom_bootstrap(const std::vector<std::string> &tokens, const cta::common::dataStructures::SecurityIdentity &cliIdentity) { std::stringstream help; - help << tokens[0] << " bs/bootstrap --user/-u <user> --group/-g <group> --hostname/-h <host_name> --comment/-m <\"comment\">" << std::endl; - std::string user = getOptionValue(tokens, "-u", "--user", false); - std::string group = getOptionValue(tokens, "-g", "--group", false); + help << tokens[0] << " bs/bootstrap --username/-u <user_name> --hostname/-h <host_name> --comment/-m <\"comment\">" << std::endl; + std::string username = getOptionValue(tokens, "-u", "--username", false); std::string hostname = getOptionValue(tokens, "-h", "--hostname", false); std::string comment = getOptionValue(tokens, "-m", "--comment", false); - if(user.empty()||group.empty()||hostname.empty()||comment.empty()) { + if(username.empty()||hostname.empty()||comment.empty()) { m_data = help.str(); error.setErrInfo(EPERM, m_data.c_str()); return SFS_ERROR; } - cta::common::dataStructures::UserIdentity adminUser; - adminUser.name=user; - adminUser.group=group; - m_catalogue->createBootstrapAdminAndHostNoAuth(cliIdentity, adminUser, hostname, comment); + m_catalogue->createBootstrapAdminAndHostNoAuth(cliIdentity, username, hostname, comment); return SFS_OK; } @@ -466,21 +458,17 @@ int XrdCtaFile::xCom_bootstrap(const std::vector<std::string> &tokens, const cta int XrdCtaFile::xCom_admin(const std::vector<std::string> &tokens, const cta::common::dataStructures::SecurityIdentity &cliIdentity) { std::stringstream help; help << tokens[0] << " ad/admin add/ch/rm/ls:" << std::endl - << "\tadd --user/-u <user> --group/-g <group> --comment/-m <\"comment\">" << std::endl - << "\tch --user/-u <user> --group/-g <group> --comment/-m <\"comment\">" << std::endl - << "\trm --user/-u <user> --group/-g <group>" << std::endl + << "\tadd --username/-u <user_name> --comment/-m <\"comment\">" << std::endl + << "\tch --username/-u <user_name> --comment/-m <\"comment\">" << std::endl + << "\trm --username/-u <user_name>" << std::endl << "\tls [--header/-h]" << std::endl; if("add" == tokens[2] || "ch" == tokens[2] || "rm" == tokens[2]) { - std::string user = getOptionValue(tokens, "-u", "--user", false); - std::string group = getOptionValue(tokens, "-g", "--group", false); - if(user.empty()||group.empty()) { + std::string username = getOptionValue(tokens, "-u", "--username", false); + if(username.empty()) { m_data = help.str(); error.setErrInfo(EPERM, m_data.c_str()); return SFS_ERROR; } - cta::common::dataStructures::UserIdentity adminUser; - adminUser.name=user; - adminUser.group=group; if("add" == tokens[2] || "ch" == tokens[2]) { std::string comment = getOptionValue(tokens, "-m", "--comment", false); if(comment.empty()) { @@ -489,21 +477,21 @@ int XrdCtaFile::xCom_admin(const std::vector<std::string> &tokens, const cta::co return SFS_ERROR; } if("add" == tokens[2]) { //add - m_catalogue->createAdminUser(cliIdentity, adminUser, comment); + m_catalogue->createAdminUser(cliIdentity, username, comment); } else { //ch - m_catalogue->modifyAdminUserComment(cliIdentity, adminUser, comment); + m_catalogue->modifyAdminUserComment(cliIdentity, username, comment); } } else { //rm - m_catalogue->deleteAdminUser(adminUser); + m_catalogue->deleteAdminUser(username); } } else if("ls" == tokens[2]) { //ls std::list<cta::common::dataStructures::AdminUser> list= m_catalogue->getAdminUsers(); if(list.size()>0) { std::vector<std::vector<std::string>> responseTable; - std::vector<std::string> header = {"user","group","c.user","c.group","c.host","c.time","m.user","m.group","m.host","m.time","comment"}; + std::vector<std::string> header = {"user","c.user","c.host","c.time","m.user","m.host","m.time","comment"}; if(hasOption(tokens, "-h", "--header")) responseTable.push_back(header); for(auto it = list.cbegin(); it != list.cend(); it++) { std::vector<std::string> currentRow; @@ -563,7 +551,7 @@ int XrdCtaFile::xCom_adminhost(const std::vector<std::string> &tokens, const cta std::list<cta::common::dataStructures::AdminHost> list= m_catalogue->getAdminHosts(); if(list.size()>0) { std::vector<std::vector<std::string>> responseTable; - std::vector<std::string> header = {"hostname","c.name","c.group","c.host","c.time","m.name","m.group","m.host","m.time","comment"}; + std::vector<std::string> header = {"hostname","c.user","c.host","c.time","m.user","m.host","m.time","comment"}; if(hasOption(tokens, "-h", "--header")) responseTable.push_back(header); for(auto it = list.cbegin(); it != list.cend(); it++) { std::vector<std::string> currentRow; @@ -648,7 +636,7 @@ int XrdCtaFile::xCom_tapepool(const std::vector<std::string> &tokens, const cta: std::list<cta::common::dataStructures::TapePool> list= m_catalogue->getTapePools(); if(list.size()>0) { std::vector<std::vector<std::string>> responseTable; - std::vector<std::string> header = {"name","# partial tapes","encrypt","c.name","c.group","c.host","c.time","m.name","m.group","m.host","m.time","comment"}; + std::vector<std::string> header = {"name","# partial tapes","encrypt","c.user","c.host","c.time","m.user","m.host","m.time","comment"}; if(hasOption(tokens, "-h", "--header")) responseTable.push_back(header); for(auto it = list.cbegin(); it != list.cend(); it++) { std::vector<std::string> currentRow; @@ -722,7 +710,7 @@ int XrdCtaFile::xCom_archiveroute(const std::vector<std::string> &tokens, const std::list<cta::common::dataStructures::ArchiveRoute> list= m_catalogue->getArchiveRoutes(); if(list.size()>0) { std::vector<std::vector<std::string>> responseTable; - std::vector<std::string> header = {"storage class","copy number","tapepool","c.name","c.group","c.host","c.time","m.name","m.group","m.host","m.time","comment"}; + std::vector<std::string> header = {"storage class","copy number","tapepool","c.user","c.host","c.time","m.user","m.host","m.time","comment"}; if(hasOption(tokens, "-h", "--header")) responseTable.push_back(header); for(auto it = list.cbegin(); it != list.cend(); it++) { std::vector<std::string> currentRow; @@ -788,7 +776,7 @@ int XrdCtaFile::xCom_logicallibrary(const std::vector<std::string> &tokens, cons std::list<cta::common::dataStructures::LogicalLibrary> list= m_catalogue->getLogicalLibraries(); if(list.size()>0) { std::vector<std::vector<std::string>> responseTable; - std::vector<std::string> header = {"name","c.name","c.group","c.host","c.time","m.name","m.group","m.host","m.time","comment"}; + std::vector<std::string> header = {"name","c.user","c.host","c.time","m.user","m.host","m.time","comment"}; if(hasOption(tokens, "-h", "--header")) responseTable.push_back(header); for(auto it = list.cbegin(); it != list.cend(); it++) { std::vector<std::string> currentRow; @@ -954,7 +942,7 @@ int XrdCtaFile::xCom_tape(const std::vector<std::string> &tokens, const cta::com if(list.size()>0) { std::vector<std::vector<std::string>> responseTable; std::vector<std::string> header = {"vid","logical library","tapepool","encription key","capacity","occupancy","last fseq","busy","full","disabled","lpb","label drive","label time", - "last w drive","last w time","last r drive","last r time","c.name","c.group","c.host","c.time","m.name","m.group","m.host","m.time","comment"}; + "last w drive","last w time","last r drive","last r time","c.user","c.host","c.time","m.user","m.host","m.time","comment"}; if(hasOption(tokens, "-h", "--header")) responseTable.push_back(header); for(auto it = list.cbegin(); it != list.cend(); it++) { std::vector<std::string> currentRow; @@ -1042,7 +1030,7 @@ int XrdCtaFile::xCom_storageclass(const std::vector<std::string> &tokens, const std::list<cta::common::dataStructures::StorageClass> list= m_catalogue->getStorageClasses(); if(list.size()>0) { std::vector<std::vector<std::string>> responseTable; - std::vector<std::string> header = {"storage class","number of copies","c.name","c.group","c.host","c.time","m.name","m.group","m.host","m.time","comment"}; + std::vector<std::string> header = {"storage class","number of copies","c.user","c.host","c.time","m.user","m.host","m.time","comment"}; if(hasOption(tokens, "-h", "--header")) responseTable.push_back(header); for(auto it = list.cbegin(); it != list.cend(); it++) { std::vector<std::string> currentRow; @@ -1117,7 +1105,7 @@ int XrdCtaFile::xCom_user(const std::vector<std::string> &tokens, const cta::com std::list<cta::common::dataStructures::Requester> list= m_catalogue->getRequesters(); if(list.size()>0) { std::vector<std::vector<std::string>> responseTable; - std::vector<std::string> header = {"user","group","cta group","c.name","c.group","c.host","c.time","m.name","m.group","m.host","m.time","comment"}; + std::vector<std::string> header = {"user","group","cta group","c.user","c.host","c.time","m.user","m.host","m.time","comment"}; if(hasOption(tokens, "-h", "--header")) responseTable.push_back(header); for(auto it = list.cbegin(); it != list.cend(); it++) { std::vector<std::string> currentRow; @@ -1219,7 +1207,7 @@ int XrdCtaFile::xCom_mountpolicy(const std::vector<std::string> &tokens, const c std::list<cta::common::dataStructures::MountPolicy> list= m_catalogue->getMountPolicies(); if(list.size()>0) { std::vector<std::vector<std::string>> responseTable; - std::vector<std::string> header = {"cta group","a.priority","a.minFiles","a.minBytes","a.minAge","r.priority","r.minFiles","r.minBytes","r.minAge","MaxDrives","c.name","c.group","c.host","c.time","m.name","m.group","m.host","m.time","comment"}; + std::vector<std::string> header = {"cta group","a.priority","a.minFiles","a.minBytes","a.minAge","r.priority","r.minFiles","r.minBytes","r.minAge","MaxDrives","c.user","c.host","c.time","m.user","m.host","m.time","comment"}; if(hasOption(tokens, "-h", "--header")) responseTable.push_back(header); for(auto it = list.cbegin(); it != list.cend(); it++) { std::vector<std::string> currentRow; @@ -1348,7 +1336,7 @@ int XrdCtaFile::xCom_dedication(const std::vector<std::string> &tokens, const ct std::list<cta::common::dataStructures::Dedication> list= m_catalogue->getDedications(); if(list.size()>0) { std::vector<std::vector<std::string>> responseTable; - std::vector<std::string> header = {"drive","type","vid","tag","from","until","c.name","c.group","c.host","c.time","m.name","m.group","m.host","m.time","comment"}; + std::vector<std::string> header = {"drive","type","vid","tag","from","until","c.user","c.host","c.time","m.user","m.host","m.time","comment"}; if(hasOption(tokens, "-h", "--header")) responseTable.push_back(header); for(auto it = list.cbegin(); it != list.cend(); it++) { std::vector<std::string> currentRow; @@ -1450,7 +1438,7 @@ int XrdCtaFile::xCom_repack(const std::vector<std::string> &tokens, const cta::c } if(list.size()>0) { std::vector<std::vector<std::string>> responseTable; - std::vector<std::string> header = {"vid","files","size","type","tag","to retrieve","to archive","failed","archived","status","name","group","host","time"}; + std::vector<std::string> header = {"vid","files","size","type","tag","to retrieve","to archive","failed","archived","status","name","host","time"}; if(hasOption(tokens, "-h", "--header")) responseTable.push_back(header); for(auto it = list.cbegin(); it != list.cend(); it++) { std::string type_s; @@ -1476,8 +1464,7 @@ int XrdCtaFile::xCom_repack(const std::vector<std::string> &tokens, const cta::c currentRow.push_back(std::to_string((unsigned long long)it->filesFailed)); currentRow.push_back(std::to_string((unsigned long long)it->filesArchived)); currentRow.push_back(it->repackStatus); - currentRow.push_back(it->creationLog.user.name); - currentRow.push_back(it->creationLog.user.group); + currentRow.push_back(it->creationLog.username); currentRow.push_back(it->creationLog.host); currentRow.push_back(timeToString(it->creationLog.time)); responseTable.push_back(currentRow); @@ -1571,7 +1558,7 @@ int XrdCtaFile::xCom_verify(const std::vector<std::string> &tokens, const cta::c } if(list.size()>0) { std::vector<std::vector<std::string>> responseTable; - std::vector<std::string> header = {"vid","files","size","tag","to verify","failed","verified","status","name","group","host","time"}; + std::vector<std::string> header = {"vid","files","size","tag","to verify","failed","verified","status","name","host","time"}; if(hasOption(tokens, "-h", "--header")) responseTable.push_back(header); for(auto it = list.cbegin(); it != list.cend(); it++) { std::vector<std::string> currentRow; @@ -1583,8 +1570,7 @@ int XrdCtaFile::xCom_verify(const std::vector<std::string> &tokens, const cta::c currentRow.push_back(std::to_string((unsigned long long)it->filesFailed)); currentRow.push_back(std::to_string((unsigned long long)it->filesVerified)); currentRow.push_back(it->verifyStatus); - currentRow.push_back(it->creationLog.user.name); - currentRow.push_back(it->creationLog.user.group); + currentRow.push_back(it->creationLog.username); currentRow.push_back(it->creationLog.host); currentRow.push_back(timeToString(it->creationLog.time)); responseTable.push_back(currentRow);