function field_update_7004

Grant the new "administer fields" permission to trusted users.

Related topics

File

modules/field/field.install, line 473

Code

function field_update_7004() {
    // Assign the permission to anyone that already has a trusted core permission
    // that would have previously let them administer fields on an entity type.
    $rids = array();
    $permissions = array(
        'administer site configuration',
        'administer content types',
        'administer users',
    );
    foreach ($permissions as $permission) {
        $rids = array_merge($rids, array_keys(user_roles(FALSE, $permission)));
    }
    $rids = array_unique($rids);
    foreach ($rids as $rid) {
        _update_7000_user_role_grant_permissions($rid, array(
            'administer fields',
        ), 'field');
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.