From 72ee9c47a8d7397ffdaa03d286990458a08083e1 Mon Sep 17 00:00:00 2001 From: andrepereiradasilva Date: Sat, 17 Sep 2016 15:06:14 +0100 Subject: [PATCH 1/9] initial commit of uncouple guest_usergroup --- administrator/components/com_admin/script.php | 22 ++++++++ .../com_config/model/form/application.xml | 10 ++++ .../com_config/view/application/json.php | 1 + administrator/components/com_users/config.xml | 8 --- installation/configuration.php-dist | 1 + installation/model/configuration.php | 54 +++++++++++++++++++ libraries/cms/application/administrator.php | 3 +- libraries/cms/application/site.php | 3 +- libraries/cms/component/helper.php | 6 +++ libraries/joomla/access/access.php | 11 +--- 10 files changed, 98 insertions(+), 21 deletions(-) diff --git a/administrator/components/com_admin/script.php b/administrator/components/com_admin/script.php index c6fac8df2b7c5..95955e78e225a 100644 --- a/administrator/components/com_admin/script.php +++ b/administrator/components/com_admin/script.php @@ -33,6 +33,7 @@ public function update($installer) // This needs to stay for 2.5 update compatibility $this->deleteUnexistingFiles(); + $this->updateGlobalConfig(); $this->updateManifestCaches(); $this->updateDatabase(); $this->clearRadCache(); @@ -46,6 +47,27 @@ public function update($installer) $this->flushSessions(); } + /** + * Method to add new values to Global Config. + * + * @return void + * + * @since __DEPLOY_VERSION__ + */ + protected function updateGlobalConfig() + { + // Since __DEPLOY_VERSION__. Moves guest_usergroup option from com_users component to global config. + if (!JFactory::getApplication()->get('guest_usergroup', '')) + { + // Load the global config model. + JModelLegacy::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_config/model', 'ConfigModel'); + + // Add the new option to config. + $modelConfig = JModelLegacy::getInstance('Application', 'ConfigModel'); + $modelConfig->save(array('guest_usergroup' => JComponentHelper::getParams('com_users')->get('guest_usergroup', 1))); + } + } + /** * Method to clear our stats plugin cache to ensure we get fresh data on Joomla Update * diff --git a/administrator/components/com_config/model/form/application.xml b/administrator/components/com_config/model/form/application.xml index d68509812bbcd..9f9df0ab7ee63 100644 --- a/administrator/components/com_config/model/form/application.xml +++ b/administrator/components/com_config/model/form/application.xml @@ -902,6 +902,16 @@ description="COM_CONFIG_FIELD_DEFAULT_ACCESS_LEVEL_DESC" filter="integer" /> + + + null, "offline" => null, "access" => null, + "guest_usergroup" => null, "list_limit" => null, "MetaDesc" => null, "MetaKeys" => null, diff --git a/administrator/components/com_users/config.xml b/administrator/components/com_users/config.xml index 723290e5c5ef8..704bd4feadd1b 100644 --- a/administrator/components/com_users/config.xml +++ b/administrator/components/com_users/config.xml @@ -23,14 +23,6 @@ showon="allowUserRegistration:1"> - - - guest_usergroup = $this->getGuestUserGroup(1); + // Attempt to create the configuration. if (!$this->createConfiguration($options)) { @@ -48,6 +51,56 @@ public function setup($options) return true; } + /** + * Method to get the guest user group based on the usergroups table. + * + * @param integer $default The default guest user group. + * + * @return integer The guest user group id. + * + * @since __DEPLOY_VERSION__ + */ + private function getGuestUserGroup($default = 1) + { + // Get a database object. + try + { + $db = InstallationHelperDatabase::getDbo( + $options->db_type, + $options->db_host, + $options->db_user, + $options->db_pass, + $options->db_name, + $options->db_prefix + ); + } + catch (RuntimeException $e) + { + JFactory::getApplication()->enqueueMessage(JText::sprintf('INSTL_ERROR_CONNECT_DB', $e->getMessage()), 'error'); + + return false; + } + + // Quey to get the guest user group. + $query = $db->getQuery(true) + ->select($db->quoteName('id')) + ->from($db->quoteName('#__usergroups')) + ->where($db->quoteName('title') . ' = ' . $db->quote('Guest')); + + $db->setQuery($query); + + try + { + return (int) $db->loadResult(); + } + catch (RuntimeException $e) + { + return $default; + } + + return $default; + } + /** * Method to create the configuration file * @@ -72,6 +125,7 @@ public function createConfiguration($options) $registry->set('captcha', '0'); $registry->set('list_limit', 20); $registry->set('access', 1); + $registry->set('guest_usergroup', $options->guest_usergroup); // Debug settings. $registry->set('debug', 0); diff --git a/libraries/cms/application/administrator.php b/libraries/cms/application/administrator.php index de59ef7b34734..c0847a94562f6 100644 --- a/libraries/cms/application/administrator.php +++ b/libraries/cms/application/administrator.php @@ -253,8 +253,7 @@ protected function initialiseApp($options = array()) // If the user is a guest we populate it with the guest user group. if ($user->guest) { - $guestUsergroup = JComponentHelper::getParams('com_users')->get('guest_usergroup', 1); - $user->groups = array($guestUsergroup); + $user->groups = array($this->get('guest_usergroup', 1)); } // If a language was specified it has priority, otherwise use user or default language settings diff --git a/libraries/cms/application/site.php b/libraries/cms/application/site.php index 3cc6e61858b99..9fae477c6a0ec 100644 --- a/libraries/cms/application/site.php +++ b/libraries/cms/application/site.php @@ -586,8 +586,7 @@ protected function initialiseApp($options = array()) // If the user is a guest we populate it with the guest user group. if ($user->guest) { - $guestUsergroup = JComponentHelper::getParams('com_users')->get('guest_usergroup', 1); - $user->groups = array($guestUsergroup); + $user->groups = array($this->get('guest_usergroup', 1)); } /* diff --git a/libraries/cms/component/helper.php b/libraries/cms/component/helper.php index 80432fdd9ad29..276b0353b7be7 100644 --- a/libraries/cms/component/helper.php +++ b/libraries/cms/component/helper.php @@ -63,6 +63,12 @@ public static function getComponent($option, $strict = false) static::$components[$option]->params = $temp; } + // Remove in 4.0. For B/C we override the com_users guest_usergroup params for the global config one. + if ($option === 'com_users') + { + static::$components[$option]->params->guest_usergroup = JFactory::getApplication()->get('guest_usergroup', 1); + } + return $result; } diff --git a/libraries/joomla/access/access.php b/libraries/joomla/access/access.php index d89ac207832ad..74b8af7706c5f 100644 --- a/libraries/joomla/access/access.php +++ b/libraries/joomla/access/access.php @@ -788,15 +788,8 @@ public static function getGroupsByUser($userId, $recursive = true) if (!isset(self::$groupsByUser[$storeId])) { - // TODO: Uncouple this from JComponentHelper and allow for a configuration setting or value injection. - if (class_exists('JComponentHelper')) - { - $guestUsergroup = JComponentHelper::getParams('com_users')->get('guest_usergroup', 1); - } - else - { - $guestUsergroup = 1; - } + // Get the guest user group. + $guestUsergroup = $this->get('guest_usergroup', 1); // Guest user (if only the actually assigned group is requested) if (empty($userId) && !$recursive) From ccaf50625a842d914fad72888a6aa20146234201 Mon Sep 17 00:00:00 2001 From: andrepereiradasilva Date: Sat, 17 Sep 2016 16:28:37 +0100 Subject: [PATCH 2/9] remove guest usergroup param from com_users sql params --- installation/sql/mysql/joomla.sql | 2 +- installation/sql/mysql/sample_learn.sql | 2 -- installation/sql/mysql/sample_testing.sql | 2 -- installation/sql/postgresql/joomla.sql | 2 +- installation/sql/sqlazure/joomla.sql | 2 +- 5 files changed, 3 insertions(+), 7 deletions(-) diff --git a/installation/sql/mysql/joomla.sql b/installation/sql/mysql/joomla.sql index 89c0e7bcf212c..72bf0e573cc75 100644 --- a/installation/sql/mysql/joomla.sql +++ b/installation/sql/mysql/joomla.sql @@ -507,7 +507,7 @@ INSERT INTO `#__extensions` (`extension_id`, `name`, `type`, `element`, `folder` (22, 'com_content', 'component', 'com_content', '', 1, 1, 0, 1, '', '{"article_layout":"_:default","show_title":"1","link_titles":"1","show_intro":"1","show_category":"1","link_category":"1","show_parent_category":"0","link_parent_category":"0","show_author":"1","link_author":"0","show_create_date":"0","show_modify_date":"0","show_publish_date":"1","show_item_navigation":"1","show_vote":"0","show_readmore":"1","show_readmore_title":"1","readmore_limit":"100","show_icons":"1","show_print_icon":"1","show_email_icon":"1","show_hits":"1","show_noauth":"0","show_publishing_options":"1","show_article_options":"1","save_history":"1","history_limit":10,"show_urls_images_frontend":"0","show_urls_images_backend":"1","targeta":0,"targetb":0,"targetc":0,"float_intro":"left","float_fulltext":"left","category_layout":"_:blog","show_category_title":"0","show_description":"0","show_description_image":"0","maxLevel":"1","show_empty_categories":"0","show_no_articles":"1","show_subcat_desc":"1","show_cat_num_articles":"0","show_base_description":"1","maxLevelcat":"-1","show_empty_categories_cat":"0","show_subcat_desc_cat":"1","show_cat_num_articles_cat":"1","num_leading_articles":"1","num_intro_articles":"4","num_columns":"2","num_links":"4","multi_column_order":"0","show_subcategory_content":"0","show_pagination_limit":"1","filter_field":"hide","show_headings":"1","list_show_date":"0","date_format":"","list_show_hits":"1","list_show_author":"1","orderby_pri":"order","orderby_sec":"rdate","order_date":"published","show_pagination":"2","show_pagination_results":"1","show_feed_link":"1","feed_summary":"0"}', '', '', 0, '0000-00-00 00:00:00', 0, 0), (23, 'com_config', 'component', 'com_config', '', 1, 1, 0, 1, '', '{"filters":{"1":{"filter_type":"NH","filter_tags":"","filter_attributes":""},"6":{"filter_type":"BL","filter_tags":"","filter_attributes":""},"7":{"filter_type":"NONE","filter_tags":"","filter_attributes":""},"2":{"filter_type":"NH","filter_tags":"","filter_attributes":""},"3":{"filter_type":"BL","filter_tags":"","filter_attributes":""},"4":{"filter_type":"BL","filter_tags":"","filter_attributes":""},"5":{"filter_type":"BL","filter_tags":"","filter_attributes":""},"10":{"filter_type":"BL","filter_tags":"","filter_attributes":""},"12":{"filter_type":"BL","filter_tags":"","filter_attributes":""},"8":{"filter_type":"NONE","filter_tags":"","filter_attributes":""}}}', '', '', 0, '0000-00-00 00:00:00', 0, 0), (24, 'com_redirect', 'component', 'com_redirect', '', 1, 1, 0, 1, '', '', '', '', 0, '0000-00-00 00:00:00', 0, 0), -(25, 'com_users', 'component', 'com_users', '', 1, 1, 0, 1, '', '{"allowUserRegistration":"0","new_usertype":"2","guest_usergroup":"9","sendpassword":"1","useractivation":"1","mail_to_admin":"0","captcha":"","frontend_userparams":"1","site_language":"0","change_login_name":"0","reset_count":"10","reset_time":"1","minimum_length":"4","minimum_integers":"0","minimum_symbols":"0","minimum_uppercase":"0","save_history":"1","history_limit":5,"mailSubjectPrefix":"","mailBodySuffix":""}', '', '', 0, '0000-00-00 00:00:00', 0, 0), +(25, 'com_users', 'component', 'com_users', '', 1, 1, 0, 1, '', '{"allowUserRegistration":"0","new_usertype":"2","sendpassword":"1","useractivation":"1","mail_to_admin":"0","captcha":"","frontend_userparams":"1","site_language":"0","change_login_name":"0","reset_count":"10","reset_time":"1","minimum_length":"4","minimum_integers":"0","minimum_symbols":"0","minimum_uppercase":"0","save_history":"1","history_limit":5,"mailSubjectPrefix":"","mailBodySuffix":""}', '', '', 0, '0000-00-00 00:00:00', 0, 0), (27, 'com_finder', 'component', 'com_finder', '', 1, 1, 0, 0, '', '{"show_description":"1","description_length":255,"allow_empty_query":"0","show_url":"1","show_advanced":"1","expand_advanced":"0","show_date_filters":"0","highlight_terms":"1","opensearch_name":"","opensearch_description":"","batch_size":"50","memory_table_limit":30000,"title_multiplier":"1.7","text_multiplier":"0.7","meta_multiplier":"1.2","path_multiplier":"2.0","misc_multiplier":"0.3","stemmer":"snowball"}', '', '', 0, '0000-00-00 00:00:00', 0, 0), (28, 'com_joomlaupdate', 'component', 'com_joomlaupdate', '', 1, 1, 0, 1, '', '', '', '', 0, '0000-00-00 00:00:00', 0, 0), (29, 'com_tags', 'component', 'com_tags', '', 1, 1, 1, 1, '', '{"tag_layout":"_:default","save_history":"1","history_limit":5,"show_tag_title":"0","tag_list_show_tag_image":"0","tag_list_show_tag_description":"0","tag_list_image":"","show_tag_num_items":"0","tag_list_orderby":"title","tag_list_orderby_direction":"ASC","show_headings":"0","tag_list_show_date":"0","tag_list_show_item_image":"0","tag_list_show_item_description":"0","tag_list_item_maximum_characters":0,"return_any_or_all":"1","include_children":"0","maximum":200,"tag_list_language_filter":"all","tags_layout":"_:default","all_tags_orderby":"title","all_tags_orderby_direction":"ASC","all_tags_show_tag_image":"0","all_tags_show_tag_descripion":"0","all_tags_tag_maximum_characters":20,"all_tags_show_tag_hits":"0","filter_field":"1","show_pagination_limit":"1","show_pagination":"2","show_pagination_results":"1","tag_field_ajax_mode":"1","show_feed_link":"1"}', '', '', 0, '0000-00-00 00:00:00', 0, 0), diff --git a/installation/sql/mysql/sample_learn.sql b/installation/sql/mysql/sample_learn.sql index b92d1f2dd531e..9a85374a19382 100644 --- a/installation/sql/mysql/sample_learn.sql +++ b/installation/sql/mysql/sample_learn.sql @@ -766,6 +766,4 @@ INSERT IGNORE INTO `#__viewlevels` (`id`, `title`, `ordering`, `rules`) VALUES (5, 'Guest', 1, '[13]'), (6, 'Super Users', 5, '[8]'); -UPDATE `#__extensions` SET `params`='{"allowUserRegistration":"0","new_usertype":"2","guest_usergroup":"13","sendpassword":"1","useractivation":"1","mail_to_admin":"0","captcha":"","frontend_userparams":"1","site_language":"0","change_login_name":"0","reset_count":"10","reset_time":"1","mailSubjectPrefix":"","mailBodySuffix":"","save_history":"1","history_limit":5}' WHERE extension_id=25; - SET FOREIGN_KEY_CHECKS=1; diff --git a/installation/sql/mysql/sample_testing.sql b/installation/sql/mysql/sample_testing.sql index f2fa0a816234d..ea4927bb7100c 100644 --- a/installation/sql/mysql/sample_testing.sql +++ b/installation/sql/mysql/sample_testing.sql @@ -801,6 +801,4 @@ INSERT INTO `#__ucm_content` (`core_content_id`, `core_type_alias`, `core_title` (1, 'com_content.article', 'Joomla! Testing', 'joomla', '

