function ctools_metadata_user_access

Access callback for the user entity.

1 string reference to 'ctools_metadata_user_access'
_ctools_entity_access in includes/entity-access.inc
Core hack to include entity api-esque 'access callback' functions to core entities without needing to rely on entity api. Exception: We don't touch file entity. You must have entity API enabled to view files.

File

includes/entity-access.inc, line 102

Code

function ctools_metadata_user_access($op, $entity, $account, $entity_type) {
    $account = isset($account) ? $account : $GLOBALS['user'];
    // Grant access to the users own user account and to the anonymous one.
    if (isset($entity) && $op != 'delete' && ($entity->uid == $account->uid && $entity->uid || !$entity->uid && $op == 'view')) {
        return TRUE;
    }
    if (user_access('administer users', $account) || user_access('access user profiles', $account) && $op == 'view' && $entity->status) {
        return TRUE;
    }
    return FALSE;
}