* @param string $str
* The permission to check.
*
- * @param null $contactID
+ * @param int $userId
*
* @return bool
*/
- public function check($str, $contactID = NULL) {
+ public function check($str, $userId = NULL) {
$str = $this->translatePermission($str, 'Drupal', array(
'view user account' => 'access user profiles',
));
if ($str == CRM_Core_Permission::ALWAYS_ALLOW_PERMISSION) {
return TRUE;
}
- return \Drupal::currentUser()->hasPermission($str);
+ $acct = $userId ? \Drupal\user\Entity\User::load($userId) : \Drupal::currentUser();
+ return $acct->hasPermission($str);
}
/**