diff --git a/CRM/ACL/BAO/ACL.php b/CRM/ACL/BAO/ACL.php index 12f8c6a3c7fb..5e0e81790193 100644 --- a/CRM/ACL/BAO/ACL.php +++ b/CRM/ACL/BAO/ACL.php @@ -540,7 +540,7 @@ public static function getObjectIdOptions($context, $params): array { return []; } if (!empty($params['values']['object_table:label'])) { - $table_name = array_flip(self::operationTables())[$params['values']['object_table:label']]; + $table_name = array_flip(self::getObjectTableOptions())[$params['values']['object_table:label']]; } else { $table_name = $params['values']['object_table']; diff --git a/CRM/ACL/Form/ACL.php b/CRM/ACL/Form/ACL.php index 3f65d8d7bcbd..7282113225a0 100644 --- a/CRM/ACL/Form/ACL.php +++ b/CRM/ACL/Form/ACL.php @@ -132,7 +132,6 @@ public function buildQuickForm() { $label = ts('Role'); $role = [ '-1' => ts('- select role -'), - '0' => ts('Everyone'), ] + CRM_Core_OptionGroup::values('acl_role'); $this->add('select', 'entity_id', $label, $role, TRUE); diff --git a/CRM/Upgrade/Incremental/php/FiveSixtyFour.php b/CRM/Upgrade/Incremental/php/FiveSixtyFour.php index fdd22f175764..10d18a85d0b9 100644 --- a/CRM/Upgrade/Incremental/php/FiveSixtyFour.php +++ b/CRM/Upgrade/Incremental/php/FiveSixtyFour.php @@ -31,6 +31,7 @@ public function upgrade_5_64_alpha1($rev): void { $this->addTask('Add priority column onto ACL table', 'addColumn', 'civicrm_acl', 'priority', 'int NOT NULL DEFAULT 0'); $this->addTask(ts('Upgrade DB to %1: SQL', [1 => $rev]), 'runSql', $rev); $this->addTask('Update post_URL/cancel_URL in logging tables', 'updateLogging'); + $this->addTask('Add in Everybody ACL Role option value', 'addEveryBodyAclOptionValue'); } public static function updateLogging($ctx): bool { @@ -44,4 +45,16 @@ public static function updateLogging($ctx): bool { return TRUE; } + public static function addEverybodyAclOptionValue($ctx): bool { + \CRM_Core_BAO_OptionValue::ensureOptionValueExists([ + 'label' => 'Everybody', + 'value' => 0, + 'option_group_id' => 'acl_role', + 'is_active' => 1, + 'name' => 'Everybody', + 'is_reserved' => 1, + ]); + return TRUE; + } + } diff --git a/sql/civicrm_data/civicrm_option_group/acl_role.sqldata.php b/sql/civicrm_data/civicrm_option_group/acl_role.sqldata.php index 4caadde9cc3e..b53f59088a23 100644 --- a/sql/civicrm_data/civicrm_option_group/acl_role.sqldata.php +++ b/sql/civicrm_data/civicrm_option_group/acl_role.sqldata.php @@ -4,6 +4,12 @@ 'title' => ts('ACL Role'), ]) ->addValues([ + [ + 'label' => ts('Everyone'), + 'value' => 0, + 'name' => 'Everyone', + 'is_reserved' => 1, + ], [ 'label' => ts('Administrator'), 'value' => 1,