Skip to content

Commit

Permalink
Merge branch 'release/3.x/3.7.0' into 3.x-master
Browse files Browse the repository at this point in the history
  • Loading branch information
Ruwan committed Jan 23, 2024
2 parents a1c5caf + 605e25b commit d639078
Show file tree
Hide file tree
Showing 20 changed files with 460 additions and 226 deletions.
32 changes: 19 additions & 13 deletions .tugboat/config.yml
@@ -1,7 +1,17 @@
services:

mysql:
image: tugboatqa/mysql:5
database:
# Use the latest available 5.x version of MySQL
image: tugboatqa/mariadb:10.5

# A set of commands to run while building this service
commands:
# Configure the server for the site to run on.
init:
# Increase the allowed packet size to 512MB.
- mysql -e "SET GLOBAL max_allowed_packet=536870912;"
# Ensure this packet size persists even if MySQL restarts.
- echo "max_allowed_packet=536870912" >> /etc/mysql/conf.d/tugboat.cnf

app:
image: tugboatqa/php:8.1-apache
Expand All @@ -10,7 +20,7 @@ services:
# 2. Exposes port 80 to the Tugboat HTTP proxy
# 3. Routes requests to the preview URL to this service
default: true
depends: mysql
depends: database
visualdiffs:
:default:
- /
Expand All @@ -31,9 +41,6 @@ services:
# Clean up. This keeps image storage tighter on Tugboat.
- apt-get autoclean && apt-get clean

# Install drush-launcher.
- wget -O /usr/local/bin/drush https://github.com/drush-ops/drush-launcher/releases/download/0.6.0/drush.phar && chmod +x /usr/local/bin/drush

# Install/update packages managed by composer, including drush.
- composer selfupdate && composer clear
- COMPOSER_MEMORY_LIMIT=-1 composer install --prefer-dist
Expand Down Expand Up @@ -69,14 +76,13 @@ services:
- chmod 0664 ${DOCROOT}/sites/default/default.services.yml

# Install the site.
- drush -r "${DOCROOT}" site:install govcms install_configure_form.update_status_module='array(FALSE,FALSE)' -y
- bin/drush -r "${DOCROOT}" site:install govcms install_configure_form.update_status_module='array(FALSE,FALSE)' -y
- bin/drush en module_permissions -y

