Révision 7d7b5830
Ajouté par Assos Assos il y a environ 9 ans
drupal7/sites/all/modules/entity/modules/callbacks.inc | ||
---|---|---|
703 | 703 |
/** |
704 | 704 |
* Access callback for the user entity. |
705 | 705 |
*/ |
706 |
function entity_metadata_user_access($op, $entity = NULL, $account = NULL, $entity_type) { |
|
706 |
function entity_metadata_user_access($op, $entity = NULL, $account = NULL, $entity_type = NULL) {
|
|
707 | 707 |
$account = isset($account) ? $account : $GLOBALS['user']; |
708 | 708 |
// Grant access to the users own user account and to the anonymous one. |
709 |
if (isset($entity) && $op != 'delete' && (($entity->uid == $account->uid && $entity->uid) || (!$entity->uid && $op == 'view'))) { |
|
709 |
if (isset($entity->uid) && $op != 'delete' && (($entity->uid == $account->uid && $entity->uid) || (!$entity->uid && $op == 'view'))) {
|
|
710 | 710 |
return TRUE; |
711 | 711 |
} |
712 |
if (user_access('administer users', $account) || user_access('access user profiles', $account) && $op == 'view' && $entity->status) { |
|
712 |
if (user_access('administer users', $account) |
|
713 |
|| user_access('access user profiles', $account) && $op == 'view' && (empty($entity) || !empty($entity->status))) { |
|
713 | 714 |
return TRUE; |
714 | 715 |
} |
715 | 716 |
return FALSE; |
... | ... | |
724 | 725 |
} |
725 | 726 |
$account = isset($account) ? $account : $GLOBALS['user']; |
726 | 727 |
// Flag to indicate if this user entity is the own user account. |
727 |
$is_own_account = isset($entity) && $account->uid == $entity->uid; |
|
728 |
$is_own_account = isset($entity->uid) && $account->uid == $entity->uid;
|
|
728 | 729 |
switch ($property) { |
729 | 730 |
case 'name': |
730 | 731 |
// Allow view access to anyone with access to the entity. |
... | ... | |
794 | 795 |
/** |
795 | 796 |
* Access callback for the taxonomy entities. |
796 | 797 |
*/ |
797 |
function entity_metadata_taxonomy_access($op, $entity = NULL, $account = NULL, $entity_type) { |
|
798 |
function entity_metadata_taxonomy_access($op, $entity = NULL, $account = NULL, $entity_type = NULL) {
|
|
798 | 799 |
if ($entity_type == 'taxonomy_vocabulary') { |
799 | 800 |
return user_access('administer taxonomy', $account); |
800 | 801 |
} |
Formats disponibles : Unified diff
Weekly update of contrib modules