Skip to content

Commit

Permalink
Refs #41489, Update reserved profile access check for User Account.
Browse files Browse the repository at this point in the history
  • Loading branch information
apple843119 committed Sep 11, 2024
1 parent 94b685f commit 420ceac
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions CRM/Profile/Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -198,9 +198,17 @@ function preProcess() {

// restrict permission when profile is reserved
if ($dao->is_reserved && !CRM_Core_Permission::check('access CiviCRM')) {
return CRM_Core_Error::statusBounce(ts('The requested Profile (gid=%1) is disabled OR it is not configured to be used for \'Profile\' listings in its Settings OR there is no Profile with that ID OR you do not have permission to access this profile. Please contact the site administrator if you need assistance.', array(
1 => $this->_gid
)));
$sql = "SELECT id FROM civicrm_uf_join WHERE uf_group_id = %1 and module = %2";
$params = array(
1 => array($dao->id, 'Integer'),
2 => array("User Account", 'String'),
);
$useForIsUserAccount = CRM_Core_DAO::singleValueQuery($sql, $params);
if (empty($useForIsUserAccount)) {
return CRM_Core_Error::statusBounce(ts('The requested Profile (gid=%1) is disabled OR it is not configured to be used for \'Profile\' listings in its Settings OR there is no Profile with that ID OR you do not have permission to access this profile. Please contact the site administrator if you need assistance.', array(
1 => $this->_gid
)));
}
}
}
$dao->free();
Expand Down

0 comments on commit 420ceac

Please sign in to comment.