# Commands when building a new branch/PR update.
build:
- COMPOSER_MEMORY_LIMIT=-1 composer update
- drush cache:rebuild
# Partial importing is still having some issues with Drush 10 and Drupal 9.
#- drush config-import --partial --source="${TUGBOAT_ROOT}/config/test" -y
- drush en module_permissions -y
- drush updatedb -y
- drush cache:rebuild
- bin/drush cache:rebuild
- bin/drush config-import --partial --source="${TUGBOAT_ROOT}/config/test" -y
- bin/drush updatedb -y
- bin/drush cache:rebuild
2 changes: 1 addition & 1 deletion .tugboat/settings.php
Expand Up @@ -14,7 +14,7 @@
'username' => 'tugboat',
'password' => 'tugboat',
'prefix' => '',
'host' => 'mysql',
'host' => 'database',
'port' => '3306',
'namespace' => 'Drupal\\Core\\Database\\Driver\\mysql',
'driver' => 'mysql',
Expand Down
14 changes: 7 additions & 7 deletions composer.json
Expand Up @@ -48,8 +48,8 @@
"drupal/consumers": "1.17.0",
"drupal/contact_storage": "1.3.0",
"drupal/context": "5.0.0-rc1",
"drupal/core-composer-scaffold": "10.1.6",
"drupal/core-recommended": "10.1.6",
"drupal/core-composer-scaffold": "10.1.7",
"drupal/core-recommended": "10.1.7",
"drupal/crop": "2.3.0",
"drupal/ctools": "3.14.0",
"drupal/devel": "5.1.2",
Expand Down Expand Up @@ -84,11 +84,11 @@
"drupal/media_file_delete": "1.3.0",
"drupal/media_vimeo_domain_privacy": "1.1",
"drupal/menu_block": "1.10.0",
"drupal/menu_trail_by_path": "2.0.0",
"drupal/menu_trail_by_path": "2.0.1",
"drupal/metatag": "2.0.0",
"drupal/migrate_file": "2.1.2",
"drupal/migrate_plus": "6.0.1",
"drupal/migrate_source_csv": "3.5.0",
"drupal/migrate_source_csv": "3.6.0",
"drupal/migrate_tools": "6.0.2",
"drupal/minisite": "2.0.0",
"drupal/modifiers": "1.5.0",
Expand All @@ -111,14 +111,14 @@
"drupal/securitytxt": "1.4.0",
"drupal/shield": "1.7.0",
"drupal/simple_oauth": "5.2.5",
"drupal/simple_sitemap": "4.1.6",
"drupal/simple_sitemap": "4.1.8",
"drupal/swiftmailer": "2.4.0",
"drupal/symfony_mailer": "1.4.0",
"drupal/tfa": "1.3.0",
"drupal/tfa": "1.4.0",
"drupal/token": "1.13.0",
"drupal/twig_tweak": "3.2.1",
"drupal/username_enumeration_prevention": "1.3.0",
"drupal/webform": "6.2.0",
"drupal/webform": "6.2.2",
"egulias/email-validator": "4.0.1 as 3.2.6",
"govcms-assets/chosen": "2.2.1",
"oomphinc/composer-installers-extender": "^2.0",
Expand Down
Expand Up @@ -19,7 +19,7 @@ policy_constraints:
id: password_length
character_length: 14
character_operation: minimum
send_reset_email: 0
send_reset_email: false
send_pending_email:
- 0
roles:
Expand Down
2 changes: 1 addition & 1 deletion config/test/encrypt.profile.tfa_encryption.yml
Expand Up @@ -8,5 +8,5 @@ dependencies:
id: tfa_encryption
label: 'TFA Encryption'
encryption_method: real_aes
encryption_key: tfa_key
encryption_method_configuration: { }
encryption_key: tfa_key
4 changes: 2 additions & 2 deletions config/test/key.key.tfa_key.yml
Expand Up @@ -9,8 +9,8 @@ key_type_settings:
key_size: 256
key_provider: config
key_provider_settings:
base64_encoded: false
key_value: 'UGN~?-#RfgR+wJg4Yh/Sp2~Z^wb{C^2X'
base64_encoded: false
key_input: text_field
key_input_settings:
base64_encoded: false
base64_encoded: false
32 changes: 19 additions & 13 deletions config/test/tfa.settings.yml
@@ -1,44 +1,50 @@
enabled: 1
enabled: true
required_roles:
authenticated: authenticated
govcms_content_author: '0'
govcms_content_approver: '0'
govcms_site_administrator: '0'
send_plugins: { }
login_plugins: { }
login_plugin_settings:
tfa_trusted_browser:
cookie_allow_subdomains: true
cookie_expiration: 30
cookie_name: tfa-trusted-browser
allowed_validation_plugins:
tfa_email_code: tfa_email_code
default_validation_plugin: tfa_email_code
validation_plugin_settings:
tfa_email_code:
code_validity_period: 60
email_setting:
subject: '[site:name] Authentication code'
body: "[user:display-name],\r\n\r\nThis code is valid for [length] minutes. Your code is: [code]\r\n\r\nThis code will be expired after login."
tfa_hotp:
counter_window: 10
site_name_prefix: 1
name_prefix: TFA
issuer: GovCMS
tfa_recovery_code:
recovery_codes_amount: 10
tfa_totp:
time_skew: 2
site_name_prefix: 1
name_prefix: TFA
issuer: GovCMS
tfa_email_code:
code_validity_period: 60
email_setting:
subject: '[site:name] Authentication code'
body: "[user:display-name],\r\n\r\nThis code is valid for [length] minutes. Your code is: [code]\r\n\r\nThis code will be expired after login."
tfa_recovery_code:
recovery_codes_amount: 10
allowed_validation_plugins:
tfa_email_code: tfa_email_code
help_text: 'Contact support to reset your access'
validation_skip: 3
reset_pass_skip_enabled: true
encryption: tfa_encryption
trust_cookie_expiration: 2592000
cookie_name: TFA
tfa_flood_uid_only: 1
tfa_flood_window: 300
tfa_flood_threshold: 6
help_text: 'Contact support to reset your access'
mail:
tfa_enabled_configuration:
subject: 'Your [site:name] account now has two-factor authentication'
body: "[user:display-name],\r\n\r\nThanks for configuring two-factor authentication on your [site:name] account!\r\n\r\nThis additional level of security will help to ensure that only you are able to log in to your account.\r\n\r\nIf you ever lose the device you configured, you should act quickly to delete its association with this account.\r\n\r\n--\r\n[site:name] team"
tfa_disabled_configuration:
subject: 'Your [site:name] account no longer has two-factor authentication'
body: "[user:display-name],\r\n\r\nTwo-factor authentication has been disabled on your [site:name] account.\r\n\r\nIf you did not take this action, please contact a site administrator immediately.\r\n\r\n--\r\n[site:name] team"
trust_cookie_expiration: 2592000
cookie_name: TFA
4 changes: 4 additions & 0 deletions docker-compose.yml
Expand Up @@ -13,6 +13,8 @@ services:
- /var/www/html/sites
- $PWD/modules:/app/web/profiles/govcms/modules
- $PWD/themes:/app/web/profiles/govcms/themes
- $PWD/src:/app/web/profiles/govcms/src
- $PWD/tests:/app/web/profiles/govcms/tests
develop:
watch:
- action: sync
Expand All @@ -21,6 +23,8 @@ services:
ignore:
- modules/
- themes/
- src/
- tests/
- action: rebuild
path: composer.json

Expand Down
2 changes: 1 addition & 1 deletion govcms.info.yml
Expand Up @@ -3,7 +3,7 @@ type: profile
description: 'A GovCMS Drupal Distribution for government and the public sector in Australia.'
core_version_requirement: ^10
project: 'govcms'
version: '3.6.0'
version: '3.7.0'