Thanks for helping us to test Joomla!

We''re getting ready for the release of Joomla and we appreciate you helping us find and fix problems as we work.

If you haven''t done testing before here are some tips.

  • Don''t delete the installation folder when you finish installing! While we''re working we turn that security feature off to make it easier to test.
  • Go to global configuration and set Error Reporting to Development (that''s on the server tab) and enable both debugging and language debugging (those are on the system tab). Don''t worry when you see ** around words --that means Joomla translation is doing its job.

How to test

  • First, do the things you normally do and see if you spot any problems.
  • Look at all of the front end views and record any problems
  • Look at all the back end views and report any problems
  • See more ideas below

What to look for

  • Any error messages that say things like Fatal Error or Strict or similar things that indicate that something is not working correctly.
  • Untranslated strings. You will know these because they look like this: ?STRING_HERE?
  • Problems of rendering--items not aligned correctly, missing or wrong images, pages that just don''t look right.
  • Unexpected behavior--anything that is working differently than it did in 2.5.

Report problems

If you find a problem please report it to the CMS Issue Tracker. You will need to register for a github.com account if you don''t have one.

More Testing Ideas

  • Pick one module or view and test all of the parameters.
  • Install an extension and see if anything breaks (report to the developer unless you are positive it is a core bug).
  • Turn on caching with different options
  • Try different session options
  • Install a language and test all the layouts.
  • Try different environments (like different servers which may have different version of PHP) or try you have IIS with MySQLi or SqlSrv. With millions of users Joomla needs to be ready for unusual environments.
  • Try with SEF URLS on or off and also with Apache rewrite on or off (if you are on Apache).
  • Try different combinations of browsers (Chrome, IE, FireFox, Opera to start) and operating systems (Mac, Windows, Linux).
  • Yes grammar and spelling errors are bugs too -- just keep in mind that we use British spelling.
  • Visit the Feature Tracker and test a new feature.

