From dff7c00a0c2c3fcb64efd611d70398d711ad861b Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Wed, 24 Jun 2009 00:04:28 +0200 Subject: NetworkUserBackend implementiert --- src/Common/Backends/CMakeLists.txt | 6 + src/Common/Backends/NetworkUserBackend.cpp | 203 +++++++++++++++++++++++++++ src/Common/Backends/NetworkUserBackend.h | 91 ++++++++++++ src/Common/CMakeLists.txt | 3 +- src/Common/Requests/CMakeLists.txt | 5 - src/Common/Requests/GroupListRequest.h | 38 ----- src/Common/Requests/GroupUserListRequest.cpp | 36 ----- src/Common/Requests/GroupUserListRequest.h | 44 ------ src/Common/Requests/UserGroupListRequest.cpp | 36 ----- src/Common/Requests/UserGroupListRequest.h | 44 ------ src/Common/Requests/UserInfoRequest.cpp | 36 ----- src/Common/Requests/UserInfoRequest.h | 44 ------ src/Common/Requests/UserListRequest.h | 38 ----- src/Common/UserBackend.h | 16 +-- src/Common/UserManager.cpp | 20 +-- src/Common/UserManager.h | 18 +-- 16 files changed, 329 insertions(+), 349 deletions(-) create mode 100644 src/Common/Backends/CMakeLists.txt create mode 100644 src/Common/Backends/NetworkUserBackend.cpp create mode 100644 src/Common/Backends/NetworkUserBackend.h delete mode 100644 src/Common/Requests/GroupListRequest.h delete mode 100644 src/Common/Requests/GroupUserListRequest.cpp delete mode 100644 src/Common/Requests/GroupUserListRequest.h delete mode 100644 src/Common/Requests/UserGroupListRequest.cpp delete mode 100644 src/Common/Requests/UserGroupListRequest.h delete mode 100644 src/Common/Requests/UserInfoRequest.cpp delete mode 100644 src/Common/Requests/UserInfoRequest.h delete mode 100644 src/Common/Requests/UserListRequest.h (limited to 'src/Common') diff --git a/src/Common/Backends/CMakeLists.txt b/src/Common/Backends/CMakeLists.txt new file mode 100644 index 0000000..4d9d30e --- /dev/null +++ b/src/Common/Backends/CMakeLists.txt @@ -0,0 +1,6 @@ +include_directories(${INCLUDES}) + +add_library(Backends STATIC + NetworkUserBackend.cpp NetworkUserBackend.h +) +target_link_libraries(Backends Common) diff --git a/src/Common/Backends/NetworkUserBackend.cpp b/src/Common/Backends/NetworkUserBackend.cpp new file mode 100644 index 0000000..81fc94a --- /dev/null +++ b/src/Common/Backends/NetworkUserBackend.cpp @@ -0,0 +1,203 @@ +/* + * NetworkUserBackend.cpp + * + * Copyright (C) 2009 Matthias Schiffer + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + +#include "NetworkUserBackend.h" +#include "../RequestManager.h" + +namespace Mad { +namespace Common { +namespace Backends { + +void NetworkUserBackend::IdUserRequest::sendRequest() { + Common::XmlPacket packet; + packet.setType(type); + packet.set(idType, id); + + sendPacket(packet); +} + +void NetworkUserBackend::NameUserRequest::sendRequest() { + Common::XmlPacket packet; + packet.setType(type); + packet.set("name", name); + + sendPacket(packet); +} + +boost::shared_ptr > NetworkUserBackend::getUserList() throw(Core::Exception) { + boost::shared_ptr request(new SimpleUserRequest(application, "ListUsers")); + application->getRequestManager()->sendRequest(connection, request); + request->wait(); + + std::pair, Core::Exception> result = request->getResult(); + if(!result.first || result.second) + throw result.second; + + boost::shared_ptr > userList(new std::map); + + const XmlPacket::List *users = result.first->getList("users"); + if(users) { + for(XmlPacket::List::const_iterator user = users->begin(); user != users->end(); ++user) { + UserInfo userInfo(user->get("uid"), user->get("username")); + userInfo.setGid(user->get("gid")); + userInfo.setFullName(user->get("fullName")); + + userList->insert(std::make_pair(userInfo.getUid(), userInfo)); + } + } + + return userList; +} + +boost::shared_ptr NetworkUserBackend::getUserInfo(unsigned long uid) throw(Core::Exception) { + boost::shared_ptr request(new IdUserRequest(application, "GetUserInfo", "uid", uid)); + application->getRequestManager()->sendRequest(connection, request); + request->wait(); + + std::pair, Core::Exception> result = request->getResult(); + if(!result.first || result.second) + throw result.second; + + boost::shared_ptr userInfo(new UserInfo(result.first->get("uid"), result.first->get("username"))); + userInfo->setGid(result.first->get("gid")); + userInfo->setFullName(result.first->get("fullName")); + + return userInfo; +} + +boost::shared_ptr NetworkUserBackend::getUserInfoByName(const std::string &name) throw(Core::Exception) { + boost::shared_ptr request(new NameUserRequest(application, "GetUserInfo", name)); + application->getRequestManager()->sendRequest(connection, request); + request->wait(); + + std::pair, Core::Exception> result = request->getResult(); + if(!result.first || result.second) + throw result.second; + + boost::shared_ptr userInfo(new UserInfo(result.first->get("uid"), result.first->get("username"))); + userInfo->setGid(result.first->get("gid")); + userInfo->setFullName(result.first->get("fullName")); + + return userInfo; +} + +boost::shared_ptr > NetworkUserBackend::getUserGroupList(unsigned long uid) throw(Core::Exception) { + boost::shared_ptr request(new IdUserRequest(application, "ListUserGroups", "uid", uid)); + application->getRequestManager()->sendRequest(connection, request); + request->wait(); + + std::pair, Core::Exception> result = request->getResult(); + if(!result.first || result.second) + throw result.second; + + boost::shared_ptr > groupList(new std::set); + + const XmlPacket::List *groups = result.first->getList("groups"); + if(groups) { + for(XmlPacket::List::const_iterator group = groups->begin(); group != groups->end(); ++group) + groupList->insert(group->get("gid")); + } + + return groupList; +} + +boost::shared_ptr > NetworkUserBackend::getGroupList() throw(Core::Exception) { + boost::shared_ptr request(new SimpleUserRequest(application, "ListGroups")); + application->getRequestManager()->sendRequest(connection, request); + request->wait(); + + std::pair, Core::Exception> result = request->getResult(); + if(!result.first || result.second) + throw result.second; + + boost::shared_ptr > groupList(new std::map); + + const XmlPacket::List *groups = result.first->getList("groups"); + if(groups) { + for(XmlPacket::List::const_iterator group = groups->begin(); group != groups->end(); ++group) { + GroupInfo groupInfo(group->get("gid"), group->get("name")); + groupList->insert(std::make_pair(groupInfo.getGid(), groupInfo)); + } + } + + return groupList; +} + +boost::shared_ptr NetworkUserBackend::getGroupInfo(unsigned long gid) throw(Core::Exception) { + boost::shared_ptr request(new IdUserRequest(application, "GetGroupInfo", "gid", gid)); + application->getRequestManager()->sendRequest(connection, request); + request->wait(); + + std::pair, Core::Exception> result = request->getResult(); + if(!result.first || result.second) + throw result.second; + + boost::shared_ptr groupInfo(new GroupInfo(result.first->get("gid"), result.first->get("name"))); + + return groupInfo; +} + +boost::shared_ptr NetworkUserBackend::getGroupInfoByName(const std::string &name) throw(Core::Exception) { + boost::shared_ptr request(new NameUserRequest(application, "GetGroupInfo", name)); + application->getRequestManager()->sendRequest(connection, request); + request->wait(); + + std::pair, Core::Exception> result = request->getResult(); + if(!result.first || result.second) + throw result.second; + + boost::shared_ptr groupInfo(new GroupInfo(result.first->get("gid"), result.first->get("name"))); + + return groupInfo; +} + +boost::shared_ptr > NetworkUserBackend::getGroupUserList(unsigned long gid) throw(Core::Exception) { + boost::shared_ptr request(new IdUserRequest(application, "ListGroupUsers", "gid", gid)); + application->getRequestManager()->sendRequest(connection, request); + request->wait(); + + std::pair, Core::Exception> result = request->getResult(); + if(!result.first || result.second) + throw result.second; + + boost::shared_ptr > userList(new std::set); + + const XmlPacket::List *users = result.first->getList("users"); + if(users) { + for(XmlPacket::List::const_iterator user = users->begin(); user != users->end(); ++user) { + userList->insert(user->get("uid")); + } + } + + return userList; +} + + +/*void NetworkUserBackend::setPassword(unsigned long uid, const std::string &password) throw(Core::Exception) { + +}*/ + + +/*void NetworkUserBackend::addUser(const UserInfo &userInfo) throw(Core::Exception) { + +}*/ + +} +} +} diff --git a/src/Common/Backends/NetworkUserBackend.h b/src/Common/Backends/NetworkUserBackend.h new file mode 100644 index 0000000..c569ab6 --- /dev/null +++ b/src/Common/Backends/NetworkUserBackend.h @@ -0,0 +1,91 @@ +/* + * NetworkUserBackend.h + * + * Copyright (C) 2009 Matthias Schiffer + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + +#ifndef MAD_COMMON_BACKENDS_NETWORKUSERBACKEND_H_ +#define MAD_COMMON_BACKENDS_NETWORKUSERBACKEND_H_ + +#include "../UserBackend.h" +#include "../Requests/SimpleRequest.h" + +namespace Mad { +namespace Common { +namespace Backends { + +class NetworkUserBackend : public UserBackend { + private: + class SimpleUserRequest : public Requests::SimpleRequest { + public: + SimpleUserRequest(Application *application, const std::string &type) : SimpleRequest(application, type) {} + }; + + class IdUserRequest : public Request { + private: + std::string type; + std::string idType; + unsigned long id; + + + protected: + virtual void sendRequest(); + + public: + IdUserRequest(Application *application, const std::string &type0, const std::string &idType0, unsigned long id0) + : Request(application), type(type0), idType(idType0), id(id0) {} + }; + + class NameUserRequest : public Request { + private: + std::string type; + std::string name; + + + protected: + virtual void sendRequest(); + + public: + NameUserRequest(Application *application, const std::string &type0, const std::string &name0) + : Request(application), type(type0), name(name0) {} + }; + + Application *application; + Connection *connection; + + protected: + virtual boost::shared_ptr > getUserList() throw(Core::Exception); + virtual boost::shared_ptr getUserInfo(unsigned long uid) throw(Core::Exception); + virtual boost::shared_ptr getUserInfoByName(const std::string &name) throw(Core::Exception); + virtual boost::shared_ptr > getUserGroupList(unsigned long uid) throw(Core::Exception); + + virtual boost::shared_ptr > getGroupList() throw(Core::Exception); + virtual boost::shared_ptr getGroupInfo(unsigned long gid) throw(Core::Exception); + virtual boost::shared_ptr getGroupInfoByName(const std::string &name) throw(Core::Exception); + virtual boost::shared_ptr > getGroupUserList(unsigned long gid) throw(Core::Exception); + + //virtual void setPassword(unsigned long uid, const std::string &password) throw(Core::Exception); + //virtual void addUser(const UserInfo &userInfo) throw(Core::Exception); + + public: + NetworkUserBackend(Application *application0, Connection *connection0) : application(application0), connection(connection0) {} +}; + +} +} +} + +#endif /* MAD_COMMON_BACKENDS_NETWORKUSERBACKEND_H_ */ diff --git a/src/Common/CMakeLists.txt b/src/Common/CMakeLists.txt index 3ec77c4..7201ed5 100644 --- a/src/Common/CMakeLists.txt +++ b/src/Common/CMakeLists.txt @@ -1,3 +1,4 @@ +add_subdirectory(Backends) add_subdirectory(RequestHandlers) add_subdirectory(Requests) @@ -25,4 +26,4 @@ add_library(Common UserManager.cpp UserManager.h XmlPacket.cpp XmlPacket.h ) -target_link_libraries(Common RequestHandlers Requests Net ${LIBXML2_LIBRARIES} ${LTDL_LIBRARIES}) +target_link_libraries(Common Backends RequestHandlers Requests Net ${LIBXML2_LIBRARIES} ${LTDL_LIBRARIES}) diff --git a/src/Common/Requests/CMakeLists.txt b/src/Common/Requests/CMakeLists.txt index b6ff90c..d80b0fa 100644 --- a/src/Common/Requests/CMakeLists.txt +++ b/src/Common/Requests/CMakeLists.txt @@ -3,13 +3,8 @@ include_directories(${INCLUDES}) add_library(Requests STATIC DisconnectRequest.cpp DisconnectRequest.h FSInfoRequest.h - GroupListRequest.h - GroupUserListRequest.cpp GroupUserListRequest.h IdentifyRequest.cpp IdentifyRequest.h SimpleRequest.cpp SimpleRequest.h StatusRequest.h - UserGroupListRequest.cpp UserGroupListRequest.h - UserInfoRequest.cpp UserInfoRequest.h - UserListRequest.h ) target_link_libraries(Requests ${KRB5_LIBRARIES}) diff --git a/src/Common/Requests/GroupListRequest.h b/src/Common/Requests/GroupListRequest.h deleted file mode 100644 index f8760ca..0000000 --- a/src/Common/Requests/GroupListRequest.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * GroupListRequest.h - * - * Copyright (C) 2009 Matthias Schiffer - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see . - */ - -#ifndef MAD_COMMON_REQUESTS_GROUPLISTREQUEST_H_ -#define MAD_COMMON_REQUESTS_GROUPLISTREQUEST_H_ - -#include "SimpleRequest.h" - -namespace Mad { -namespace Common { -namespace Requests { - -class GroupListRequest : public SimpleRequest { - public: - GroupListRequest(Application *application) : SimpleRequest(application, "ListGroups") {} -}; - -} -} -} - -#endif /* MAD_COMMON_REQUESTS_GROUPLISTREQUEST_H_ */ diff --git a/src/Common/Requests/GroupUserListRequest.cpp b/src/Common/Requests/GroupUserListRequest.cpp deleted file mode 100644 index 87ab1b5..0000000 --- a/src/Common/Requests/GroupUserListRequest.cpp +++ /dev/null @@ -1,36 +0,0 @@ -/* - * GroupUserListRequest.cpp - * - * Copyright (C) 2008 Matthias Schiffer - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see . - */ - -#include "GroupUserListRequest.h" - -namespace Mad { -namespace Common { -namespace Requests { - -void GroupUserListRequest::sendRequest() { - Common::XmlPacket packet; - packet.setType("ListGroupUsers"); - packet.set("gid", gid); - - sendPacket(packet); -} - -} -} -} diff --git a/src/Common/Requests/GroupUserListRequest.h b/src/Common/Requests/GroupUserListRequest.h deleted file mode 100644 index f95cd3b..0000000 --- a/src/Common/Requests/GroupUserListRequest.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * GroupUserListRequest.h - * - * Copyright (C) 2009 Matthias Schiffer - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see . - */ - -#ifndef MAD_COMMON_REQUESTS_GROUPUSERLISTREQUEST_H_ -#define MAD_COMMON_REQUESTS_GROUPUSERLISTREQUEST_H_ - -#include "../Request.h" - -namespace Mad { -namespace Common { -namespace Requests { - -class GroupUserListRequest : public Request { - private: - unsigned long gid; - - protected: - virtual void sendRequest(); - - public: - GroupUserListRequest(Application *application, unsigned long gid0) : Request(application), gid(gid0) {} -}; - -} -} -} - -#endif /* MAD_COMMON_REQUESTS_GROUPUSERLISTREQUEST_H_ */ diff --git a/src/Common/Requests/UserGroupListRequest.cpp b/src/Common/Requests/UserGroupListRequest.cpp deleted file mode 100644 index 0c1a72f..0000000 --- a/src/Common/Requests/UserGroupListRequest.cpp +++ /dev/null @@ -1,36 +0,0 @@ -/* - * UserGroupListRequest.cpp - * - * Copyright (C) 2008 Matthias Schiffer - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see . - */ - -#include "UserGroupListRequest.h" - -namespace Mad { -namespace Common { -namespace Requests { - -void UserGroupListRequest::sendRequest() { - Common::XmlPacket packet; - packet.setType("ListUserGroups"); - packet.set("uid", uid); - - sendPacket(packet); -} - -} -} -} diff --git a/src/Common/Requests/UserGroupListRequest.h b/src/Common/Requests/UserGroupListRequest.h deleted file mode 100644 index 4cd27b6..0000000 --- a/src/Common/Requests/UserGroupListRequest.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * UserGroupListRequest.h - * - * Copyright (C) 2009 Matthias Schiffer - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see . - */ - -#ifndef MAD_COMMON_REQUESTS_USERGROUPLISTREQUEST_H_ -#define MAD_COMMON_REQUESTS_USERGROUPLISTREQUEST_H_ - -#include "../Request.h" - -namespace Mad { -namespace Common { -namespace Requests { - -class UserGroupListRequest : public Request { - private: - unsigned long uid; - - protected: - virtual void sendRequest(); - - public: - UserGroupListRequest(Application *application, unsigned long uid0) : Request(application), uid(uid0) {} -}; - -} -} -} - -#endif /* MAD_COMMON_REQUESTS_USERGROUPLISTREQUEST_H_ */ diff --git a/src/Common/Requests/UserInfoRequest.cpp b/src/Common/Requests/UserInfoRequest.cpp deleted file mode 100644 index b4b6940..0000000 --- a/src/Common/Requests/UserInfoRequest.cpp +++ /dev/null @@ -1,36 +0,0 @@ -/* - * UserInfoRequest.cpp - * - * Copyright (C) 2008 Matthias Schiffer - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see . - */ - -#include "UserInfoRequest.h" - -namespace Mad { -namespace Common { -namespace Requests { - -void UserInfoRequest::sendRequest() { - Common::XmlPacket packet; - packet.setType("GetUserInfo"); - packet.set("uid", uid); - - sendPacket(packet); -} - -} -} -} diff --git a/src/Common/Requests/UserInfoRequest.h b/src/Common/Requests/UserInfoRequest.h deleted file mode 100644 index 7b4b2fc..0000000 --- a/src/Common/Requests/UserInfoRequest.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * UserInfoRequest.h - * - * Copyright (C) 2008 Matthias Schiffer - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see . - */ - -#ifndef MAD_COMMON_REQUESTS_USERINFOREQUEST_H_ -#define MAD_COMMON_REQUESTS_USERINFOREQUEST_H_ - -#include "../Request.h" - -namespace Mad { -namespace Common { -namespace Requests { - -class UserInfoRequest : public Request { - private: - unsigned long uid; - - protected: - virtual void sendRequest(); - - public: - UserInfoRequest(Application *application, unsigned long uid0) : Request(application), uid(uid0) {} -}; - -} -} -} - -#endif /* MAD_COMMON_REQUESTS_USERINFOREQUEST_H_ */ diff --git a/src/Common/Requests/UserListRequest.h b/src/Common/Requests/UserListRequest.h deleted file mode 100644 index 9196166..0000000 --- a/src/Common/Requests/UserListRequest.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * UserListRequest.h - * - * Copyright (C) 2009 Matthias Schiffer - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see . - */ - -#ifndef MAD_COMMON_REQUESTS_USERLISTREQUEST_H_ -#define MAD_COMMON_REQUESTS_USERLISTREQUEST_H_ - -#include "SimpleRequest.h" - -namespace Mad { -namespace Common { -namespace Requests { - -class UserListRequest : public SimpleRequest { - public: - UserListRequest(Application *application) : SimpleRequest(application, "ListUsers") {} -}; - -} -} -} - -#endif /* MAD_COMMON_REQUESTS_USERLISTREQUEST_H_ */ diff --git a/src/Common/UserBackend.h b/src/Common/UserBackend.h index 16db16c..8375551 100644 --- a/src/Common/UserBackend.h +++ b/src/Common/UserBackend.h @@ -45,36 +45,36 @@ class UserBackend { UserBackend() {} - virtual boost::shared_ptr > getUserList() throw(Core::Exception) { + virtual boost::shared_ptr > getUserList() throw(Core::Exception) { throw(Core::Exception(Core::Exception::NOT_IMPLEMENTED)); } - virtual boost::shared_ptr getUserInfo(unsigned long uid _UNUSED_PARAMETER_) throw(Core::Exception) { + virtual boost::shared_ptr getUserInfo(unsigned long uid _UNUSED_PARAMETER_) throw(Core::Exception) { throw(Core::Exception(Core::Exception::NOT_IMPLEMENTED)); } - virtual boost::shared_ptr getUserInfoByName(const std::string &name _UNUSED_PARAMETER_) throw(Core::Exception) { + virtual boost::shared_ptr getUserInfoByName(const std::string &name _UNUSED_PARAMETER_) throw(Core::Exception) { throw(Core::Exception(Core::Exception::NOT_IMPLEMENTED)); } - virtual boost::shared_ptr > getUserGroupList(unsigned long uid _UNUSED_PARAMETER_) throw(Core::Exception) { + virtual boost::shared_ptr > getUserGroupList(unsigned long uid _UNUSED_PARAMETER_) throw(Core::Exception) { throw(Core::Exception(Core::Exception::NOT_IMPLEMENTED)); } - virtual boost::shared_ptr > getGroupList() throw(Core::Exception) { + virtual boost::shared_ptr > getGroupList() throw(Core::Exception) { throw(Core::Exception(Core::Exception::NOT_IMPLEMENTED)); } - virtual std::string getGroupName(unsigned long gid _UNUSED_PARAMETER_) throw(Core::Exception) { + virtual boost::shared_ptr getGroupInfo(unsigned long gid _UNUSED_PARAMETER_) throw(Core::Exception) { throw(Core::Exception(Core::Exception::NOT_IMPLEMENTED)); } - virtual unsigned long getGroupId(const std::string &name _UNUSED_PARAMETER_) throw(Core::Exception) { + virtual boost::shared_ptr getGroupInfoByName(const std::string &name _UNUSED_PARAMETER_) throw(Core::Exception) { throw(Core::Exception(Core::Exception::NOT_IMPLEMENTED)); } - virtual boost::shared_ptr > getGroupUserList(unsigned long gid _UNUSED_PARAMETER_) throw(Core::Exception) { + virtual boost::shared_ptr > getGroupUserList(unsigned long gid _UNUSED_PARAMETER_) throw(Core::Exception) { throw(Core::Exception(Core::Exception::NOT_IMPLEMENTED)); } diff --git a/src/Common/UserManager.cpp b/src/Common/UserManager.cpp index 6f5f548..66cbbf4 100644 --- a/src/Common/UserManager.cpp +++ b/src/Common/UserManager.cpp @@ -31,7 +31,7 @@ bool UserManager::Compare::operator() (boost::shared_ptr b1, boost: } -boost::shared_ptr > UserManager::getUserList() throw(Core::Exception) { +boost::shared_ptr > UserManager::getUserList() throw(Core::Exception) { Core::Exception e(Core::Exception::NOT_IMPLEMENTED); for(std::set >::iterator backend = backends.begin(); backend != backends.end(); ++backend) { @@ -47,7 +47,7 @@ boost::shared_ptr > UserManager::getUserList() throw e; } -boost::shared_ptr UserManager::getUserInfo(unsigned long uid) throw(Core::Exception) { +boost::shared_ptr UserManager::getUserInfo(unsigned long uid) throw(Core::Exception) { Core::Exception e(Core::Exception::NOT_IMPLEMENTED); for(std::set >::iterator backend = backends.begin(); backend != backends.end(); ++backend) { @@ -63,7 +63,7 @@ boost::shared_ptr UserManager::getUserInfo(unsigned long uid) throw(Co throw e; } -boost::shared_ptr UserManager::getUserInfoByName(const std::string &name) throw(Core::Exception) { +boost::shared_ptr UserManager::getUserInfoByName(const std::string &name) throw(Core::Exception) { Core::Exception e(Core::Exception::NOT_IMPLEMENTED); for(std::set >::iterator backend = backends.begin(); backend != backends.end(); ++backend) { @@ -79,7 +79,7 @@ boost::shared_ptr UserManager::getUserInfoByName(const std::string &na throw e; } -boost::shared_ptr > UserManager::getUserGroupList(unsigned long uid) throw(Core::Exception) { +boost::shared_ptr > UserManager::getUserGroupList(unsigned long uid) throw(Core::Exception) { Core::Exception e(Core::Exception::NOT_IMPLEMENTED); for(std::set >::iterator backend = backends.begin(); backend != backends.end(); ++backend) { @@ -95,7 +95,7 @@ boost::shared_ptr > UserManager::getUserGroupList(unsign throw e; } -boost::shared_ptr > UserManager::getGroupList() throw(Core::Exception) { +boost::shared_ptr > UserManager::getGroupList() throw(Core::Exception) { Core::Exception e(Core::Exception::NOT_IMPLEMENTED); for(std::set >::iterator backend = backends.begin(); backend != backends.end(); ++backend) { @@ -111,12 +111,12 @@ boost::shared_ptr > UserManager::getGroupList throw e; } -std::string UserManager::getGroupName(unsigned long gid) throw(Core::Exception) { +boost::shared_ptr UserManager::getGroupInfo(unsigned long gid) throw(Core::Exception) { Core::Exception e(Core::Exception::NOT_IMPLEMENTED); for(std::set >::iterator backend = backends.begin(); backend != backends.end(); ++backend) { try { - return (*backend)->getGroupName(gid); + return (*backend)->getGroupInfo(gid); } catch(Core::Exception e2) { if(e.getErrorCode() == Core::Exception::NOT_IMPLEMENTED && e2.getErrorCode() != Core::Exception::NOT_IMPLEMENTED) @@ -127,12 +127,12 @@ std::string UserManager::getGroupName(unsigned long gid) throw(Core::Exception) throw e; } -unsigned long UserManager::getGroupId(const std::string &name) throw(Core::Exception) { +boost::shared_ptr UserManager::getGroupInfoByName(const std::string &name) throw(Core::Exception) { Core::Exception e(Core::Exception::NOT_IMPLEMENTED); for(std::set >::iterator backend = backends.begin(); backend != backends.end(); ++backend) { try { - return (*backend)->getGroupId(name); + return (*backend)->getGroupInfoByName(name); } catch(Core::Exception e2) { if(e.getErrorCode() == Core::Exception::NOT_IMPLEMENTED && e2.getErrorCode() != Core::Exception::NOT_IMPLEMENTED) @@ -143,7 +143,7 @@ unsigned long UserManager::getGroupId(const std::string &name) throw(Core::Excep throw e; } -boost::shared_ptr > UserManager::getGroupUserList(unsigned long gid) throw(Core::Exception) { +boost::shared_ptr > UserManager::getGroupUserList(unsigned long gid) throw(Core::Exception) { Core::Exception e(Core::Exception::NOT_IMPLEMENTED); for(std::set >::iterator backend = backends.begin(); backend != backends.end(); ++backend) { diff --git a/src/Common/UserManager.h b/src/Common/UserManager.h index bdf39c1..215fde8 100644 --- a/src/Common/UserManager.h +++ b/src/Common/UserManager.h @@ -58,15 +58,15 @@ class UserManager : boost::noncopyable { backends.erase(backend); } - boost::shared_ptr > getUserList() throw(Core::Exception); - boost::shared_ptr getUserInfo(unsigned long uid) throw(Core::Exception); - boost::shared_ptr getUserInfoByName(const std::string &name) throw(Core::Exception); - boost::shared_ptr > getUserGroupList(unsigned long uid) throw(Core::Exception); - - boost::shared_ptr > getGroupList() throw(Core::Exception); - std::string getGroupName(unsigned long gid) throw(Core::Exception); - unsigned long getGroupId(const std::string &name) throw(Core::Exception); - boost::shared_ptr > getGroupUserList(unsigned long gid) throw(Core::Exception); + boost::shared_ptr > getUserList() throw(Core::Exception); + boost::shared_ptr getUserInfo(unsigned long uid) throw(Core::Exception); + boost::shared_ptr getUserInfoByName(const std::string &name) throw(Core::Exception); + boost::shared_ptr > getUserGroupList(unsigned long uid) throw(Core::Exception); + + boost::shared_ptr > getGroupList() throw(Core::Exception); + boost::shared_ptr getGroupInfo(unsigned long gid) throw(Core::Exception); + boost::shared_ptr getGroupInfoByName(const std::string &name) throw(Core::Exception); + boost::shared_ptr > getGroupUserList(unsigned long gid) throw(Core::Exception); void setPassword(unsigned long uid, const std::string &password) throw(Core::Exception); -- cgit v1.2.3