Skip to content
Snippets Groups Projects
Commit ccd74e76 authored by totten's avatar totten
Browse files

CRM-12499 - Allow users with 'access user profiles' access to userRecordUrl

----------------------------------------
* CRM-12499: Allow users with 'access user profiles' to access $userRecordUrl
  http://issues.civicrm.org/jira/browse/CRM-12499
parent cc222cb6
Branches
Tags
No related merge requests found
......@@ -340,14 +340,14 @@ class CRM_Contact_Page_View extends CRM_Core_Page {
* Add urls for display in the actions menu
*/
static function addUrls(&$obj, $cid) {
// TODO rewrite without so many hard-coded CMS bits; use abstractions like CRM_Core_Permission::check('cms:...') and CRM_Utils_System
$config = CRM_Core_Config::singleton();
$session = CRM_Core_Session::singleton();
$uid = CRM_Core_BAO_UFMatch::getUFId($cid);
if ($uid) {
// To do: we should also allow drupal users with CRM_Core_Permission::check( 'view user profiles' ) true to access $userRecordUrl
// but this is currently returning false regardless of permission set for the role. dgg
if ($config->userSystem->is_drupal == '1' &&
($session->get('userID') == $cid || CRM_Core_Permission::check('administer users'))
($session->get('userID') == $cid || CRM_Core_Permission::checkAnyPerm(array('cms:administer users', 'cms:view user account')))
) {
$userRecordUrl = CRM_Utils_System::url('user/' . $uid);
}
......
......@@ -73,6 +73,7 @@ class CRM_Core_Permission_Drupal extends CRM_Core_Permission_DrupalBase{
function check($str, $contactID = NULL) {
$str = $this->translatePermission($str, 'Drupal', array(
'view user account' => 'access user profiles',
'administer users' => 'administer users',
));
if ($str == CRM_Core_Permission::ALWAYS_DENY_PERMISSION) {
return FALSE;
......
......@@ -72,6 +72,7 @@ class CRM_Core_Permission_Drupal6 extends CRM_Core_Permission_DrupalBase {
function check($str, $contactID = NULL) {
$str = $this->translatePermission($str, 'Drupal6', array(
'view user account' => 'access user profiles',
'administer users' => 'administer users',
));
if ($str == CRM_Core_Permission::ALWAYS_DENY_PERMISSION) {
return FALSE;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment