diff --git a/access/bible.cpp b/access/bible.cpp index 0c8d60d99..d7597f58b 100644 --- a/access/bible.cpp +++ b/access/bible.cpp @@ -31,7 +31,7 @@ namespace access_bible { // Returns true if the $user has read access to the $bible. // If no $user is given, it takes the currently logged-in user. -bool read (void * webserver_request, const string & bible, string user) +bool read (Webserver_Request& webserver_request, const string & bible, string user) { // Client: User has access to all Bibles. #ifdef HAVE_CLIENT @@ -42,17 +42,16 @@ bool read (void * webserver_request, const string & bible, string user) #endif #ifdef HAVE_CLOUD - Webserver_Request * request = static_cast(webserver_request); // Get the level, that is the role, of the given user. int role_level { 0 }; if (user.empty ()) { // Current user. - user = request->session_logic ()->currentUser (); - role_level = request->session_logic ()->currentLevel (); + user = webserver_request.session_logic ()->currentUser (); + role_level = webserver_request.session_logic ()->currentLevel (); } else { // Take level belonging to user. - role_level = request->database_users ()->get_level (user); + role_level = webserver_request.database_users ()->get_level (user); } // Managers and higher have read access. @@ -80,7 +79,7 @@ bool read (void * webserver_request, const string & bible, string user) // Returns true if the user has write access to the $bible. -bool write (void * webserver_request, const string & bible, string user) +bool write (Webserver_Request& webserver_request, const string & bible, string user) { #ifdef HAVE_CLIENT // Client: When not yet connected to the Cloud, the user has access to all Bibles. @@ -92,14 +91,13 @@ bool write (void * webserver_request, const string & bible, string user) #endif int level {0}; - Webserver_Request * request = static_cast(webserver_request); if (user.empty ()) { - user = request->session_logic ()->currentUser (); - level = request->session_logic ()->currentLevel (); + user = webserver_request.session_logic ()->currentUser (); + level = webserver_request.session_logic ()->currentLevel (); } if (level == 0) { // Take level belonging to user. - level = request->database_users ()->get_level (user); + level = webserver_request.database_users ()->get_level (user); } // Managers and higher always have write access. @@ -129,7 +127,7 @@ bool write (void * webserver_request, const string & bible, string user) // If no user is given, it takes the currently logged-in user. // If the user has read-only access to even one book of the $bible, // then the user is considered not to have write access to the entire $bible. -bool book_write (void * webserver_request, string user, const string & bible, int book) +bool book_write (Webserver_Request& webserver_request, string user, const string & bible, int book) { #ifdef HAVE_CLIENT // Client: When not yet connected to the Cloud, the user has access to the book. @@ -142,14 +140,13 @@ bool book_write (void * webserver_request, string user, const string & bible, in // Get the user level (role). int level {0}; - Webserver_Request * request = static_cast(webserver_request); if (user.empty ()) { - user = request->session_logic ()->currentUser (); - level = request->session_logic ()->currentLevel (); + user = webserver_request.session_logic ()->currentUser (); + level = webserver_request.session_logic ()->currentLevel (); } if (level == 0) { // Take level belonging to user. - level = request->database_users ()->get_level (user); + level = webserver_request.database_users ()->get_level (user); } // Managers and higher always have write access. @@ -179,10 +176,9 @@ bool book_write (void * webserver_request, string user, const string & bible, in // Returns an array of Bibles the user has read access to. // If no user is given, it takes the currently logged-in user. -vector bibles (void * webserver_request, string user) +vector bibles (Webserver_Request& webserver_request, string user) { - Webserver_Request * request = static_cast(webserver_request); - vector allbibles = request->database_bibles()->get_bibles (); + vector allbibles = webserver_request.database_bibles()->get_bibles (); vector bibles; for (auto & bible : allbibles) { if (read (webserver_request, bible, user)) { @@ -196,14 +192,13 @@ vector bibles (void * webserver_request, string user) // This function clamps bible. // It returns the $bible if the currently logged-in user has access to it. // Else it returns another accessible bible or nothing. -string clamp (void * webserver_request, string bible) +string clamp (Webserver_Request& webserver_request, string bible) { if (!read (webserver_request, bible)) { bible = string(); vector bibles = access_bible::bibles (webserver_request); if (!bibles.empty ()) bible = bibles [0]; - Webserver_Request * request = static_cast(webserver_request); - request->database_config_user ()->setBible (bible); + webserver_request.database_config_user ()->setBible (bible); } return bible; } @@ -212,12 +207,11 @@ string clamp (void * webserver_request, string bible) // This function checks whether the user in the $webserver_request // has $read or $write access to one or more Bibles. // It returns a tuple . -tuple any (void * webserver_request) +tuple any (Webserver_Request& webserver_request) { bool read {false}; bool write {false}; - Webserver_Request * request = static_cast(webserver_request); - vector bibles = request->database_bibles()->get_bibles (); + vector bibles = webserver_request.database_bibles()->get_bibles (); for (auto & bible : bibles) { if (access_bible::read (webserver_request, bible)) read = true; if (access_bible::write (webserver_request, bible)) write = true; diff --git a/access/bible.h b/access/bible.h index d69517f33..0b5dfecf4 100644 --- a/access/bible.h +++ b/access/bible.h @@ -21,13 +21,15 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. #include +class Webserver_Request; + namespace access_bible { -bool read (void * webserver_request, const std::string & bible, std::string user = std::string()); -bool write (void * webserver_request, const std::string & bible, std::string user = std::string()); -bool book_write (void * webserver_request, std::string user, const std::string & bible, int book); -std::vector bibles (void * webserver_request, std::string user = std::string()); -std::string clamp (void * webserver_request, std::string bible); -std::tuple any (void * webserver_request); +bool read (Webserver_Request& webserver_request, const std::string & bible, std::string user = std::string()); +bool write (Webserver_Request& webserver_request, const std::string & bible, std::string user = std::string()); +bool book_write (Webserver_Request& webserver_request, std::string user, const std::string & bible, int book); +std::vector bibles (Webserver_Request& webserver_request, std::string user = std::string()); +std::string clamp (Webserver_Request& webserver_request, std::string bible); +std::tuple any (Webserver_Request& webserver_request); } diff --git a/bb/book.cpp b/bb/book.cpp index aec01cd41..de187d4e8 100644 --- a/bb/book.cpp +++ b/bb/book.cpp @@ -68,7 +68,7 @@ std::string bible_book (Webserver_Request& webserver_request) std::string error_message {}; // The name of the Bible. - const std::string bible = access_bible::clamp (std::addressof(webserver_request), webserver_request.query["bible"]); + const std::string bible = access_bible::clamp (webserver_request, webserver_request.query["bible"]); view.set_variable ("bible", filter::strings::escape_special_xml_characters (bible)); // The book. @@ -78,7 +78,7 @@ std::string bible_book (Webserver_Request& webserver_request) view.set_variable ("book_name", filter::strings::escape_special_xml_characters (book_name)); // Whether the user has write access to this Bible book. - const bool write_access = access_bible::book_write (std::addressof(webserver_request), std::string(), bible, book); + const bool write_access = access_bible::book_write (webserver_request, std::string(), bible, book); if (write_access) view.enable_zone ("write_access"); // Delete chapter. diff --git a/bb/chapter.cpp b/bb/chapter.cpp index da52a7b45..f319c78c3 100644 --- a/bb/chapter.cpp +++ b/bb/chapter.cpp @@ -59,7 +59,7 @@ std::string bible_chapter (Webserver_Request& webserver_request) std::string error_message {}; // The name of the Bible. - const std::string bible = access_bible::clamp (std::addressof(webserver_request), webserver_request.query["bible"]); + const std::string bible = access_bible::clamp (webserver_request, webserver_request.query["bible"]); view.set_variable ("bible", filter::strings::escape_special_xml_characters (bible)); // The book. @@ -73,7 +73,7 @@ std::string bible_chapter (Webserver_Request& webserver_request) view.set_variable ("chapter", filter::strings::escape_special_xml_characters (chapter)); // Whether the user has write access to this Bible book. - if (bool write_access = access_bible::book_write (std::addressof(webserver_request), std::string(), bible, book); write_access) view.enable_zone ("write_access"); + if (bool write_access = access_bible::book_write (webserver_request, std::string(), bible, book); write_access) view.enable_zone ("write_access"); view.set_variable ("success_message", success_message); view.set_variable ("error_message", error_message); diff --git a/bb/css.cpp b/bb/css.cpp index b0fae7d68..c4ea80b7a 100644 --- a/bb/css.cpp +++ b/bb/css.cpp @@ -58,7 +58,7 @@ std::string bible_css (Webserver_Request& webserver_request) Assets_View view {}; // The name of the Bible. - const std::string bible = access_bible::clamp (std::addressof(webserver_request), webserver_request.query ["bible"]); + const std::string bible = access_bible::clamp (webserver_request, webserver_request.query ["bible"]); view.set_variable ("bible", filter::strings::escape_special_xml_characters (bible)); // Data submission. diff --git a/bb/import.cpp b/bb/import.cpp index aa59be48f..dbc321ae3 100644 --- a/bb/import.cpp +++ b/bb/import.cpp @@ -64,14 +64,14 @@ std::string bible_import (Webserver_Request& webserver_request) std::string error_message {}; // The name of the Bible. - const std::string bible = access_bible::clamp (std::addressof(webserver_request), webserver_request.query["bible"]); + const std::string bible = access_bible::clamp (webserver_request, webserver_request.query["bible"]); view.set_variable ("bible", filter::strings::escape_special_xml_characters (bible)); const int book = Ipc_Focus::getBook (std::addressof(webserver_request)); const int chapter = Ipc_Focus::getChapter (std::addressof(webserver_request)); // Whether the user has write access to this Bible. - if (bool write_access = access_bible::write (std::addressof(webserver_request), bible); write_access) { + if (bool write_access = access_bible::write (webserver_request, bible); write_access) { view.enable_zone ("write_access"); } diff --git a/bb/manage.cpp b/bb/manage.cpp index f5cb84927..971a8c9dd 100644 --- a/bb/manage.cpp +++ b/bb/manage.cpp @@ -92,7 +92,7 @@ std::string bible_manage (Webserver_Request& webserver_request) } else { webserver_request.database_bibles()->create_bible (bible); // Check / grant access. - if (!access_bible::write (std::addressof(webserver_request), bible)) { + if (!access_bible::write (webserver_request, bible)) { std::string me = webserver_request.session_logic()->currentUser (); DatabasePrivileges::set_bible (me, bible, true); } @@ -123,7 +123,7 @@ std::string bible_manage (Webserver_Request& webserver_request) error_message = translate("Cannot copy the Bible because the destination Bible already exists."); } else { // User needs read access to the original. - if (access_bible::read (std::addressof(webserver_request), origin)) { + if (access_bible::read (webserver_request, origin)) { // Copy the Bible data. const std::string origin_folder = webserver_request.database_bibles()->bible_folder (origin); const std::string destination_folder = webserver_request.database_bibles()->bible_folder (destination); @@ -133,7 +133,7 @@ std::string bible_manage (Webserver_Request& webserver_request) // Feedback. success_message = translate("The Bible was copied."); // Check / grant access to destination Bible. - if (!access_bible::write (std::addressof(webserver_request), destination)) { + if (!access_bible::write (webserver_request, destination)) { const std::string me = webserver_request.session_logic ()->currentUser (); DatabasePrivileges::set_bible (me, destination, true); } @@ -153,7 +153,7 @@ std::string bible_manage (Webserver_Request& webserver_request) const std::string confirm = webserver_request.query ["confirm"]; if (confirm == "yes") { // User needs write access for delete operation. - if (access_bible::write (std::addressof(webserver_request), bible)) { + if (access_bible::write (webserver_request, bible)) { bible_logic::delete_bible (bible); } else { page += assets_page::error ("Insufficient privileges to complete action"); @@ -169,7 +169,7 @@ std::string bible_manage (Webserver_Request& webserver_request) view.set_variable ("success_message", success_message); view.set_variable ("error_message", error_message); - const std::vector bibles = access_bible::bibles (std::addressof(webserver_request)); + const std::vector bibles = access_bible::bibles (webserver_request); pugi::xml_document document{}; for (const auto& bible : bibles) { pugi::xml_node li_node = document.append_child ("li"); diff --git a/bb/order.cpp b/bb/order.cpp index 11532fbe2..6c7858fba 100644 --- a/bb/order.cpp +++ b/bb/order.cpp @@ -56,7 +56,7 @@ std::string bible_order (Webserver_Request& webserver_request) Assets_View view {}; // The name of the Bible. - const std::string bible = access_bible::clamp (std::addressof(webserver_request), webserver_request.query ["bible"]); + const std::string bible = access_bible::clamp (webserver_request, webserver_request.query ["bible"]); view.set_variable ("bible", filter::strings::escape_special_xml_characters (bible)); // The order the user wants for the Bibles. diff --git a/bb/settings.cpp b/bb/settings.cpp index 2aa3ceece..946515b39 100644 --- a/bb/settings.cpp +++ b/bb/settings.cpp @@ -88,13 +88,13 @@ std::string bible_settings (Webserver_Request& webserver_request) // The Bible. std::string bible = webserver_request.query["bible"]; if (bible.empty()) bible = webserver_request.post ["val1"]; - bible = access_bible::clamp (std::addressof(webserver_request), bible); + bible = access_bible::clamp (webserver_request, bible); view.set_variable ("bible", filter::strings::escape_special_xml_characters (bible)); view.set_variable ("urlbible", filter_url_urlencode(filter::strings::escape_special_xml_characters (bible))); // Whether the user has write access to this Bible. - bool write_access = access_bible::write (std::addressof(webserver_request), bible); + bool write_access = access_bible::write (webserver_request, bible); if (write_access) view.enable_zone ("write_access"); diff --git a/changes/change.cpp b/changes/change.cpp index e33c77b3c..95142198f 100644 --- a/changes/change.cpp +++ b/changes/change.cpp @@ -120,7 +120,7 @@ string changes_change (Webserver_Request& webserver_request) // Bibles and passage. const Passage passage {database_modifications.getNotificationPassage (id)}; - const vector bibles {access_bible::bibles (std::addressof(webserver_request))}; + const vector bibles {access_bible::bibles (webserver_request)}; // Get notes for the passage. diff --git a/changes/modifications.cpp b/changes/modifications.cpp index 6a393854b..6d4e891e7 100644 --- a/changes/modifications.cpp +++ b/changes/modifications.cpp @@ -149,7 +149,7 @@ void changes_modifications () // Data objects. - Webserver_Request request {}; + Webserver_Request webserver_request {}; Database_Modifications database_modifications {}; @@ -161,9 +161,9 @@ void changes_modifications () // Get the users who will receive the changes entered by the named contributors. vector recipients_named_contributors; { - vector users = request.database_users ()->get_users (); + vector users = webserver_request.database_users ()->get_users (); for (const auto & user : users) { - if (request.database_config_user ()->getContributorChangesNotificationsOnline (user)) { + if (webserver_request.database_config_user ()->getContributorChangesNotificationsOnline (user)) { recipients_named_contributors.push_back (user); } } @@ -180,9 +180,9 @@ void changes_modifications () // Note: A user will always receive notificatons of changes made by that same user. map > notification_bibles_per_user {}; { - vector users = request.database_users ()->get_users (); + vector users = webserver_request.database_users ()->get_users (); for (const auto & user : users) { - vector bibles = request.database_config_user ()->getChangeNotificationsBiblesForUser (user); + vector bibles = webserver_request.database_config_user ()->getChangeNotificationsBiblesForUser (user); notification_bibles_per_user [user] = bibles; } } @@ -231,7 +231,7 @@ void changes_modifications () new_id = id_set.newid; if (restart) { - changes_process_identifiers (&request, user, recipients_named_contributors, bible, book, chapter, notification_bibles_per_user, reference_new_id, new_id, email, change_count, modification_time_total, modification_time_count); + changes_process_identifiers (&webserver_request, user, recipients_named_contributors, bible, book, chapter, notification_bibles_per_user, reference_new_id, new_id, email, change_count, modification_time_total, modification_time_count); reference_new_id = new_id; last_new_id = new_id; restart = false; @@ -246,7 +246,7 @@ void changes_modifications () } // Process the last set of identifiers. - changes_process_identifiers (&request, user, recipients_named_contributors, bible, book, chapter, notification_bibles_per_user, reference_new_id, new_id, email, change_count, modification_time_total, modification_time_count); + changes_process_identifiers (&webserver_request, user, recipients_named_contributors, bible, book, chapter, notification_bibles_per_user, reference_new_id, new_id, email, change_count, modification_time_total, modification_time_count); } } @@ -254,7 +254,7 @@ void changes_modifications () // Check whether there's any email to be sent. if (email.length () != empty_email_length) { // Send the user email with the user's personal changes if the user opted to receive it. - if (request.database_config_user()->getUserUserChangesNotification (user)) { + if (webserver_request.database_config_user()->getUserUserChangesNotification (user)) { string subject = translate("Changes you entered in") + " " + bible; if (!client_logic_client_enabled ()) email_schedule (user, subject, email); } @@ -269,7 +269,7 @@ void changes_modifications () // Clear checksum cache. - request.database_config_user ()->setUserChangeNotificationsChecksum (user, ""); + webserver_request.database_config_user ()->setUserChangeNotificationsChecksum (user, ""); } @@ -284,10 +284,10 @@ void changes_modifications () vector changeNotificationUsers; - vector all_users = request.database_users ()->get_users (); + vector all_users = webserver_request.database_users ()->get_users (); for (const auto & user : all_users) { - if (access_bible::read (&request, bible, user)) { - if (request.database_config_user()->getUserGenerateChangeNotifications (user)) { + if (access_bible::read (webserver_request, bible, user)) { + if (webserver_request.database_config_user()->getUserGenerateChangeNotifications (user)) { // The recipient may have set which Bibles to get the change notifications for. // This is stored like this: // container [user] = list of bibles. @@ -347,7 +347,7 @@ void changes_modifications () for (auto chapter : chapters) { Database_Logs::log ("Change notifications: " + bible + " " + filter_passage_display (book, chapter, ""), Filter_Roles::translator ()); string old_chapter_usfm = database_modifications.getTeamDiff (bible, book, chapter); - string new_chapter_usfm = request.database_bibles()->get_chapter (bible, book, chapter); + string new_chapter_usfm = webserver_request.database_bibles()->get_chapter (bible, book, chapter); vector old_verse_numbers = filter::usfm::get_verse_numbers (old_chapter_usfm); vector new_verse_numbers = filter::usfm::get_verse_numbers (new_chapter_usfm); vector verses = old_verse_numbers; @@ -429,10 +429,10 @@ void changes_modifications () if (bodies.size () > 1) { subject.append (" (" + filter::strings::convert_to_string (b + 1) + "/" + filter::strings::convert_to_string (bodies.size ()) + ")"); } - vector all_users_2 = request.database_users ()->get_users (); + vector all_users_2 = webserver_request.database_users ()->get_users (); for (auto & user : all_users_2) { - if (request.database_config_user()->getUserBibleChangesNotification (user)) { - if (access_bible::read (&request, bible, user)) { + if (webserver_request.database_config_user()->getUserBibleChangesNotification (user)) { + if (access_bible::read (webserver_request, bible, user)) { if (!client_logic_client_enabled ()) { email_schedule (user, subject, bodies[b]); } @@ -475,9 +475,9 @@ void changes_modifications () // Clear checksum caches. - users = request.database_users ()->get_users (); + users = webserver_request.database_users ()->get_users (); for (const auto & user : users) { - request.database_config_user ()->setUserChangeNotificationsChecksum (user, ""); + webserver_request.database_config_user ()->setUserChangeNotificationsChecksum (user, ""); } diff --git a/checks/index.cpp b/checks/index.cpp index 19dd505da..08e428009 100644 --- a/checks/index.cpp +++ b/checks/index.cpp @@ -79,7 +79,7 @@ std::string checks_index (Webserver_Request& webserver_request) { const std::vector & all_bibles = webserver_request.database_bibles()->get_bibles (); for (const auto& bible : all_bibles) { - if (access_bible::write (std::addressof(webserver_request), bible)) { + if (access_bible::write (webserver_request, bible)) { bibles.push_back (bible); } } diff --git a/checks/run.cpp b/checks/run.cpp index ccf5f183f..de1fbc4d8 100644 --- a/checks/run.cpp +++ b/checks/run.cpp @@ -51,7 +51,7 @@ using namespace std; void checks_run (string bible) { - Webserver_Request request {}; + Webserver_Request webserver_request {}; Database_Check database_check {}; #ifndef HAVE_CLIENT Database_Modifications database_modifications {}; @@ -117,19 +117,19 @@ void checks_run (string bible) bool check_valid_utf8_text = Database_Config_Bible::getCheckValidUTF8Text (bible); - vector books = request.database_bibles()->get_books (bible); + vector books = webserver_request.database_bibles()->get_books (bible); if (check_books_versification) checks_versification::books (bible, books); for (auto book : books) { - vector chapters = request.database_bibles()->get_chapters (bible, book); + vector chapters = webserver_request.database_bibles()->get_chapters (bible, book); if (check_chapters_verses_versification) checks_versification::chapters (bible, book, chapters); for (auto chapter : chapters) { - string chapterUsfm = request.database_bibles()->get_chapter (bible, book, chapter); + string chapterUsfm = webserver_request.database_bibles()->get_chapter (bible, book, chapter); // Transpose and fix spacing around certain markers in footnotes and cross references. @@ -138,11 +138,11 @@ void checks_run (string bible) bool transposed = checks::space::transpose_note_space (chapterUsfm); if (transposed) { #ifndef HAVE_CLIENT - int oldID = request.database_bibles()->get_chapter_id (bible, book, chapter); + int oldID = webserver_request.database_bibles()->get_chapter_id (bible, book, chapter); #endif - request.database_bibles()->store_chapter(bible, book, chapter, chapterUsfm); + webserver_request.database_bibles()->store_chapter(bible, book, chapter, chapterUsfm); #ifndef HAVE_CLIENT - int newID = request.database_bibles()->get_chapter_id (bible, book, chapter); + int newID = webserver_request.database_bibles()->get_chapter_id (bible, book, chapter); string username = "Bibledit"; database_modifications.recordUserSave (username, bible, book, chapter, oldID, old_usfm, newID, chapterUsfm); if (sendreceive_git_repository_linked (bible)) { @@ -277,10 +277,10 @@ void checks_run (string bible) if (!emailBody.empty ()) { string subject = translate("Bible Checks") + " " + bible; string body = filter::strings::implode (emailBody, "\n"); - vector users = request.database_users ()->get_users (); + vector users = webserver_request.database_users ()->get_users (); for (auto user : users) { - if (request.database_config_user()->getUserBibleChecksNotification (user)) { - if (access_bible::read (&request, bible, user)) { + if (webserver_request.database_config_user()->getUserBibleChecksNotification (user)) { + if (access_bible::read (webserver_request, bible, user)) { if (!client_logic_client_enabled ()) { email_schedule (user, subject, body); } diff --git a/checks/settings.cpp b/checks/settings.cpp index 2949fb5aa..ab64af59a 100644 --- a/checks/settings.cpp +++ b/checks/settings.cpp @@ -69,7 +69,7 @@ string checks_settings (Webserver_Request& webserver_request) string bible = webserver_request.query["bible"]; if (bible.empty()) { Dialog_List dialog_list = Dialog_List ("settings", translate("Select which Bible to manage"), string(), string()); - vector bibles = access_bible::bibles (std::addressof(webserver_request)); + vector bibles = access_bible::bibles (webserver_request); for (const auto & selectable_bible : bibles) { dialog_list.add_row (selectable_bible, "bible", selectable_bible); } @@ -79,7 +79,7 @@ string checks_settings (Webserver_Request& webserver_request) webserver_request.database_config_user()->setBible (bible); } } - string bible = access_bible::clamp (std::addressof(webserver_request), webserver_request.database_config_user()->getBible ()); + string bible = access_bible::clamp (webserver_request, webserver_request.database_config_user()->getBible ()); if (webserver_request.query.count ("run")) { diff --git a/checks/settingspairs.cpp b/checks/settingspairs.cpp index 12884b64d..e26e63d48 100644 --- a/checks/settingspairs.cpp +++ b/checks/settingspairs.cpp @@ -64,7 +64,7 @@ string checks_settingspairs (Webserver_Request& webserver_request) Assets_View view {}; - string bible = access_bible::clamp (std::addressof(webserver_request), webserver_request.database_config_user()->getBible ()); + string bible = access_bible::clamp (webserver_request, webserver_request.database_config_user()->getBible ()); view.set_variable ("bible", bible); diff --git a/checks/settingspatterns.cpp b/checks/settingspatterns.cpp index e6eea8479..4827d2c90 100644 --- a/checks/settingspatterns.cpp +++ b/checks/settingspatterns.cpp @@ -57,7 +57,7 @@ string checks_settingspatterns (Webserver_Request& webserver_request) Assets_View view {}; - string bible = access_bible::clamp (std::addressof(webserver_request), webserver_request.database_config_user()->getBible ()); + string bible = access_bible::clamp (webserver_request, webserver_request.database_config_user()->getBible ()); if (webserver_request.post.count ("patterns")) { diff --git a/checks/settingssentences.cpp b/checks/settingssentences.cpp index a398af176..698908a45 100644 --- a/checks/settingssentences.cpp +++ b/checks/settingssentences.cpp @@ -64,7 +64,7 @@ string checks_settingssentences (Webserver_Request& webserver_request) Assets_View view {}; - string bible = access_bible::clamp (std::addressof(webserver_request), webserver_request.database_config_user()->getBible ()); + string bible = access_bible::clamp (webserver_request, webserver_request.database_config_user()->getBible ()); if (webserver_request.post.count ("capitals")) { diff --git a/checks/suppress.cpp b/checks/suppress.cpp index 257ad62b7..618aa0f29 100644 --- a/checks/suppress.cpp +++ b/checks/suppress.cpp @@ -68,7 +68,7 @@ string checks_suppress (Webserver_Request& webserver_request) { vector all_bibles = webserver_request.database_bibles()->get_bibles (); for (const auto & bible : all_bibles) { - if (access_bible::write (std::addressof(webserver_request), bible)) { + if (access_bible::write (webserver_request, bible)) { bibles.push_back (bible); } } diff --git a/consistency/logic.cpp b/consistency/logic.cpp index 67f3836c6..08a75b7ce 100644 --- a/consistency/logic.cpp +++ b/consistency/logic.cpp @@ -44,7 +44,7 @@ string Consistency_Logic::response () // The resources to display in the Consistency tool. vector resources = request->database_config_user()->getConsistencyResources (); - string bible = access_bible::clamp (webserver_request, request->database_config_user()->getBible ()); + string bible = access_bible::clamp (*request, request->database_config_user()->getBible ()); resources.insert (resources.begin (), bible); // The passages entered in the Consistency tool. diff --git a/edit/edit.cpp b/edit/edit.cpp index cbaa031b3..463919f01 100644 --- a/edit/edit.cpp +++ b/edit/edit.cpp @@ -43,7 +43,7 @@ bool edit_edit_acl (Webserver_Request& webserver_request) { if (Filter_Roles::access_control (webserver_request, Filter_Roles::translator ())) return true; - auto [read, write] = access_bible::any (std::addressof(webserver_request)); + auto [read, write] = access_bible::any (webserver_request); return read; } diff --git a/edit/id.cpp b/edit/id.cpp index 0456e95fc..4a5e3ed32 100644 --- a/edit/id.cpp +++ b/edit/id.cpp @@ -39,7 +39,7 @@ bool edit_id_acl (Webserver_Request& webserver_request) { if (Filter_Roles::access_control (webserver_request, Filter_Roles::translator ())) return true; - auto [ read, write ] = access_bible::any (std::addressof(webserver_request)); + auto [ read, write ] = access_bible::any (webserver_request); return read; } diff --git a/edit/index.cpp b/edit/index.cpp index 759bd0e68..89d3b6fac 100644 --- a/edit/index.cpp +++ b/edit/index.cpp @@ -52,7 +52,7 @@ bool edit_index_acl (Webserver_Request& webserver_request) { if (Filter_Roles::access_control (webserver_request, Filter_Roles::translator ())) return true; - auto [ read, write ] = access_bible::any (std::addressof(webserver_request)); + auto [ read, write ] = access_bible::any (webserver_request); return write; } @@ -107,11 +107,11 @@ std::string edit_index (Webserver_Request& webserver_request) // Active Bible, and check access. // Or if the user have used query to preset the active Bible, get the preset Bible. // Set the chosen Bible on the option HTML tag. - std::string bible = access_bible::clamp (std::addressof(webserver_request), webserver_request.database_config_user()->getBible ()); + std::string bible = access_bible::clamp (webserver_request, webserver_request.database_config_user()->getBible ()); if (webserver_request.query.count ("bible")) - bible = access_bible::clamp (std::addressof(webserver_request), webserver_request.query ["bible"]); + bible = access_bible::clamp (webserver_request, webserver_request.query ["bible"]); std::string bible_html{}; - const std::vector bibles = access_bible::bibles (std::addressof(webserver_request)); + const std::vector bibles = access_bible::bibles (webserver_request); for (const auto& selectable_bible : bibles) { bible_html = Options_To_Select::add_selection (selectable_bible, selectable_bible, bible_html); } diff --git a/edit/load.cpp b/edit/load.cpp index 7a9272507..818b65ba0 100644 --- a/edit/load.cpp +++ b/edit/load.cpp @@ -43,7 +43,7 @@ bool edit_load_acl (Webserver_Request& webserver_request) { if (Filter_Roles::access_control (webserver_request, Filter_Roles::translator ())) return true; - auto [ read, write ] = access_bible::any (std::addressof(webserver_request)); + auto [ read, write ] = access_bible::any (webserver_request); return write; } @@ -77,7 +77,7 @@ string edit_load (Webserver_Request& webserver_request) } string user = webserver_request.session_logic ()->currentUser (); - bool write = access_bible::book_write (std::addressof(webserver_request), user, bible, book); + bool write = access_bible::book_write (webserver_request, user, bible, book); return checksum_logic::send (html, write); } diff --git a/edit/navigate.cpp b/edit/navigate.cpp index d835e15a1..af4f4d543 100644 --- a/edit/navigate.cpp +++ b/edit/navigate.cpp @@ -38,7 +38,7 @@ bool edit_navigate_acl (Webserver_Request& webserver_request) { if (Filter_Roles::access_control (webserver_request, Filter_Roles::translator ())) return true; - auto [ read, write ] = access_bible::any (std::addressof(webserver_request)); + auto [ read, write ] = access_bible::any (webserver_request); return write; } diff --git a/edit/position.cpp b/edit/position.cpp index 0b7ed5a16..23bce9b0b 100644 --- a/edit/position.cpp +++ b/edit/position.cpp @@ -38,7 +38,7 @@ bool edit_position_acl (Webserver_Request& webserver_request) { if (Filter_Roles::access_control (webserver_request, Filter_Roles::translator ())) return true; - auto [ read, write ] = access_bible::any (std::addressof(webserver_request)); + auto [ read, write ] = access_bible::any (webserver_request); return write; } diff --git a/edit/preview.cpp b/edit/preview.cpp index c9c44a808..8e5e0409b 100644 --- a/edit/preview.cpp +++ b/edit/preview.cpp @@ -49,7 +49,7 @@ bool edit_preview_acl (Webserver_Request& webserver_request) { if (Filter_Roles::access_control (webserver_request, Filter_Roles::translator ())) return true; - auto [ read, write ] = access_bible::any (std::addressof(webserver_request)); + auto [ read, write ] = access_bible::any (webserver_request); return read; } @@ -74,7 +74,7 @@ string edit_preview (Webserver_Request& webserver_request) // Get active Bible, and check read access to it. // If needed, change Bible to one it has read access to. - string bible = access_bible::clamp (std::addressof(webserver_request), webserver_request.database_config_user()->getBible ()); + string bible = access_bible::clamp (webserver_request, webserver_request.database_config_user()->getBible ()); string cls = Filter_Css::getClass (bible); string font = fonts::logic::get_text_font (bible); diff --git a/edit/save.cpp b/edit/save.cpp index 2598f105c..e670da6d3 100644 --- a/edit/save.cpp +++ b/edit/save.cpp @@ -53,7 +53,7 @@ bool edit_save_acl (Webserver_Request& webserver_request) { if (Filter_Roles::access_control (webserver_request, Filter_Roles::translator ())) return true; - auto [ read, write ] = access_bible::any (std::addressof(webserver_request)); + auto [ read, write ] = access_bible::any (webserver_request); return read; } @@ -90,7 +90,7 @@ string edit_save (Webserver_Request& webserver_request) return translate("Save failure"); } - if (!access_bible::book_write (std::addressof(webserver_request), string(), bible, book)) { + if (!access_bible::book_write (webserver_request, string(), bible, book)) { return translate("No write access"); } diff --git a/edit/styles.cpp b/edit/styles.cpp index 83db060be..641568112 100644 --- a/edit/styles.cpp +++ b/edit/styles.cpp @@ -37,7 +37,7 @@ bool edit_styles_acl (Webserver_Request& webserver_request) { if (Filter_Roles::access_control (webserver_request, Filter_Roles::translator ())) return true; - auto [ read, write ] = access_bible::any (std::addressof(webserver_request)); + auto [ read, write ] = access_bible::any (webserver_request); return read; } diff --git a/edit/update.cpp b/edit/update.cpp index cb3f83066..3790e9fa3 100644 --- a/edit/update.cpp +++ b/edit/update.cpp @@ -55,7 +55,7 @@ bool edit_update_acl (Webserver_Request& webserver_request) { if (Filter_Roles::access_control (webserver_request, Filter_Roles::translator ())) return true; - auto [ read, write ] = access_bible::any (std::addressof(webserver_request)); + auto [ read, write ] = access_bible::any (webserver_request); return read; } @@ -141,7 +141,7 @@ string edit_update (Webserver_Request& webserver_request) bool bible_write_access = false; if (good2go) { - bible_write_access = access_bible::book_write (std::addressof(webserver_request), string(), bible, book); + bible_write_access = access_bible::book_write (webserver_request, string(), bible, book); } @@ -400,7 +400,7 @@ string edit_update (Webserver_Request& webserver_request) // Test using the Cloud together with client devices with send and receive. - bool write = access_bible::book_write (std::addressof(webserver_request), username, bible, book); + bool write = access_bible::book_write (webserver_request, username, bible, book); response = checksum_logic::send (response, write); // Ready. diff --git a/editone2/index.cpp b/editone2/index.cpp index 97c482046..1ffa7d096 100644 --- a/editone2/index.cpp +++ b/editone2/index.cpp @@ -56,7 +56,7 @@ bool editone2_index_acl (Webserver_Request& webserver_request) int minimum_role = Filter_Roles::translator (); if (Filter_Roles::access_control (webserver_request, minimum_role)) return true; - auto [ read, write ] = access_bible::any (std::addressof(webserver_request)); + auto [ read, write ] = access_bible::any (webserver_request); return read; } @@ -95,10 +95,10 @@ string editone2_index (Webserver_Request& webserver_request) // Or if the user have used query to preset the active Bible, get the preset Bible. // If needed, change Bible to one it has read access to. // Set the chosen Bible on the option HTML tag. - string bible = access_bible::clamp (std::addressof(webserver_request), webserver_request.database_config_user()->getBible ()); - if (webserver_request.query.count ("bible")) bible = access_bible::clamp (std::addressof(webserver_request), webserver_request.query ["bible"]); + string bible = access_bible::clamp (webserver_request, webserver_request.database_config_user()->getBible ()); + if (webserver_request.query.count ("bible")) bible = access_bible::clamp (webserver_request, webserver_request.query ["bible"]); string bible_html; - vector bibles = access_bible::bibles (std::addressof(webserver_request)); + vector bibles = access_bible::bibles (webserver_request); for (auto selectable_bible : bibles) { bible_html = Options_To_Select::add_selection (selectable_bible, selectable_bible, bible_html); } diff --git a/editone2/load.cpp b/editone2/load.cpp index 709718a67..4b9afc4b5 100644 --- a/editone2/load.cpp +++ b/editone2/load.cpp @@ -43,7 +43,7 @@ bool editone2_load_acl (Webserver_Request& webserver_request) { if (Filter_Roles::access_control (webserver_request, Filter_Roles::translator ())) return true; - auto [ read, write ] = access_bible::any (std::addressof(webserver_request)); + auto [ read, write ] = access_bible::any (webserver_request); return read; } @@ -117,7 +117,7 @@ string editone2_load (Webserver_Request& webserver_request) data.append (suffix_html); string user = webserver_request.session_logic ()->currentUser (); - bool write = access_bible::book_write (std::addressof(webserver_request), user, bible, book); + bool write = access_bible::book_write (webserver_request, user, bible, book); data = checksum_logic::send (data, write); return data; diff --git a/editone2/save.cpp b/editone2/save.cpp index 1393baf82..05b811fa4 100644 --- a/editone2/save.cpp +++ b/editone2/save.cpp @@ -52,7 +52,7 @@ bool editone2_save_acl (Webserver_Request& webserver_request) { if (Filter_Roles::access_control (webserver_request, Filter_Roles::translator ())) return true; - auto [ read, write ] = access_bible::any (std::addressof(webserver_request)); + auto [ read, write ] = access_bible::any (webserver_request); return read; } @@ -99,7 +99,7 @@ string editone2_save (Webserver_Request& webserver_request) } - if (!access_bible::book_write (std::addressof(webserver_request), string(), bible, book)) { + if (!access_bible::book_write (webserver_request, string(), bible, book)) { return translate ("No write access"); } diff --git a/editone2/update.cpp b/editone2/update.cpp index e1f3189f1..ca3f8103a 100644 --- a/editone2/update.cpp +++ b/editone2/update.cpp @@ -53,7 +53,7 @@ bool editone2_update_acl (Webserver_Request& webserver_request) { if (Filter_Roles::access_control (webserver_request, Filter_Roles::translator ())) return true; - auto [ read, write ] = access_bible::any (std::addressof(webserver_request)); + auto [ read, write ] = access_bible::any (webserver_request); return read; } @@ -142,7 +142,7 @@ string editone2_update (Webserver_Request& webserver_request) bool bible_write_access = false; if (good2go) { - bible_write_access = access_bible::book_write (std::addressof(webserver_request), string(), bible, book); + bible_write_access = access_bible::book_write (webserver_request, string(), bible, book); } @@ -343,7 +343,7 @@ string editone2_update (Webserver_Request& webserver_request) // Test using the Cloud together with client devices with send and receive. - bool write = access_bible::book_write (std::addressof(webserver_request), username, bible, book); + bool write = access_bible::book_write (webserver_request, username, bible, book); response = checksum_logic::send (response, write); // Ready. diff --git a/editone2/verse.cpp b/editone2/verse.cpp index dd5ecf0b4..144af84cb 100644 --- a/editone2/verse.cpp +++ b/editone2/verse.cpp @@ -36,7 +36,7 @@ bool editone2_verse_acl (Webserver_Request& webserver_request) { if (Filter_Roles::access_control (webserver_request, Filter_Roles::translator ())) return true; - auto [ read, write ] = access_bible::any (std::addressof(webserver_request)); + auto [ read, write ] = access_bible::any (webserver_request); return read; } diff --git a/editor/id.cpp b/editor/id.cpp index 77d4eb6f4..5826c7c36 100644 --- a/editor/id.cpp +++ b/editor/id.cpp @@ -39,7 +39,7 @@ bool editor_id_acl (Webserver_Request& webserver_request) { if (Filter_Roles::access_control (webserver_request, Filter_Roles::translator ())) return true; - auto [ read, write ] = access_bible::any (std::addressof(webserver_request)); + auto [ read, write ] = access_bible::any (webserver_request); return read; } diff --git a/editor/select.cpp b/editor/select.cpp index 52a6909a5..d7ca73623 100644 --- a/editor/select.cpp +++ b/editor/select.cpp @@ -43,7 +43,7 @@ string editor_select_url () bool editor_select_acl (Webserver_Request& webserver_request) { if (Filter_Roles::access_control (webserver_request, Filter_Roles::translator ())) return true; - auto [ read, write ] = access_bible::any (std::addressof(webserver_request)); + auto [ read, write ] = access_bible::any (webserver_request); return write; } diff --git a/editor/style.cpp b/editor/style.cpp index 27b655165..68a6a6c49 100644 --- a/editor/style.cpp +++ b/editor/style.cpp @@ -37,7 +37,7 @@ bool editor_style_acl (Webserver_Request& webserver_request) { if (Filter_Roles::access_control (webserver_request, Filter_Roles::translator ())) return true; - auto [ read, write ] = access_bible::any (std::addressof(webserver_request)); + auto [ read, write ] = access_bible::any (webserver_request); return read; } diff --git a/editusfm/focus.cpp b/editusfm/focus.cpp index a8ce64da5..b9e9320e3 100644 --- a/editusfm/focus.cpp +++ b/editusfm/focus.cpp @@ -37,7 +37,7 @@ bool editusfm_focus_acl (Webserver_Request& webserver_request) { if (Filter_Roles::access_control (webserver_request, Filter_Roles::translator ())) return true; - auto [ read, write ] = access_bible::any (std::addressof(webserver_request)); + auto [ read, write ] = access_bible::any (webserver_request); return read; } diff --git a/editusfm/index.cpp b/editusfm/index.cpp index 933b73085..3a01f3165 100644 --- a/editusfm/index.cpp +++ b/editusfm/index.cpp @@ -49,7 +49,7 @@ bool editusfm_index_acl (Webserver_Request& webserver_request) { if (Filter_Roles::access_control (webserver_request, Filter_Roles::translator ())) return true; - auto [ read, write ] = access_bible::any (std::addressof(webserver_request)); + auto [ read, write ] = access_bible::any (webserver_request); return write; } @@ -93,11 +93,11 @@ std::string editusfm_index (Webserver_Request& webserver_request) // Or if the user have used query to preset the active Bible, get the preset Bible. // If needed, change Bible to one it has read access to. // Set the chosen Bible on the option HTML tag. - std::string bible = access_bible::clamp (std::addressof(webserver_request), webserver_request.database_config_user()->getBible ()); + std::string bible = access_bible::clamp (webserver_request, webserver_request.database_config_user()->getBible ()); if (webserver_request.query.count ("bible")) - bible = access_bible::clamp (std::addressof(webserver_request), webserver_request.query ["bible"]); + bible = access_bible::clamp (webserver_request, webserver_request.query ["bible"]); std::string bible_html; - const std::vector bibles = access_bible::bibles (std::addressof(webserver_request)); + const std::vector bibles = access_bible::bibles (webserver_request); for (const auto& selectable_bible : bibles) { bible_html = Options_To_Select::add_selection (selectable_bible, selectable_bible, bible_html); } diff --git a/editusfm/load.cpp b/editusfm/load.cpp index 2217bf34c..5d13a32eb 100644 --- a/editusfm/load.cpp +++ b/editusfm/load.cpp @@ -37,7 +37,7 @@ bool editusfm_load_acl (Webserver_Request& webserver_request) { if (Filter_Roles::access_control (webserver_request, Filter_Roles::translator ())) return true; - auto [ read, write ] = access_bible::any (std::addressof(webserver_request)); + auto [ read, write ] = access_bible::any (webserver_request); return read; } @@ -58,7 +58,7 @@ string editusfm_load (Webserver_Request& webserver_request) usfm = filter::strings::escape_special_xml_characters (usfm); string user = webserver_request.session_logic ()->currentUser (); - bool write = access_bible::book_write (std::addressof(webserver_request), user, bible, book); + bool write = access_bible::book_write (webserver_request, user, bible, book); return checksum_logic::send (usfm, write); } diff --git a/editusfm/offset.cpp b/editusfm/offset.cpp index 90999ca81..bb459ea61 100644 --- a/editusfm/offset.cpp +++ b/editusfm/offset.cpp @@ -37,7 +37,7 @@ bool editusfm_offset_acl (Webserver_Request& webserver_request) { if (Filter_Roles::access_control (webserver_request, Filter_Roles::translator ())) return true; - auto [ read, write ] = access_bible::any (std::addressof(webserver_request)); + auto [ read, write ] = access_bible::any (webserver_request); return read; } diff --git a/editusfm/save.cpp b/editusfm/save.cpp index a93048313..74f579a13 100644 --- a/editusfm/save.cpp +++ b/editusfm/save.cpp @@ -49,7 +49,7 @@ bool editusfm_save_acl (Webserver_Request& webserver_request) { if (Filter_Roles::access_control (webserver_request, Filter_Roles::translator ())) return true; - auto [ read, write ] = access_bible::any (std::addressof(webserver_request)); + auto [ read, write ] = access_bible::any (webserver_request); return read; } @@ -118,7 +118,7 @@ string editusfm_save (Webserver_Request& webserver_request) // Check on write access. - if (access_bible::book_write (std::addressof(webserver_request), string(), bible, book)) { + if (access_bible::book_write (webserver_request, string(), bible, book)) { // Safely store the chapter. string explanation; string message = filter::usfm::safely_store_chapter (std::addressof(webserver_request), bible, book, chapter, chapter_data_to_save, explanation); diff --git a/manage/exports.cpp b/manage/exports.cpp index bd465eed6..76d06feec 100644 --- a/manage/exports.cpp +++ b/manage/exports.cpp @@ -76,7 +76,7 @@ string manage_exports (Webserver_Request& webserver_request) string bible = webserver_request.query["bible"]; if (bible.empty()) { Dialog_List dialog_list = Dialog_List ("exports", translate("Select a Bible"), "", ""); - vector bibles = access_bible::bibles (std::addressof(webserver_request)); + vector bibles = access_bible::bibles (webserver_request); for (const auto& bible2 : bibles) { dialog_list.add_row (bible2, "bible", bible2); } @@ -88,7 +88,7 @@ string manage_exports (Webserver_Request& webserver_request) } - string bible = access_bible::clamp (std::addressof(webserver_request), webserver_request.database_config_user()->getBible ()); + string bible = access_bible::clamp (webserver_request, webserver_request.database_config_user()->getBible ()); view.set_variable ("bible", bible); diff --git a/manage/hyphenate.cpp b/manage/hyphenate.cpp index 031373e61..76bc8c7bc 100644 --- a/manage/hyphenate.cpp +++ b/manage/hyphenate.cpp @@ -69,7 +69,7 @@ void manage_hyphenate (string bible, string user) Database_Config_Bible::remove (outputBible); database_bibles.create_bible (outputBible); Webserver_Request webserver_request; - if (!access_bible::write (&webserver_request, outputBible, user)) { + if (!access_bible::write (webserver_request, outputBible, user)) { // Only grant access if the user does not yet have it. // This avoid assigning the Bible to the user in case no Bible was assigned to anyone, // in which case assigning this Bible to the user would possible withdraw privileges from other users. diff --git a/manage/hyphenation.cpp b/manage/hyphenation.cpp index 47c2f3be5..9bc483fdb 100644 --- a/manage/hyphenation.cpp +++ b/manage/hyphenation.cpp @@ -56,7 +56,7 @@ string manage_hyphenation (Webserver_Request& webserver_request) Assets_View view; - string bible = access_bible::clamp (std::addressof(webserver_request), webserver_request.database_config_user()->getBible ()); + string bible = access_bible::clamp (webserver_request, webserver_request.database_config_user()->getBible ()); string success; @@ -77,7 +77,7 @@ string manage_hyphenation (Webserver_Request& webserver_request) string bible2 = webserver_request.query ["bible"]; if (bible2.empty()) { Dialog_List dialog_list = Dialog_List ("", translate("Which Bible would you like to take the data from?"), "", ""); - vector bibles = access_bible::bibles (std::addressof(webserver_request)); + vector bibles = access_bible::bibles (webserver_request); for (auto list_bible : bibles) { dialog_list.add_row (list_bible, "bible", list_bible); } @@ -87,7 +87,7 @@ string manage_hyphenation (Webserver_Request& webserver_request) webserver_request.database_config_user()->setBible (bible2); } } - bible = access_bible::clamp (std::addressof(webserver_request), webserver_request.database_config_user()->getBible ()); + bible = access_bible::clamp (webserver_request, webserver_request.database_config_user()->getBible ()); string firstset = Database_Config_Bible::getHyphenationFirstSet (bible); diff --git a/notes/bb-1.cpp b/notes/bb-1.cpp index 45d253b72..4eb8dbdba 100644 --- a/notes/bb-1.cpp +++ b/notes/bb-1.cpp @@ -74,7 +74,7 @@ string notes_bible_1 (Webserver_Request& webserver_request) stringstream bibleblock; - vector bibles = access_bible::bibles (std::addressof(webserver_request)); + vector bibles = access_bible::bibles (webserver_request); bibles.push_back (notes_logic.generalBibleName ()); for (const auto& bible : bibles) { bibleblock << "
  • " << bible << "
  • " << std::endl; diff --git a/notes/bb-n.cpp b/notes/bb-n.cpp index c800266ea..b2c269567 100644 --- a/notes/bb-n.cpp +++ b/notes/bb-n.cpp @@ -60,7 +60,7 @@ string notes_bible_n (Webserver_Request& webserver_request) stringstream bibleblock; - vector bibles = access_bible::bibles (std::addressof(webserver_request)); + vector bibles = access_bible::bibles (webserver_request); bibles.push_back (notes_logic.generalBibleName ()); for (const auto & bible : bibles) { bibleblock << "
  • " << bible << "
  • " << std::endl; diff --git a/notes/bulk.cpp b/notes/bulk.cpp index 19ad39ea4..2fedcccfe 100644 --- a/notes/bulk.cpp +++ b/notes/bulk.cpp @@ -70,7 +70,7 @@ string notes_bulk (Webserver_Request& webserver_request) string success, error; - vector bibles = access_bible::bibles (std::addressof(webserver_request)); + vector bibles = access_bible::bibles (webserver_request); int book = Ipc_Focus::getBook (std::addressof(webserver_request)); int chapter = Ipc_Focus::getChapter (std::addressof(webserver_request)); int verse = Ipc_Focus::getVerse (std::addressof(webserver_request)); diff --git a/notes/create.cpp b/notes/create.cpp index aefb90c7f..74b6cbef7 100644 --- a/notes/create.cpp +++ b/notes/create.cpp @@ -71,7 +71,7 @@ string notes_create (Webserver_Request& webserver_request) // If no Bible is passed, it takes the user's active Bible. string bible = webserver_request.post ["bible"]; if (bible.empty ()) { - bible = access_bible::clamp (std::addressof(webserver_request), webserver_request.database_config_user()->getBible ()); + bible = access_bible::clamp (webserver_request, webserver_request.database_config_user()->getBible ()); } diff --git a/notes/logic.cpp b/notes/logic.cpp index 30b11e1ee..1814a44e3 100644 --- a/notes/logic.cpp +++ b/notes/logic.cpp @@ -393,7 +393,7 @@ void Notes_Logic::notifyUsers (int identifier, int notification) // Users to get subscribed to the note, or to whom the note is to be assigned. vector users = request->database_users ()->get_users (); for (const string & user : users) { - if (access_bible::read (webserver_request, bible, user)) { + if (access_bible::read (*request, bible, user)) { if (request->database_config_user ()->getNotifyUserOfAnyConsultationNotesEdits (user)) { database_notes.subscribe_user (identifier, user); } @@ -434,7 +434,7 @@ void Notes_Logic::notifyUsers (int identifier, int notification) vector users = request->database_users ()->get_users (); for (const auto & user : users) { if (request->database_config_user ()->getUserDeletedConsultationNoteNotification (user)) { - if (access_bible::read (webserver_request, bible, user)) { + if (access_bible::read (*request, bible, user)) { recipients.push_back (user); } } @@ -725,10 +725,10 @@ void notes_logic_maintain_note_assignees (bool force) for (auto & bible : bibles) { // Continue with this Bible if the user has access to it. - if (access_bible::read (&webserver_request, bible, user)) { + if (access_bible::read (webserver_request, bible, user)) { for (auto & assignee : users) { - if (access_bible::read (&webserver_request, bible, assignee)) { + if (access_bible::read (webserver_request, bible, assignee)) { assignees.push_back (assignee); } } diff --git a/notes/notes.cpp b/notes/notes.cpp index d7b7c89d3..92bf9b483 100644 --- a/notes/notes.cpp +++ b/notes/notes.cpp @@ -51,7 +51,7 @@ string notes_notes (Webserver_Request& webserver_request) Database_Notes database_notes (std::addressof(webserver_request)); - string bible = access_bible::clamp (std::addressof(webserver_request), webserver_request.database_config_user()->getBible()); + string bible = access_bible::clamp (webserver_request, webserver_request.database_config_user()->getBible()); int book = Ipc_Focus::getBook (std::addressof(webserver_request)); int chapter = Ipc_Focus::getChapter (std::addressof(webserver_request)); int verse = Ipc_Focus::getVerse (std::addressof(webserver_request)); @@ -72,7 +72,7 @@ string notes_notes (Webserver_Request& webserver_request) // The Bibles the current user has access to. - vector bibles = access_bible::bibles (std::addressof(webserver_request), webserver_request.session_logic()->currentUser ()); + vector bibles = access_bible::bibles (webserver_request, webserver_request.session_logic()->currentUser ()); // The admin disables notes selection on Bibles, diff --git a/notes/select.cpp b/notes/select.cpp index e9945ee0c..c906f544d 100644 --- a/notes/select.cpp +++ b/notes/select.cpp @@ -177,7 +177,7 @@ string notes_select (Webserver_Request& webserver_request) string bible_selector = webserver_request.database_config_user()->getConsultationNotesBibleSelector(); if (bible_selector.empty ()) view.set_variable ("anybible", active_class); stringstream bibleblock; - vector bibles = access_bible::bibles (std::addressof(webserver_request)); + vector bibles = access_bible::bibles (webserver_request); // The administrator can select from all Bibles in the notes, even Bibles that do not exist. if (webserver_request.session_logic ()->currentLevel () == Filter_Roles::admin ()) { vector notesbibles = database_notes.get_all_bibles (); diff --git a/notes/unassign-n.cpp b/notes/unassign-n.cpp index 058e349f1..b59a6aa59 100644 --- a/notes/unassign-n.cpp +++ b/notes/unassign-n.cpp @@ -61,7 +61,7 @@ string notes_unassign_n (Webserver_Request& webserver_request) // Notes can be unassigned from users who have access to the Bibles // the currently logged-in user has access to, and who have notes assigned. stringstream userblock; - vector bibles = access_bible::bibles (std::addressof(webserver_request)); + vector bibles = access_bible::bibles (webserver_request); vector users = database_notes.get_all_assignees (bibles); for (const auto& user : users) { userblock << "
  • " << user << "
  • " << std::endl; diff --git a/personalize/index.cpp b/personalize/index.cpp index b0a9e9c39..9588fe1e6 100644 --- a/personalize/index.cpp +++ b/personalize/index.cpp @@ -297,7 +297,7 @@ string personalize_index (Webserver_Request& webserver_request) string changebible = webserver_request.query ["changebible"]; if (changebible == "") { Dialog_List dialog_list = Dialog_List ("index", translate("Select which Bible to make the active one for editing"), "", ""); - vector bibles = access_bible::bibles (std::addressof(webserver_request)); + vector bibles = access_bible::bibles (webserver_request); for (auto & bible : bibles) { dialog_list.add_row (bible, "changebible", bible); } @@ -315,7 +315,7 @@ string personalize_index (Webserver_Request& webserver_request) } } } - string bible = access_bible::clamp (std::addressof(webserver_request), webserver_request.database_config_user()->getBible ()); + string bible = access_bible::clamp (webserver_request, webserver_request.database_config_user()->getBible ()); view.set_variable ("bible", bible); @@ -450,7 +450,7 @@ string personalize_index (Webserver_Request& webserver_request) bool resources = access_logic::privilege_view_resources (std::addressof(webserver_request)); if (resources) view.enable_zone ("resources"); bool bibles = Filter_Roles::access_control (webserver_request, Filter_Roles::translator ()); - auto [ read, write ] = access_bible::any (std::addressof(webserver_request)); + auto [ read, write ] = access_bible::any (webserver_request); if (read || write) bibles = true; if (bibles) view.enable_zone ("bibles"); if (webserver_request.session_logic ()->touchEnabled ()) { diff --git a/read/index.cpp b/read/index.cpp index 687759ab2..aac31e9b6 100644 --- a/read/index.cpp +++ b/read/index.cpp @@ -57,7 +57,7 @@ bool read_index_acl (Webserver_Request& webserver_request) int role = Filter_Roles::translator (); if (Filter_Roles::access_control (webserver_request, role)) return true; - auto [ read, write ] = access_bible::any (std::addressof(webserver_request)); + auto [ read, write ] = access_bible::any (webserver_request); return read; } @@ -96,10 +96,10 @@ string read_index (Webserver_Request& webserver_request) // Or if the user have used query to preset the active Bible, get the preset Bible. // If needed, change Bible to one it has read access to. // Set the chosen Bible on the option HTML tag. - string bible = access_bible::clamp (std::addressof(webserver_request), webserver_request.database_config_user()->getBible ()); - if (webserver_request.query.count ("bible")) bible = access_bible::clamp (std::addressof(webserver_request), webserver_request.query ["bible"]); + string bible = access_bible::clamp (webserver_request, webserver_request.database_config_user()->getBible ()); + if (webserver_request.query.count ("bible")) bible = access_bible::clamp (webserver_request, webserver_request.query ["bible"]); string bible_html; - vector bibles = access_bible::bibles (std::addressof(webserver_request)); + vector bibles = access_bible::bibles (webserver_request); for (auto selectable_bible : bibles) { bible_html = Options_To_Select::add_selection (selectable_bible, selectable_bible, bible_html); } diff --git a/read/load.cpp b/read/load.cpp index cb9b266b5..da7fef988 100644 --- a/read/load.cpp +++ b/read/load.cpp @@ -43,7 +43,7 @@ bool read_load_acl (Webserver_Request& webserver_request) { if (Filter_Roles::access_control (webserver_request, Filter_Roles::translator ())) return true; - auto [ read, write ] = access_bible::any (std::addressof(webserver_request)); + auto [ read, write ] = access_bible::any (webserver_request); return read; } diff --git a/read/verse.cpp b/read/verse.cpp index 1611833de..4f27bd3cf 100644 --- a/read/verse.cpp +++ b/read/verse.cpp @@ -36,7 +36,7 @@ bool read_verse_acl (Webserver_Request& webserver_request) { if (Filter_Roles::access_control (webserver_request, Filter_Roles::translator ())) return true; - auto [ read, write ] = access_bible::any (std::addressof(webserver_request)); + auto [ read, write ] = access_bible::any (webserver_request); return read; } diff --git a/resource/bb2resource.cpp b/resource/bb2resource.cpp index 2ed4f6c7c..2f7b73a1b 100644 --- a/resource/bb2resource.cpp +++ b/resource/bb2resource.cpp @@ -76,7 +76,7 @@ std::string resource_bible2resource (Webserver_Request& webserver_request) if (webserver_request.query.count ("convert")) { - if (access_bible::write (std::addressof(webserver_request), bible)) { + if (access_bible::write (webserver_request, bible)) { tasks_logic_queue (CONVERTBIBLE2RESOURCE, {bible}); redirect_browser (std::addressof(webserver_request), journal_index_url ()); return std::string(); diff --git a/resource/logic.cpp b/resource/logic.cpp index 99933b574..4efbd9827 100644 --- a/resource/logic.cpp +++ b/resource/logic.cpp @@ -95,10 +95,12 @@ Stages to retrieve resource content and serve it. std::vector resource_logic_get_names (void * webserver_request, bool bibles_only) { + Webserver_Request * request = static_cast(webserver_request); + std::vector names {}; // Bibles the user has read access to. - std::vector bibles = access_bible::bibles (webserver_request); + std::vector bibles = access_bible::bibles (*request); names.insert (names.end(), bibles.begin (), bibles.end()); // USFM resources. diff --git a/resource/manage.cpp b/resource/manage.cpp index b1f6cc06a..062d2253f 100644 --- a/resource/manage.cpp +++ b/resource/manage.cpp @@ -70,7 +70,7 @@ string resource_manage (Webserver_Request& webserver_request) page += dialog_yes.run (); return page; } if (confirm == "yes") { - if (access_bible::write (std::addressof(webserver_request), remove)) { + if (access_bible::write (webserver_request, remove)) { database_usfmresources.deleteResource (remove); // The Cloud updates the list of available USFM resources for the clients. tasks_logic_queue (LISTUSFMRESOURCES); @@ -91,7 +91,7 @@ string resource_manage (Webserver_Request& webserver_request) page += dialog_yes.run (); return page; } if (confirm == "yes") { - if (access_bible::write (std::addressof(webserver_request), convert)) { + if (access_bible::write (webserver_request, convert)) { tasks_logic_queue (CONVERTRESOURCE2BIBLE, {convert}); redirect_browser (std::addressof(webserver_request), journal_index_url ()); return ""; diff --git a/resource/select.cpp b/resource/select.cpp index 513dacd39..539765844 100644 --- a/resource/select.cpp +++ b/resource/select.cpp @@ -89,7 +89,7 @@ string resource_select (Webserver_Request& webserver_request) Dialog_List dialog_list = Dialog_List (caller, translate("Select a Bible"), "", "", true); dialog_list.add_query ("page", webserver_request.query["page"]); if (is_def) dialog_list.add_query ("type", webserver_request.query["type"]); - vector bibles = access_bible::bibles (std::addressof(webserver_request)); + vector bibles = access_bible::bibles (webserver_request); for (const auto & bible : bibles) { dialog_list.add_row (bible, "add", bible); } diff --git a/search/all.cpp b/search/all.cpp index 4f4193db4..c37c6f050 100644 --- a/search/all.cpp +++ b/search/all.cpp @@ -45,7 +45,7 @@ bool search_all_acl (Webserver_Request& webserver_request) { if (Filter_Roles::access_control (webserver_request, Filter_Roles::consultant ())) return true; - auto [ read, write ] = access_bible::any (std::addressof(webserver_request)); + auto [ read, write ] = access_bible::any (webserver_request); return read; } @@ -86,7 +86,7 @@ string search_all (Webserver_Request& webserver_request) const string site_url = config::logic::site_url (std::addressof(webserver_request)); - vector bibles = access_bible::bibles (std::addressof(webserver_request)); + vector bibles = access_bible::bibles (webserver_request); // Search the notes. diff --git a/search/getids.cpp b/search/getids.cpp index ab23dd961..818c08ab9 100644 --- a/search/getids.cpp +++ b/search/getids.cpp @@ -39,7 +39,7 @@ bool search_getids_acl (Webserver_Request& webserver_request) { if (Filter_Roles::access_control (webserver_request, Filter_Roles::translator ())) return true; - auto [ read, write ] = access_bible::any (std::addressof(webserver_request)); + auto [ read, write ] = access_bible::any (webserver_request); return write; } diff --git a/search/getids2.cpp b/search/getids2.cpp index dd4854f20..eb4b36eec 100644 --- a/search/getids2.cpp +++ b/search/getids2.cpp @@ -39,7 +39,7 @@ bool search_getids2_acl (Webserver_Request& webserver_request) { if (Filter_Roles::access_control (webserver_request, Filter_Roles::translator ())) return true; - auto [ read, write ] = access_bible::any (std::addressof(webserver_request)); + auto [ read, write ] = access_bible::any (webserver_request); return write; } diff --git a/search/index.cpp b/search/index.cpp index 9c7ee8ac5..8a1c9452a 100644 --- a/search/index.cpp +++ b/search/index.cpp @@ -42,7 +42,7 @@ bool search_index_acl (Webserver_Request& webserver_request) { if (Filter_Roles::access_control (webserver_request, Filter_Roles::consultant ())) return true; - auto [ read, write ] = access_bible::any (std::addressof(webserver_request)); + auto [ read, write ] = access_bible::any (webserver_request); return read; } @@ -114,7 +114,7 @@ std::string search_index (Webserver_Request& webserver_request) { std::string bible_html; - const std::vector accessible_bibles = access_bible::bibles (std::addressof(webserver_request)); + const std::vector accessible_bibles = access_bible::bibles (webserver_request); for (const auto& selectable_bible : accessible_bibles) { bible_html = Options_To_Select::add_selection (selectable_bible, selectable_bible, bible_html); } diff --git a/search/originals.cpp b/search/originals.cpp index 16a803cbb..ca17a9f4a 100644 --- a/search/originals.cpp +++ b/search/originals.cpp @@ -47,7 +47,7 @@ bool search_originals_acl (Webserver_Request& webserver_request) { if (Filter_Roles::access_control (webserver_request, Filter_Roles::consultant ())) return true; - auto [ read, write ] = access_bible::any (std::addressof(webserver_request)); + auto [ read, write ] = access_bible::any (webserver_request); return read; } diff --git a/search/replace.cpp b/search/replace.cpp index ef3866f8d..b2adae80b 100644 --- a/search/replace.cpp +++ b/search/replace.cpp @@ -45,7 +45,7 @@ bool search_replace_acl (Webserver_Request& webserver_request) { if (Filter_Roles::access_control (webserver_request, Filter_Roles::translator ())) return true; - auto [ read, write ] = access_bible::any (std::addressof(webserver_request)); + auto [ read, write ] = access_bible::any (webserver_request); return write; } @@ -109,7 +109,7 @@ string search_replace (Webserver_Request& webserver_request) { string bible_html; - vector accessible_bibles = access_bible::bibles (std::addressof(webserver_request)); + vector accessible_bibles = access_bible::bibles (webserver_request); for (auto selectable_bible : accessible_bibles) { bible_html = Options_To_Select::add_selection (selectable_bible, selectable_bible, bible_html); } diff --git a/search/replace2.cpp b/search/replace2.cpp index 3dac19898..07a206649 100644 --- a/search/replace2.cpp +++ b/search/replace2.cpp @@ -45,7 +45,7 @@ bool search_replace2_acl (Webserver_Request& webserver_request) { if (Filter_Roles::access_control (webserver_request, Filter_Roles::translator ())) return true; - auto [ read, write ] = access_bible::any (std::addressof(webserver_request)); + auto [ read, write ] = access_bible::any (webserver_request); return write; } @@ -70,7 +70,7 @@ string search_replace2 (Webserver_Request& webserver_request) { string bible_html; - vector bibles = access_bible::bibles (std::addressof(webserver_request)); + vector bibles = access_bible::bibles (webserver_request); for (auto selectable_bible : bibles) { bible_html = Options_To_Select::add_selection (selectable_bible, selectable_bible, bible_html); } diff --git a/search/replacego.cpp b/search/replacego.cpp index 118c1c21b..a525d93c4 100644 --- a/search/replacego.cpp +++ b/search/replacego.cpp @@ -45,7 +45,7 @@ bool search_replacego_acl (Webserver_Request& webserver_request) { if (Filter_Roles::access_control (webserver_request, Filter_Roles::translator ())) return true; - auto [ read, write ] = access_bible::any (std::addressof(webserver_request)); + auto [ read, write ] = access_bible::any (webserver_request); return write; } @@ -72,7 +72,7 @@ string search_replacego (Webserver_Request& webserver_request) // Check whether the user has write access to the book. string user = webserver_request.session_logic ()->currentUser (); - bool write = access_bible::book_write (std::addressof(webserver_request), user, bible, book); + bool write = access_bible::book_write (webserver_request, user, bible, book); // Get the old chapter and verse USFM. diff --git a/search/replacego2.cpp b/search/replacego2.cpp index dd8cf368c..8fc93ee21 100644 --- a/search/replacego2.cpp +++ b/search/replacego2.cpp @@ -45,7 +45,7 @@ bool search_replacego2_acl (Webserver_Request& webserver_request) { if (Filter_Roles::access_control (webserver_request, Filter_Roles::translator ())) return true; - auto [ read, write ] = access_bible::any (std::addressof(webserver_request)); + auto [ read, write ] = access_bible::any (webserver_request); return write; } @@ -73,7 +73,7 @@ string search_replacego2 (Webserver_Request& webserver_request) // Check whether the user has write access to the book. string user = webserver_request.session_logic ()->currentUser (); - bool write = access_bible::book_write (std::addressof(webserver_request), user, bible, book); + bool write = access_bible::book_write (webserver_request, user, bible, book); // Get the old chapter and verse USFM. diff --git a/search/replacepre.cpp b/search/replacepre.cpp index e881d9404..a9be2b846 100644 --- a/search/replacepre.cpp +++ b/search/replacepre.cpp @@ -40,7 +40,7 @@ bool search_replacepre_acl (Webserver_Request& webserver_request) { if (Filter_Roles::access_control (webserver_request, Filter_Roles::translator ())) return true; - auto [ read, write ] = access_bible::any (std::addressof(webserver_request)); + auto [ read, write ] = access_bible::any (webserver_request); return write; } @@ -91,7 +91,7 @@ string search_replacepre (Webserver_Request& webserver_request) // Check whether the user has write access to the book. string user = webserver_request.session_logic ()->currentUser (); - bool write = access_bible::book_write (std::addressof(webserver_request), user, bible, book); + bool write = access_bible::book_write (webserver_request, user, bible, book); // Create output. diff --git a/search/replacepre2.cpp b/search/replacepre2.cpp index 9fd272efd..797037109 100644 --- a/search/replacepre2.cpp +++ b/search/replacepre2.cpp @@ -40,7 +40,7 @@ bool search_replacepre2_acl (Webserver_Request& webserver_request) { if (Filter_Roles::access_control (webserver_request, Filter_Roles::translator ())) return true; - auto [ read, write ] = access_bible::any (std::addressof(webserver_request)); + auto [ read, write ] = access_bible::any (webserver_request); return write; } @@ -95,7 +95,7 @@ string search_replacepre2 (Webserver_Request& webserver_request) // Check whether the user has write access to the book. string user = webserver_request.session_logic ()->currentUser (); - bool write = access_bible::book_write (std::addressof(webserver_request), user, bible, book); + bool write = access_bible::book_write (webserver_request, user, bible, book); // Create output. diff --git a/search/search2.cpp b/search/search2.cpp index d23e703a2..f96b0265d 100644 --- a/search/search2.cpp +++ b/search/search2.cpp @@ -47,7 +47,7 @@ bool search_search2_acl (Webserver_Request& webserver_request) { if (Filter_Roles::access_control (webserver_request, Filter_Roles::consultant ())) return true; - auto [ read, write ] = access_bible::any (std::addressof(webserver_request)); + auto [ read, write ] = access_bible::any (webserver_request); return read; } @@ -216,7 +216,7 @@ string search_search2 (Webserver_Request& webserver_request) Assets_View view; { string bible_html; - vector accessible_bibles = access_bible::bibles (std::addressof(webserver_request)); + vector accessible_bibles = access_bible::bibles (webserver_request); for (auto selectable_bible : accessible_bibles) { bible_html = Options_To_Select::add_selection (selectable_bible, selectable_bible, bible_html); } diff --git a/search/similar.cpp b/search/similar.cpp index b33ab431d..126089028 100644 --- a/search/similar.cpp +++ b/search/similar.cpp @@ -45,7 +45,7 @@ bool search_similar_acl (Webserver_Request& webserver_request) { if (Filter_Roles::access_control (webserver_request, Filter_Roles::consultant ())) return true; - auto [ read, write ] = access_bible::any (std::addressof(webserver_request)); + auto [ read, write ] = access_bible::any (webserver_request); return read; } diff --git a/search/strong.cpp b/search/strong.cpp index 806374f5a..b9a42f94e 100644 --- a/search/strong.cpp +++ b/search/strong.cpp @@ -45,7 +45,7 @@ bool search_strong_acl (Webserver_Request& webserver_request) { if (Filter_Roles::access_control (webserver_request, Filter_Roles::consultant ())) return true; - auto [ read, write ] = access_bible::any (std::addressof(webserver_request)); + auto [ read, write ] = access_bible::any (webserver_request); return read; } diff --git a/search/strongs.cpp b/search/strongs.cpp index 13c32741c..3997687a7 100644 --- a/search/strongs.cpp +++ b/search/strongs.cpp @@ -45,7 +45,7 @@ bool search_strongs_acl (Webserver_Request& webserver_request) { if (Filter_Roles::access_control (webserver_request, Filter_Roles::consultant ())) return true; - auto [ read, write ] = access_bible::any (std::addressof(webserver_request)); + auto [ read, write ] = access_bible::any (webserver_request); return read; } diff --git a/sendreceive/index.cpp b/sendreceive/index.cpp index 7e8c6fc03..82a2c9e8c 100644 --- a/sendreceive/index.cpp +++ b/sendreceive/index.cpp @@ -91,10 +91,10 @@ string sendreceive_index (Webserver_Request& webserver_request) bible = webserver_request.query["bible"]; if (bible.empty()) { Dialog_List dialog_list = Dialog_List ("index", translate("Select a Bible"), "", ""); - vector bibles = access_bible::bibles (std::addressof(webserver_request)); + vector bibles = access_bible::bibles (webserver_request); for (auto & selectable_bible : bibles) { // Select Bibles the user has write access to. - if (access_bible::write (std::addressof(webserver_request), selectable_bible)) { + if (access_bible::write (webserver_request, selectable_bible)) { dialog_list.add_row (selectable_bible, "bible", selectable_bible); } } @@ -106,7 +106,7 @@ string sendreceive_index (Webserver_Request& webserver_request) } - bible = access_bible::clamp (std::addressof(webserver_request), webserver_request.database_config_user()->getBible ()); + bible = access_bible::clamp (webserver_request, webserver_request.database_config_user()->getBible ()); view.set_variable ("bible", bible); diff --git a/sprint/index.cpp b/sprint/index.cpp index 483eb3920..038a1fb48 100644 --- a/sprint/index.cpp +++ b/sprint/index.cpp @@ -93,7 +93,7 @@ string sprint_index ([[maybe_unused]] Webserver_Request& webserver_request) } - string bible = access_bible::clamp (std::addressof(webserver_request), webserver_request.database_config_user()->getBible ()); + string bible = access_bible::clamp (webserver_request, webserver_request.database_config_user()->getBible ()); int month = webserver_request.database_config_user()->getSprintMonth (); int year = webserver_request.database_config_user()->getSprintYear (); @@ -149,7 +149,7 @@ string sprint_index ([[maybe_unused]] Webserver_Request& webserver_request) bible = webserver_request.query ["bible"]; if (bible.empty()) { Dialog_List dialog_list = Dialog_List ("index", translate("Select which Bible to display the Sprint for"), "", ""); - vector bibles = access_bible::bibles (std::addressof(webserver_request)); + vector bibles = access_bible::bibles (webserver_request); for (auto & selection_bible : bibles) { dialog_list.add_row (selection_bible, "bible", selection_bible); } @@ -161,7 +161,7 @@ string sprint_index ([[maybe_unused]] Webserver_Request& webserver_request) } - bible = access_bible::clamp (std::addressof(webserver_request), webserver_request.database_config_user()->getBible ()); + bible = access_bible::clamp (webserver_request, webserver_request.database_config_user()->getBible ()); int id = filter::strings::convert_to_int (webserver_request.query ["id"]); diff --git a/sync/bibles.cpp b/sync/bibles.cpp index 01b0e944b..ef882d97e 100644 --- a/sync/bibles.cpp +++ b/sync/bibles.cpp @@ -63,7 +63,7 @@ string sync_bibles_receive_chapter (Webserver_Request& webserver_request, string // Check whether the user has write-access to the Bible book. - if (!access_bible::book_write (std::addressof(webserver_request), username, bible, book)) { + if (!access_bible::book_write (webserver_request, username, bible, book)) { string message = "User " + username + " does not have write access to Bible " + bible; Database_Logs::log (message, Filter_Roles::manager ()); // The Cloud will email the user with details about the issue. @@ -176,7 +176,7 @@ string sync_bibles (Webserver_Request& webserver_request) // calculate the checksum of all chapters in those Bibles, // and returns this checksum to the client. string username = webserver_request.session_logic ()->currentUser (); - vector bibles = access_bible::bibles (std::addressof(webserver_request), username); + vector bibles = access_bible::bibles (webserver_request, username); string server_checksum = checksum_logic::get_bibles (std::addressof(webserver_request), bibles); return server_checksum; } @@ -185,7 +185,7 @@ string sync_bibles (Webserver_Request& webserver_request) // The server reads the credentials from the client's user, // and responds with a list of Bibles this user has access to. string username = webserver_request.session_logic ()->currentUser (); - vector bibles = access_bible::bibles (std::addressof(webserver_request), username); + vector bibles = access_bible::bibles (webserver_request, username); string checksum = checksum_logic::get (bibles); string s_bibles = filter::strings::implode (bibles, "\n"); return checksum + "\n" + s_bibles; diff --git a/sync/notes.cpp b/sync/notes.cpp index 71b92c5bb..8379ef551 100644 --- a/sync/notes.cpp +++ b/sync/notes.cpp @@ -108,7 +108,7 @@ string sync_notes (Webserver_Request& webserver_request) switch (action) { case Sync_Logic::notes_get_total: { - vector bibles = access_bible::bibles (std::addressof(webserver_request), user); + vector bibles = access_bible::bibles (webserver_request, user); vector identifiers = database_notes.get_notes_in_range_for_bibles (lowId, highId, bibles, false); // Checksum cache to speed things up in case of thousands of notes. // Else the server would run at 100% CPU usage for some time to get the total checksums of notes. @@ -122,7 +122,7 @@ string sync_notes (Webserver_Request& webserver_request) } case Sync_Logic::notes_get_identifiers: { - vector bibles = access_bible::bibles (std::addressof(webserver_request), user); + vector bibles = access_bible::bibles (webserver_request, user); vector identifiers = database_notes.get_notes_in_range_for_bibles (lowId, highId, bibles, false); string response; for (auto id : identifiers) { diff --git a/user/notifications.cpp b/user/notifications.cpp index 7671f6efe..7fb76f121 100644 --- a/user/notifications.cpp +++ b/user/notifications.cpp @@ -52,7 +52,7 @@ bool user_notifications_acl (Webserver_Request& webserver_request) if (access_logic::privilege_view_notes (std::addressof(webserver_request))) return true; // Whoever has access to a Bible has access to this page. - auto [ read, write ] = access_bible::any (std::addressof(webserver_request)); + auto [ read, write ] = access_bible::any (webserver_request); if (read) return true; // No access. @@ -202,7 +202,7 @@ string user_notifications (Webserver_Request& webserver_request) // The set of Bibles the user can choose // is limited to those Bibles the user has read access to. { - vector bibles = access_bible::bibles (std::addressof(webserver_request)); + vector bibles = access_bible::bibles (webserver_request); for (const auto& bible : bibles) { if (checkbox == "changenotificationbible" + bible) { vector currentbibles = database_config_user.getChangeNotificationsBibles(); @@ -244,7 +244,7 @@ string user_notifications (Webserver_Request& webserver_request) view.set_variable ("url", client_logic_link_to_cloud (user_notifications_url (), translate("You can set the notifications in Bibledit Cloud."))); // The bits accessible to the user depends on the user's privileges. - auto [ read_bible, write_bible ] = access_bible::any (std::addressof(webserver_request)); + auto [ read_bible, write_bible ] = access_bible::any (webserver_request); if (read_bible) view.enable_zone ("readbible"); if (write_bible)