Download & Extend

field permissions check fails when field permissions are not defined

Project:Email Field
Version:7.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

the field permissions module in 7 does this:

  $field_permissions = (isset($field['settings']['field_permissions']) && is_array($field['settings']['field_permissions']) ? array_filter($field['settings']['field_permissions']) : array());
  if (empty($field_permissions)) {
    return;
  }

That is, it checks to see if field permissions are defined at all. If not, it simply returns.

For this reason, I think in email.module near line 224 we need to change:

    if (!field_permissions_field_access('view', $field_info, $object_type, $object, $user)) {

-to-
    if (FALSE === field_permissions_field_access('view', $field_info, $object_type, $object, $user)) {

Comments

#1

Status:active» needs review

The above works fine, but is there a reason why we need to hard-code support for field_permissions rather than just calling field_access()?

(Also if email_mail_page() is only ever invoked as a menu callback we should return MENU_ACCESS_DENIED or MENU_NOT_FOUND instead of invoking drupal_access_denied() or drupal_not_found().)

AttachmentSize
email-contact_form_access-1272394-1.patch 573 bytes

#2

Version:7.x-1.0» 7.x-1.x-dev
Status:needs review» reviewed & tested by the community

Patch works for me. Had 'page not found' error, applied patch, error gone and form working again.

#3

Status:reviewed & tested by the community» fixed

Patch from #1 had a serious problem, as it used $field_name as parameter instead of $field_info.
Changed that, as well as the MENU_ACCESS_DENIED/MENU_NOT_FOUND, and committed it.

Thanks for the contributions.

#4

Status:fixed» closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

nobody click here