diff --git a/skeema/gradido_login/groups.sql b/skeema/gradido_login/groups.sql index 7d4c5a185..240c56ba5 100644 --- a/skeema/gradido_login/groups.sql +++ b/skeema/gradido_login/groups.sql @@ -3,6 +3,7 @@ CREATE TABLE `groups` ( `alias` varchar(190) NOT NULL, `name` varchar(255) NOT NULL, `url` varchar(255) NOT NULL, + `home` varchar(255) DEFAULT "/", `description` text, PRIMARY KEY (`id`), UNIQUE KEY `alias` (`alias`) diff --git a/src/cpp/controller/Group.cpp b/src/cpp/controller/Group.cpp index 4692c0f10..d033d37f1 100644 --- a/src/cpp/controller/Group.cpp +++ b/src/cpp/controller/Group.cpp @@ -13,9 +13,9 @@ namespace controller { } - Poco::AutoPtr Group::create(const std::string& alias, const std::string& name, const std::string& url, const std::string& description) + Poco::AutoPtr Group::create(const std::string& alias, const std::string& name, const std::string& url, const std::string& home, const std::string& description) { - auto db = new model::table::Group(alias, name, url, description); + auto db = new model::table::Group(alias, name, url, home, description); auto group = new Group(db); return Poco::AutoPtr(group); } @@ -57,7 +57,7 @@ namespace controller { auto session = cm->getConnection(CONNECTION_MYSQL_LOGIN_SERVER); Poco::Data::Statement select(session); - select << "SELECT id, alias, name, url, description FROM " << db->getTableName() + select << "SELECT id, alias, name, url, home, description FROM " << db->getTableName() , Poco::Data::Keywords::into(group_list); size_t resultCount = 0; diff --git a/src/cpp/controller/Group.h b/src/cpp/controller/Group.h index 8ebf883c2..a9b3ca55d 100644 --- a/src/cpp/controller/Group.h +++ b/src/cpp/controller/Group.h @@ -14,7 +14,7 @@ namespace controller { ~Group(); - static Poco::AutoPtr create(const std::string& alias, const std::string& name, const std::string& url, const std::string& description); + static Poco::AutoPtr create(const std::string& alias, const std::string& name, const std::string& url, const std::string& home, const std::string& description); static std::vector> load(const std::string& alias); static Poco::AutoPtr load(int id); diff --git a/src/cpp/model/table/Group.cpp b/src/cpp/model/table/Group.cpp index c1a84e832..a88847255 100644 --- a/src/cpp/model/table/Group.cpp +++ b/src/cpp/model/table/Group.cpp @@ -8,15 +8,15 @@ namespace model { { } - Group::Group(const std::string& alias, const std::string& name, const std::string& url, const std::string& description) - : mAlias(alias), mName(name), mUrl(url), mDescription(description) + Group::Group(const std::string& alias, const std::string& name, const std::string& url, const std::string& home, const std::string& description) + : mAlias(alias), mName(name), mUrl(url), mHome(home), mDescription(description) { } Group::Group(GroupTuple tuple) : ModelBase(tuple.get<0>()), - mAlias(tuple.get<1>()), mName(tuple.get<2>()), mUrl(tuple.get<3>()), mDescription(tuple.get<4>()) + mAlias(tuple.get<1>()), mName(tuple.get<2>()), mUrl(tuple.get<3>()), mHome(tuple.get<4>()), mDescription(tuple.get<5>()) { } @@ -32,6 +32,7 @@ namespace model { ss << "Alias: " << mAlias << std::endl; ss << "Name: " << mName << std::endl; ss << "Url: " << mUrl << std::endl; + ss << "Home: " << mHome << std::endl; ss << "Description:" << mDescription << std::endl; return ss.str(); } @@ -40,9 +41,9 @@ namespace model { { Poco::Data::Statement select(session); - select << "SELECT id, alias, name, url, description FROM " << getTableName() + select << "SELECT id, alias, name, url, home, description FROM " << getTableName() << " where " << fieldName << " = ?" - , into(mID), into(mAlias), into(mName), into(mUrl), into(mDescription); + , into(mID), into(mAlias), into(mName), into(mUrl), into(mHome), into(mDescription); return select; } @@ -51,7 +52,7 @@ namespace model { { Poco::Data::Statement select(session); - select << "SELECT id, alias, name, url, description FROM " << getTableName(); + select << "SELECT id, alias, name, url, home, description FROM " << getTableName(); return select; } @@ -60,7 +61,7 @@ namespace model { { Poco::Data::Statement select(session); // typedef Poco::Tuple, int> UserTuple; - select << "SELECT id, alias, name, url, description FROM " << getTableName() + select << "SELECT id, alias, name, url, home, description FROM " << getTableName() << " where " << fieldName << " LIKE ?"; return select; @@ -81,7 +82,7 @@ namespace model { Poco::Data::Statement insert(session); lock(); insert << "INSERT INTO " << getTableName() - << " (alias, name, url, description) VALUES(?,?,?,?)" + << " (alias, name, url, home, description) VALUES(?,?,?,?,?)" , use(mAlias), use(mName), use(mUrl), use(mDescription); unlock(); return insert; diff --git a/src/cpp/model/table/Group.h b/src/cpp/model/table/Group.h index df57cfc87..5feb8ba14 100644 --- a/src/cpp/model/table/Group.h +++ b/src/cpp/model/table/Group.h @@ -7,13 +7,13 @@ namespace model { namespace table { - typedef Poco::Tuple GroupTuple; + typedef Poco::Tuple GroupTuple; class Group : public ModelBase { public: Group(); - Group(const std::string& alias, const std::string& name, const std::string& url, const std::string& description); + Group(const std::string& alias, const std::string& name, const std::string& url, const std::string& home, const std::string& description); Group(GroupTuple userTuple); ~Group(); @@ -25,10 +25,12 @@ namespace model { inline const std::string& getName() const { std::shared_lock _lock(mSharedMutex); return mName; } inline const std::string& getDescription() const { std::shared_lock _lock(mSharedMutex); return mDescription; } inline const std::string& getUrl() const { std::shared_lock _lock(mSharedMutex); return mUrl; } + inline const std::string& getHome() const { SHARED_LOCK; return mHome; } inline void setName(const std::string& name) { std::unique_lock _lock(mSharedMutex); mName = name; } inline void setDescription(const std::string& desc) { std::unique_lock _lock(mSharedMutex); mDescription = desc; } inline void setUrl(const std::string& url) { std::unique_lock _lock(mSharedMutex); mUrl = url; } + inline void setHome(const std::string& home) { UNIQUE_LOCK; mHome = home; } protected: Poco::Data::Statement _loadFromDB(Poco::Data::Session session, const std::string& fieldName); @@ -40,6 +42,7 @@ namespace model { std::string mAlias; std::string mName; std::string mUrl; + std::string mHome; std::string mDescription; }; diff --git a/src/cpsp/adminGroups.cpsp b/src/cpsp/adminGroups.cpsp index 014591b74..d6afde1f0 100644 --- a/src/cpsp/adminGroups.cpsp +++ b/src/cpsp/adminGroups.cpsp @@ -23,6 +23,7 @@ alias, form.get("group-name", ""), form.get("group-url", ""), + form.get("group-home", ""), form.get("group-desc", "") ); newGroup->getModel()->insertIntoDB(false); @@ -47,6 +48,7 @@
Name
Alias
Url
+
Home
<%= gettext("Description") %>
<% for(auto it = groups.begin(); it != groups.end(); it++) { @@ -56,6 +58,7 @@
<%= group_model->getName() %>
<%= group_model->getAlias() %>
<%= group_model->getUrl() %>
+
<%= group_model->getHome() %>
<%= group_model->getDescription()%>
<% } %> @@ -72,6 +75,8 @@ + + ">