1

I have two custom entities (Adhérents and Personnes) linked to each other and to User.

  • One 'Adhérent' is mainly a "family" and has these fields: label, adresse (postal address), Téléphone (landline phone number), date d'adhésion (Membership start date).
  • One 'Personne' is a "person" ;-) and has these fields: Nom (Lastname), Prénom (Firstname), Portable (Cellphone number).

Each 'Personne' is linked to one 'Adhérent'. One 'Adhérent' may be linked to many 'Personne' (one of these 'Personne' being the 'contact'). Each 'Personne' is linked to one 'User'.

'Personne' is defined as entity_reference for 'Adhérent' (as the 'Contact'):

$fields['contactid'] = BaseFieldDefinition::create('entity_reference')  
  ->setLabel(t('Contact'))  
  ->setSetting('target_type', 'association_personne')  

'Adhérent' is defined as entity_reference for 'Personne':

$fields['adherentid'] = BaseFieldDefinition::create('entity_reference')
  ->setLabel(t('Adhérent'))
  ->setSetting('target_type', 'association_adherent')

'User' is defined as entity_reference for 'Personne':

$fields['userid'] = BaseFieldDefinition::create('entity_reference')
  ->setLabel(t('Utilisateur'))
  ->setRequired(TRUE)
  ->setSetting('target_type', 'user')

I use Views to publish all these contents (see Screen captures below).

When I look at the output with a user with no specific rights (i.e. not Administrator), some of the data are not displayed:

  1. In the 'Adhérents' view, the Contact column is empty (see capture 2) while there is a link to the entity (see capture 1).
  2. In the 'Personnes' view, the link to the entity_reference 'Adhérents' is there but the link to 'User' that should display email address (see capture 3) is completely absent, the column header is not even there (see capture 4).

Any idea?

Capture1

Capture3

Capture2

Capture4

The Permissions as they are set:

Permission1

Permission2

  • I mostly toggle the "Disable SQL Rewrite" option when I create views because I prefer using the views access plugins rather than creating interfaces that behave differently for different users. Subjectivity aside, you may find this option under Advanced -> Query settings. – mradcliffe Jul 12 '16 at 16:50
  • I just tried. Unfortunately, with no (visible) effect :-( – gbmapo Jul 12 '16 at 17:09
1

I'm not sure if I understand your problem correctly but would say that if it works as planned for admin user then the issue is with permissions.

Check permissions like: view user profile, view [entity type] etc.

|improve this answer|||||
  • Correct, being able to see entities and have them being linked depends on permissions defined by the given entity type. – Berdir Jul 12 '16 at 19:13
  • I took care about that (see Permissions screen captures I added to my question). What I don't understand is that it work in one way: 'Adhérent' as entity_reference is shown in 'Personne' Views page (captures 3 and 4). But not in the other way: 'Personne' as entity_reference in 'Adhérent' Views page is shown when I look at it as Administrator (capture 1) but not when I am a 'normal' user (capture 2)... – gbmapo Jul 12 '16 at 22:12
  • And you've cleared all caches? Rebuild permissions? Logout and login? – user1271930 Jul 13 '16 at 8:20
  • Yes. Yes. Yes. And tried with different browsers as well... – gbmapo Jul 13 '16 at 10:26
  • And what is the purpose of email and contact column/link? If it takes to contact form then have you checked permissions to use contact form? – user1271930 Jul 13 '16 at 11:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.