distribution:
name: GovCMS
Expand Down
121 changes: 41 additions & 80 deletions govcms.install
Expand Up @@ -8,124 +8,85 @@
use Drupal\shortcut\Entity\Shortcut;
use Drupal\menu_link_content\Entity\MenuLinkContent;

// Define a default theme constant.
const GOVCMS_DEFAULT_THEME = 'govcms_bartik';

// Define the admin theme.
const GOVCMS_DEFAULT_ADMIN_THEME = 'claro';

// GovCMS update hooks.
include_once __DIR__ . '/includes/govcms.update.inc';

/**
* Implements hook_install().
*
* Perform actions to set up the site for GovCMS Profile.
* Sets up the GovCMS profile during installation.
*
* @see system_install()
*/
function govcms_install() {
// Restrict user registration to admin role creation.
\Drupal::configFactory()
->getEditable('user.settings')
->set('register', \Drupal\user\UserInterface::REGISTER_ADMINISTRATORS_ONLY)
->save(TRUE);

// Populate the default shortcut set.
Shortcut::create(
[
'shortcut_set' => 'default',
'title' => t('Add content'),
'weight' => 1,
'link' => ['uri' => 'internal:/node/add'],
]
)->save();
// Create default shortcut for adding content.
Shortcut::create([
'shortcut_set' => 'default',
'title' => t('Add content'),
'weight' => 1,
'link' => ['uri' => 'internal:/node/add'],
])->save();

MenuLinkContent::create(
[
'title' => 'Accessibility',
// Create footer menu links.
$footerMenuLinks = ['Accessibility', 'Copyright', 'Disclaimers', 'Privacy'];
foreach ($footerMenuLinks as $linkTitle) {
MenuLinkContent::create([
'title' => $linkTitle,
'link' => ['uri' => 'https://www.govcms.gov.au'],
'menu_name' => 'footer',
]
)->save();
])->save();
}

MenuLinkContent::create(
// Create custom menu links.
$customMenuLinks = [
[
'title' => 'Copyright',
'link' => ['uri' => 'https://www.govcms.gov.au'],
'menu_name' => 'footer',
]
)->save();

MenuLinkContent::create(
'title' => 'Our community',
'path' => '/our-community',
'menu_name' => 'govcms-community',
],
[
'title' => 'Disclaimers',
'link' => ['uri' => 'https://www.govcms.gov.au'],
'menu_name' => 'footer',
]
)->save();

MenuLinkContent::create(
[
'title' => 'Privacy',
'link' => ['uri' => 'https://www.govcms.gov.au'],
'menu_name' => 'footer',
]
)->save();

MenuLinkContent::create([
'title' => 'Our community',
'link' => ['uri' => 'https://www.govcms.gov.au/our-community'],
'menu_name' => 'govcms-community',
])->save();

MenuLinkContent::create([
'title' => 'About GovCMS',
'link' => ['uri' => 'https://www.govcms.gov.au/about'],
'menu_name' => 'govcms-about',
])->save();
'title' => 'About GovCMS',
'path' => '/about',
'menu_name' => 'govcms-about',
],
];
foreach ($customMenuLinks as $customLink) {
MenuLinkContent::create([
'title' => $customLink['title'],
'link' => ['uri' => 'https://www.govcms.gov.au' . $customLink['path']],
'menu_name' => $customLink['menu_name'],
])->save();
}

// Don't do anything else during config sync.
// Skip further actions during config sync.
if (\Drupal::isConfigSyncing()) {
return;
}

// Set front page to "node".
$frontPagePath = '/node';
\Drupal::configFactory()
->getEditable('system.site')
->set('page.front', '/node')
->save(TRUE);

// Set the default and admin theme.
\Drupal::configFactory()
->getEditable('system.theme')
->set('default', GOVCMS_DEFAULT_THEME)
->set('admin', GOVCMS_DEFAULT_ADMIN_THEME)
->save(TRUE);

// Enable the admin theme.
\Drupal::configFactory()
->getEditable('node.settings')
->set('use_admin_theme', TRUE)
->set('page.front', $frontPagePath)
->save(TRUE);

// Set the path to the logo, favicon and README file based on install directory.
$govcms_path = \Drupal::service('extension.list.profile')->getPath('govcms');
// Set paths for the logo, favicon, and README file based on install directory.
$govcmsPath = \Drupal::service('extension.list.profile')->getPath('govcms');
\Drupal::configFactory()
->getEditable('system.theme.global')
->set('logo', [
'path' => $govcms_path . '/logo.svg',
'path' => $govcmsPath . '/logo.svg',
'url' => '',
'use_default' => TRUE,
])
->set('favicon', [
'mimetype' => 'image/vnd.microsoft.icon',
'path' => $govcms_path . '/favicon.ico',
'path' => $govcmsPath . '/favicon.ico',
'url' => '',
'use_default' => FALSE,
])
->save(TRUE);

// Grant the default permissions.
// Grant default permissions.
govcms_default_permissions();
}

0 comments on commit d639078

Please sign in to comment.