Testing changes

You can also help Joomla by testing bug fixes and new features. A useful tool is the patchtester component which helps to simplify and automate the process. Report your feedback on the CMS Issue Tracker. If you enjoy helping Joomla this way, you may want to join the Joomla Bug Squad.

', 1, '', 0, 1, '{"show_title":"","link_titles":"","show_tags":"","show_intro":"","info_block_position":"","show_category":"","link_category":"","show_parent_category":"","link_parent_category":"","show_author":"","link_author":"","show_create_date":"","show_modify_date":"","show_publish_date":"","show_item_navigation":"","show_icons":"","show_print_icon":"","show_email_icon":"","show_vote":"","show_hits":"","show_noauth":"","urls_position":"","alternative_readmore":"","article_layout":""}', 1, '{"robots":"","author":"","rights":"","xreference":""}', 716, '', '2011-01-01 00:00:01', 0, '2013-10-15 14:57:20', '*', '2011-01-01 00:00:01', '0000-00-00 00:00:00', 24, 180, '{"image_intro":"","float_intro":"","image_intro_alt":"","image_intro_caption":"","image_fulltext":"","float_fulltext":"","image_fulltext_alt":"","image_fulltext_caption":""}', '{"urla":false,"urlatext":"","targeta":"","urlb":false,"urlbtext":"","targetb":"","urlc":false,"urlctext":"","targetc":""}', 59, 3, 2, '', '', 19, '', 1), (3, 'com_content.article', 'Similar Tags', 'similar-tags', '

The similar tags modules shows a list of items which have the same or a similar set of tags.

{loadmodule tags_similar,Similar Tags}

', 1, '', 0, 1, '{"show_title":"","link_titles":"","show_tags":"","show_intro":"","info_block_position":"","show_category":"","link_category":"","show_parent_category":"","link_parent_category":"","show_author":"","link_author":"","show_create_date":"","show_modify_date":"","show_publish_date":"","show_item_navigation":"","show_icons":"","show_print_icon":"","show_email_icon":"","show_vote":"","show_hits":"","show_noauth":"","urls_position":"","alternative_readmore":"","article_layout":"","show_publishing_options":"","show_article_options":"","show_urls_images_backend":"","show_urls_images_frontend":""}', 0, '{"robots":"","author":"","rights":"","xreference":""}', 371, '', '2013-10-31 00:14:17', 371, '2013-10-31 00:39:09', '*', '2013-10-31 00:14:17', '0000-00-00 00:00:00', 71, 179, '{"image_intro":"","float_intro":"","image_intro_alt":"","image_intro_caption":"","image_fulltext":"","float_fulltext":"","image_fulltext_alt":"","image_fulltext_caption":""}', '{"urla":false,"urlatext":"","targeta":"","urlb":false,"urlbtext":"","targetb":"","urlc":false,"urlctext":"","targetc":""}', 3, 4, 0, '', '', 64, '', 1); -UPDATE `#__extensions` SET `params`='{"allowUserRegistration":"0","new_usertype":"2","guest_usergroup":"13","sendpassword":"1","useractivation":"1","mail_to_admin":"0","captcha":"","frontend_userparams":"1","site_language":"0","change_login_name":"0","reset_count":"10","reset_time":"1","mailSubjectPrefix":"","mailBodySuffix":"","save_history":"1","history_limit":5}' WHERE extension_id=25; - SET FOREIGN_KEY_CHECKS=1; diff --git a/installation/sql/postgresql/joomla.sql b/installation/sql/postgresql/joomla.sql index f946df699fd41..2f9f93aaf389b 100644 --- a/installation/sql/postgresql/joomla.sql +++ b/installation/sql/postgresql/joomla.sql @@ -494,7 +494,7 @@ INSERT INTO "#__extensions" ("extension_id", "name", "type", "element", "folder" (22, 'com_content', 'component', 'com_content', '', 1, 1, 0, 1, '', '{"article_layout":"_:default","show_title":"1","link_titles":"1","show_intro":"1","show_category":"1","link_category":"1","show_parent_category":"0","link_parent_category":"0","show_author":"1","link_author":"0","show_create_date":"0","show_modify_date":"0","show_publish_date":"1","show_item_navigation":"1","show_vote":"0","show_readmore":"1","show_readmore_title":"1","readmore_limit":"100","show_icons":"1","show_print_icon":"1","show_email_icon":"1","show_hits":"1","show_noauth":"0","show_publishing_options":"1","show_article_options":"1","save_history":"1","history_limit":10,"show_urls_images_frontend":"0","show_urls_images_backend":"1","targeta":0,"targetb":0,"targetc":0,"float_intro":"left","float_fulltext":"left","category_layout":"_:blog","show_category_title":"0","show_description":"0","show_description_image":"0","maxLevel":"1","show_empty_categories":"0","show_no_articles":"1","show_subcat_desc":"1","show_cat_num_articles":"0","show_base_description":"1","maxLevelcat":"-1","show_empty_categories_cat":"0","show_subcat_desc_cat":"1","show_cat_num_articles_cat":"1","num_leading_articles":"1","num_intro_articles":"4","num_columns":"2","num_links":"4","multi_column_order":"0","show_subcategory_content":"0","show_pagination_limit":"1","filter_field":"hide","show_headings":"1","list_show_date":"0","date_format":"","list_show_hits":"1","list_show_author":"1","orderby_pri":"order","orderby_sec":"rdate","order_date":"published","show_pagination":"2","show_pagination_results":"1","show_feed_link":"1","feed_summary":"0"}', '', '', 0, '1970-01-01 00:00:00', 0, 0), (23, 'com_config', 'component', 'com_config', '', 1, 1, 0, 1, '', '{"filters":{"1":{"filter_type":"NH","filter_tags":"","filter_attributes":""},"6":{"filter_type":"BL","filter_tags":"","filter_attributes":""},"7":{"filter_type":"NONE","filter_tags":"","filter_attributes":""},"2":{"filter_type":"NH","filter_tags":"","filter_attributes":""},"3":{"filter_type":"BL","filter_tags":"","filter_attributes":""},"4":{"filter_type":"BL","filter_tags":"","filter_attributes":""},"5":{"filter_type":"BL","filter_tags":"","filter_attributes":""},"10":{"filter_type":"BL","filter_tags":"","filter_attributes":""},"12":{"filter_type":"BL","filter_tags":"","filter_attributes":""},"8":{"filter_type":"NONE","filter_tags":"","filter_attributes":""}}}', '', '', 0, '1970-01-01 00:00:00', 0, 0), (24, 'com_redirect', 'component', 'com_redirect', '', 1, 1, 0, 1, '', '', '', '', 0, '1970-01-01 00:00:00', 0, 0), -(25, 'com_users', 'component', 'com_users', '', 1, 1, 0, 1, '', '{"allowUserRegistration":"0","new_usertype":"2","guest_usergroup":"9","sendpassword":"1","useractivation":"1","mail_to_admin":"0","captcha":"","frontend_userparams":"1","site_language":"0","change_login_name":"0","reset_count":"10","reset_time":"1","minimum_length":"4","minimum_integers":"0","minimum_symbols":"0","minimum_uppercase":"0","save_history":"1","history_limit":5,"mailSubjectPrefix":"","mailBodySuffix":""}', '', '', 0, '1970-01-01 00:00:00', 0, 0), +(25, 'com_users', 'component', 'com_users', '', 1, 1, 0, 1, '', '{"allowUserRegistration":"0","new_usertype":"2","sendpassword":"1","useractivation":"1","mail_to_admin":"0","captcha":"","frontend_userparams":"1","site_language":"0","change_login_name":"0","reset_count":"10","reset_time":"1","minimum_length":"4","minimum_integers":"0","minimum_symbols":"0","minimum_uppercase":"0","save_history":"1","history_limit":5,"mailSubjectPrefix":"","mailBodySuffix":""}', '', '', 0, '1970-01-01 00:00:00', 0, 0), (27, 'com_finder', 'component', 'com_finder', '', 1, 1, 0, 0, '', '{"show_description":"1","description_length":255,"allow_empty_query":"0","show_url":"1","show_advanced":"1","expand_advanced":"0","show_date_filters":"0","highlight_terms":"1","opensearch_name":"","opensearch_description":"","batch_size":"50","memory_table_limit":30000,"title_multiplier":"1.7","text_multiplier":"0.7","meta_multiplier":"1.2","path_multiplier":"2.0","misc_multiplier":"0.3","stemmer":"snowball"}', '', '', 0, '1970-01-01 00:00:00', 0, 0), (28, 'com_joomlaupdate', 'component', 'com_joomlaupdate', '', 1, 1, 0, 1, '', '', '', '', 0, '1970-01-01 00:00:00', 0, 0), (29, 'com_tags', 'component', 'com_tags', '', 1, 1, 1, 1, '', '{"tag_layout":"_:default","save_history":"1","history_limit":5,"show_tag_title":"0","tag_list_show_tag_image":"0","tag_list_show_tag_description":"0","tag_list_image":"","show_tag_num_items":"0","tag_list_orderby":"title","tag_list_orderby_direction":"ASC","show_headings":"0","tag_list_show_date":"0","tag_list_show_item_image":"0","tag_list_show_item_description":"0","tag_list_item_maximum_characters":0,"return_any_or_all":"1","include_children":"0","maximum":200,"tag_list_language_filter":"all","tags_layout":"_:default","all_tags_orderby":"title","all_tags_orderby_direction":"ASC","all_tags_show_tag_image":"0","all_tags_show_tag_descripion":"0","all_tags_tag_maximum_characters":20,"all_tags_show_tag_hits":"0","filter_field":"1","show_pagination_limit":"1","show_pagination":"2","show_pagination_results":"1","tag_field_ajax_mode":"1","show_feed_link":"1"}', '', '', 0, '1970-01-01 00:00:00', 0, 0), diff --git a/installation/sql/sqlazure/joomla.sql b/installation/sql/sqlazure/joomla.sql index fc4e980e376c5..8beced9d0a8f5 100644 --- a/installation/sql/sqlazure/joomla.sql +++ b/installation/sql/sqlazure/joomla.sql @@ -790,7 +790,7 @@ SELECT 23, 'com_config', 'component', 'com_config', '', 1, 1, 0, 1, '', '{"filte UNION ALL SELECT 24, 'com_redirect', 'component', 'com_redirect', '', 1, 1, 0, 1, '', '', '', '', 0, '1900-01-01 00:00:00', 0, 0 UNION ALL -SELECT 25, 'com_users', 'component', 'com_users', '', 1, 1, 0, 1, '', '{"allowUserRegistration":"0","new_usertype":"2","guest_usergroup":"9","sendpassword":"1","useractivation":"1","mail_to_admin":"0","captcha":"","frontend_userparams":"1","site_language":"0","change_login_name":"0","reset_count":"10","reset_time":"1","minimum_length":"4","minimum_integers":"0","minimum_symbols":"0","minimum_uppercase":"0","save_history":"1","history_limit":5,"mailSubjectPrefix":"","mailBodySuffix":""}', '', '', 0, '1900-01-01 00:00:00', 0, 0 +SELECT 25, 'com_users', 'component', 'com_users', '', 1, 1, 0, 1, '', '{"allowUserRegistration":"0","new_usertype":"2","sendpassword":"1","useractivation":"1","mail_to_admin":"0","captcha":"","frontend_userparams":"1","site_language":"0","change_login_name":"0","reset_count":"10","reset_time":"1","minimum_length":"4","minimum_integers":"0","minimum_symbols":"0","minimum_uppercase":"0","save_history":"1","history_limit":5,"mailSubjectPrefix":"","mailBodySuffix":""}', '', '', 0, '1900-01-01 00:00:00', 0, 0 UNION ALL SELECT 27, 'com_finder', 'component', 'com_finder', '', 1, 1, 0, 0, '', '{"show_description":"1","description_length":255,"allow_empty_query":"0","show_url":"1","show_advanced":"1","expand_advanced":"0","show_date_filters":"0","highlight_terms":"1","opensearch_name":"","opensearch_description":"","batch_size":"50","memory_table_limit":30000,"title_multiplier":"1.7","text_multiplier":"0.7","meta_multiplier":"1.2","path_multiplier":"2.0","misc_multiplier":"0.3","stemmer":"snowball"}', '', '', 0, '1900-01-01 00:00:00', 0, 0 UNION ALL From 8e0f97fd75c7275b68cea0696f04c95d305d9fc3 Mon Sep 17 00:00:00 2001 From: andrepereiradasilva Date: Sat, 17 Sep 2016 16:32:33 +0100 Subject: [PATCH 3/9] bc in component --- libraries/cms/component/helper.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libraries/cms/component/helper.php b/libraries/cms/component/helper.php index 276b0353b7be7..d1a777cc47dee 100644 --- a/libraries/cms/component/helper.php +++ b/libraries/cms/component/helper.php @@ -66,7 +66,12 @@ public static function getComponent($option, $strict = false) // Remove in 4.0. For B/C we override the com_users guest_usergroup params for the global config one. if ($option === 'com_users') { - static::$components[$option]->params->guest_usergroup = JFactory::getApplication()->get('guest_usergroup', 1); + $app = JFactory::getApplication(); + + if ($guestUsergroup = $app->get('guest_usergroup', '')) + { + static::$components[$option]->params->guest_usergroup = $guestUsergroup; + } } return $result; From 771582c6a41ec9babe2edd2348cb85f6fd354716 Mon Sep 17 00:00:00 2001 From: andrepereiradasilva Date: Sat, 17 Sep 2016 16:51:10 +0100 Subject: [PATCH 4/9] Update access.php --- libraries/joomla/access/access.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/joomla/access/access.php b/libraries/joomla/access/access.php index 74b8af7706c5f..5fa71107c0e4c 100644 --- a/libraries/joomla/access/access.php +++ b/libraries/joomla/access/access.php @@ -789,7 +789,7 @@ public static function getGroupsByUser($userId, $recursive = true) if (!isset(self::$groupsByUser[$storeId])) { // Get the guest user group. - $guestUsergroup = $this->get('guest_usergroup', 1); + $guestUsergroup = JFactory::getApplication()->get('guest_usergroup', 1); // Guest user (if only the actually assigned group is requested) if (empty($userId) && !$recursive) From dc343883689a4d22b82573bd8ecf0c17ee1e4dbc Mon Sep 17 00:00:00 2001 From: andrepereiradasilva Date: Sat, 17 Sep 2016 16:56:27 +0100 Subject: [PATCH 5/9] need options ... --- installation/model/configuration.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/installation/model/configuration.php b/installation/model/configuration.php index 5f976f7a12d31..345d0d028c58b 100644 --- a/installation/model/configuration.php +++ b/installation/model/configuration.php @@ -34,7 +34,7 @@ public function setup($options) $options = ArrayHelper::toObject($options); // Update the guest user group id. - $options->guest_usergroup = $this->getGuestUserGroup(1); + $options->guest_usergroup = $this->getGuestUserGroup($options, 1); // Attempt to create the configuration. if (!$this->createConfiguration($options)) @@ -54,13 +54,14 @@ public function setup($options) /** * Method to get the guest user group based on the usergroups table. * + * @param array $options The session options. * @param integer $default The default guest user group. * * @return integer The guest user group id. * * @since __DEPLOY_VERSION__ */ - private function getGuestUserGroup($default = 1) + private function getGuestUserGroup($options, $default = 1) { // Get a database object. try From d1a7d5fc6814a5fa061021ce45ccdb6b3d739804 Mon Sep 17 00:00:00 2001 From: andrepereiradasilva Date: Sat, 17 Sep 2016 17:00:35 +0100 Subject: [PATCH 6/9] add new language vars --- administrator/language/en-GB/en-GB.com_config.ini | 2 ++ 1 file changed, 2 insertions(+) diff --git a/administrator/language/en-GB/en-GB.com_config.ini b/administrator/language/en-GB/en-GB.com_config.ini index 18e839c70933e..04fd3fd941eb5 100644 --- a/administrator/language/en-GB/en-GB.com_config.ini +++ b/administrator/language/en-GB/en-GB.com_config.ini @@ -65,6 +65,8 @@ COM_CONFIG_FIELD_DEFAULT_CAPTCHA_DESC="Select the default captcha for your site. COM_CONFIG_FIELD_DEFAULT_CAPTCHA_LABEL="Default Captcha" COM_CONFIG_FIELD_DEFAULT_FEED_LIMIT_DESC="Select the number of content items to show in the feed(s)." COM_CONFIG_FIELD_DEFAULT_FEED_LIMIT_LABEL="Default Feed Limit" +COM_CONFIG_FIELD_DEFAULT_GUEST_USER_GROUP_DESC="The default Group that will be applied to Guest (not logged-in) Users." +COM_CONFIG_FIELD_DEFAULT_GUEST_USER_GROUP_LABEL="Default Guest User Group" COM_CONFIG_FIELD_DEFAULT_LIST_LIMIT_DESC="Sets the default length of lists in the Control Panel for all users." COM_CONFIG_FIELD_DEFAULT_LIST_LIMIT_LABEL="Default List Limit" COM_CONFIG_FIELD_ERROR_REPORTING_DESC="Select the level of reporting. See the Help Screen for full details." From a56fff5f84a1e5ca5684069b0296f3814484b5b4 Mon Sep 17 00:00:00 2001 From: andrepereiradasilva Date: Sat, 17 Sep 2016 17:01:21 +0100 Subject: [PATCH 7/9] add new lang vars to xml --- .../components/com_config/model/form/application.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/administrator/components/com_config/model/form/application.xml b/administrator/components/com_config/model/form/application.xml index 9f9df0ab7ee63..eff6292c6732d 100644 --- a/administrator/components/com_config/model/form/application.xml +++ b/administrator/components/com_config/model/form/application.xml @@ -905,8 +905,8 @@ From 1235363850a3c87b472520dec995c51c13c3416e Mon Sep 17 00:00:00 2001 From: andrepereiradasilva Date: Sat, 17 Sep 2016 17:19:56 +0100 Subject: [PATCH 8/9] remove guest user group from unit test stubs --- tests/unit/stubs/database/jos_extensions.csv | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unit/stubs/database/jos_extensions.csv b/tests/unit/stubs/database/jos_extensions.csv index fade99bc3e65f..c470c7e924e8f 100644 --- a/tests/unit/stubs/database/jos_extensions.csv +++ b/tests/unit/stubs/database/jos_extensions.csv @@ -23,7 +23,7 @@ '22','com_content','component','com_content',,'1','1','0','1','{"name":"com_content","type":"component","creationDate":"April 2006","author":"Joomla! Project","copyright":"(C) 2005 - 2016 Open Source Matters. All rights reserved.\\t","authorEmail":"admin@joomla.org","authorUrl":"www.joomla.org","version":"3.0.0","description":"COM_CONTENT_XML_DESCRIPTION","group":""}','{"article_layout":"_:default","show_title":"1","link_titles":"1","show_intro":"1","show_category":"1","link_category":"1","show_parent_category":"0","link_parent_category":"0","show_author":"1","link_author":"0","show_create_date":"0","show_modify_date":"0","show_publish_date":"1","show_item_navigation":"1","show_vote":"0","show_readmore":"1","show_readmore_title":"1","readmore_limit":"100","show_icons":"1","show_print_icon":"1","show_email_icon":"1","show_hits":"1","show_noauth":"0","show_publishing_options":"1","show_article_options":"1","show_urls_images_frontend":"0","show_urls_images_backend":"1","targeta":0,"targetb":0,"targetc":0,"float_intro":"left","float_fulltext":"left","category_layout":"_:blog","show_category_title":"0","show_description":"0","show_description_image":"0","maxLevel":"1","show_empty_categories":"0","show_no_articles":"1","show_subcat_desc":"1","show_cat_num_articles":"0","show_base_description":"1","maxLevelcat":"-1","show_empty_categories_cat":"0","show_subcat_desc_cat":"1","show_cat_num_articles_cat":"1","num_leading_articles":"1","num_intro_articles":"4","num_columns":"2","num_links":"4","multi_column_order":"0","show_subcategory_content":"0","show_pagination_limit":"1","filter_field":"hide","show_headings":"1","list_show_date":"0","date_format":"","list_show_hits":"1","list_show_author":"1","orderby_pri":"order","orderby_sec":"rdate","order_date":"published","show_pagination":"2","show_pagination_results":"1","show_feed_link":"1","feed_summary":"0"}',,,'0','0000-00-00 00:00:00','0','0' '23','com_config','component','com_config',,'1','1','0','1','{"name":"com_config","type":"component","creationDate":"April 2006","author":"Joomla! Project","copyright":"(C) 2005 - 2016 Open Source Matters. All rights reserved.\\t","authorEmail":"admin@joomla.org","authorUrl":"www.joomla.org","version":"3.0.0","description":"COM_CONFIG_XML_DESCRIPTION","group":""}','{"filters":{"1":{"filter_type":"NH","filter_tags":"","filter_attributes":""},"6":{"filter_type":"BL","filter_tags":"","filter_attributes":""},"7":{"filter_type":"NONE","filter_tags":"","filter_attributes":""},"2":{"filter_type":"NH","filter_tags":"","filter_attributes":""},"3":{"filter_type":"BL","filter_tags":"","filter_attributes":""},"4":{"filter_type":"BL","filter_tags":"","filter_attributes":""},"5":{"filter_type":"BL","filter_tags":"","filter_attributes":""},"10":{"filter_type":"BL","filter_tags":"","filter_attributes":""},"12":{"filter_type":"BL","filter_tags":"","filter_attributes":""},"8":{"filter_type":"NONE","filter_tags":"","filter_attributes":""}}}',,,'0','0000-00-00 00:00:00','0','0' '24','com_redirect','component','com_redirect',,'1','1','0','1','{"name":"com_redirect","type":"component","creationDate":"April 2006","author":"Joomla! Project","copyright":"(C) 2005 - 2016 Open Source Matters. All rights reserved.\\t","authorEmail":"admin@joomla.org","authorUrl":"www.joomla.org","version":"3.0.0","description":"COM_REDIRECT_XML_DESCRIPTION","group":""}','{}',,,'0','0000-00-00 00:00:00','0','0' -'25','com_users','component','com_users',,'1','1','0','1','{"name":"com_users","type":"component","creationDate":"April 2006","author":"Joomla! Project","copyright":"(C) 2005 - 2016 Open Source Matters. All rights reserved.\\t","authorEmail":"admin@joomla.org","authorUrl":"www.joomla.org","version":"3.0.0","description":"COM_USERS_XML_DESCRIPTION","group":""}','{"allowUserRegistration":"0","new_usertype":"2","guest_usergroup":"13","sendpassword":"1","useractivation":"1","mail_to_admin":"0","captcha":"","frontend_userparams":"1","site_language":"0","change_login_name":"0","reset_count":"10","reset_time":"1","mailSubjectPrefix":"","mailBodySuffix":""}',,,'0','0000-00-00 00:00:00','0','0' +'25','com_users','component','com_users',,'1','1','0','1','{"name":"com_users","type":"component","creationDate":"April 2006","author":"Joomla! Project","copyright":"(C) 2005 - 2016 Open Source Matters. All rights reserved.\\t","authorEmail":"admin@joomla.org","authorUrl":"www.joomla.org","version":"3.0.0","description":"COM_USERS_XML_DESCRIPTION","group":""}','{"allowUserRegistration":"0","new_usertype":"2","sendpassword":"1","useractivation":"1","mail_to_admin":"0","captcha":"","frontend_userparams":"1","site_language":"0","change_login_name":"0","reset_count":"10","reset_time":"1","mailSubjectPrefix":"","mailBodySuffix":""}',,,'0','0000-00-00 00:00:00','0','0' '27','com_finder','component','com_finder',,'1','1','0','0','{"name":"com_finder","type":"component","creationDate":"August 2011","author":"Joomla! Project","copyright":"(C) 2005 - 2016 Open Source Matters. All rights reserved.","authorEmail":"admin@joomla.org","authorUrl":"www.joomla.org","version":"3.0.0","description":"COM_FINDER_XML_DESCRIPTION","group":""}','{"show_description":"1","description_length":255,"allow_empty_query":"0","show_url":"1","show_advanced":"1","expand_advanced":"0","show_date_filters":"0","highlight_terms":"1","opensearch_name":"","opensearch_description":"","batch_size":"50","memory_table_limit":30000,"title_multiplier":"1.7","text_multiplier":"0.7","meta_multiplier":"1.2","path_multiplier":"2.0","misc_multiplier":"0.3","stemmer":"snowball"}',,,'0','0000-00-00 00:00:00','0','0' '28','com_joomlaupdate','component','com_joomlaupdate',,'1','1','0','1','{"name":"com_joomlaupdate","type":"component","creationDate":"February 2012","author":"Joomla! Project","copyright":"(C) 2005 - 2016 Open Source Matters. All rights reserved.\\t","authorEmail":"admin@joomla.org","authorUrl":"www.joomla.org","version":"3.0.0","description":"COM_JOOMLAUPDATE_XML_DESCRIPTION","group":""}','{}',,,'0','0000-00-00 00:00:00','0','0' '29','com_tags','component','com_tags',,'1','1','1','1','{"name":"com_tags","type":"component","creationDate":"December 2013","author":"Joomla! Project","copyright":"(C) 2005 - 2016 Open Source Matters. All rights reserved.","authorEmail":"admin@joomla.org","authorUrl":"www.joomla.org","version":"3.1.0","description":"COM_TAGS_XML_DESCRIPTION","group":""}','{"show_tag_title":"0","tag_list_show_tag_image":"0","tag_list_show_tag_description":"0","tag_list_image":"","show_tag_num_items":"0","tag_list_orderby":"title","tag_list_orderby_direction":"ASC","show_headings":"0","tag_list_show_date":"0","tag_list_show_item_image":"0","tag_list_show_item_description":"0","tag_list_item_maximum_characters":0,"return_any_or_all":"1","include_children":"0","maximum":200,"tag_list_language_filter":"all","tags_layout":"_:default","all_tags_orderby":"title","all_tags_orderby_direction":"ASC","all_tags_show_tag_image":"0","all_tags_show_tag_descripion":"0","all_tags_tag_maximum_characters":20,"all_tags_show_tag_hits":"0","filter_field":"1","show_pagination_limit":"1","show_pagination":"2","show_pagination_results":"1","tag_field_ajax_mode":"1","show_feed_link":"1"}',,,'0','0000-00-00 00:00:00','0','0' From 28d019cc074e15734f5f9cdb464d9fec041294a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wojciech=20Smoli=C5=84ski?= Date: Wed, 21 Sep 2016 12:35:15 +0200 Subject: [PATCH 9/9] Simple CS fix --- administrator/components/com_config/model/form/application.xml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/administrator/components/com_config/model/form/application.xml b/administrator/components/com_config/model/form/application.xml index eff6292c6732d..efef4ab237282 100644 --- a/administrator/components/com_config/model/form/application.xml +++ b/administrator/components/com_config/model/form/application.xml @@ -909,8 +909,7 @@ description="COM_CONFIG_FIELD_DEFAULT_GUEST_USER_GROUP_DESC" default="1" filter="integer" - > - + />